Skip to main content

Notifications

Microsoft Dynamics NAV forum
Suggested answer

Adjust inventory to 0

Posted on by Microsoft Employee

Hi all

I am trying to adjust all items to 0 via the revaluation journal, but it does not seem to work proberly. I end up with several item ledger entries with actual cost <> 0. If I run the code again afterwards new revaluation lines are created. Also I would like to know if there is another way to do this or if I am doing it the right way.

My code looks like this. 

OnRun()
ItemJournalLine2.SETRANGE("Journal Template Name",'VÆRDIJUST');
ItemJournalLine2.SETRANGE("Journal Batch Name",'STANDARD');
ItemJournalLine2.DELETEALL;
Item.FIND('-');
REPEAT
ItemLedgerEntry.SETRANGE("Item No.",Item."No.");
ItemLedgerEntry.SETRANGE(Positive,TRUE);
ItemLedgerEntry.SETRANGE("Completely Invoiced",TRUE);
IF(ItemLedgerEntry.FIND('-')) THEN BEGIN
REPEAT
ItemLedgerEntry.CALCFIELDS("Cost Amount (Actual)");
IF(ItemLedgerEntry."Cost Amount (Actual)" <> 0) THEN
InsertRevaluationLine(ItemLedgerEntry);
UNTIL ItemLedgerEntry.NEXT = 0;
END;
UNTIL Item.NEXT = 0;

LOCAL InsertRevaluationLine(ItemLedgerEntryRec : Record "Item Ledger Entry")
LineNo += 10000;
CurrentJnlBatchName := 'STANDARD';

ItemJournalLine.INIT;
ItemJournalLine.VALIDATE("Value Entry Type",ItemJournalLine."Value Entry Type"::Revaluation);
ItemJournalLine.VALIDATE("Source Code",'VÆRDIRGKLD');
ItemJournalLine."Journal Template Name" := 'VÆRDIJUST';
ItemJournalLine."Journal Batch Name" := 'STANDARD';
ItemJournalLine."Line No." := LineNo;
ItemJournalLine.VALIDATE("Document No.",'T04001');
ItemJournalLine.VALIDATE("Item No.",ItemLedgerEntryRec."Item No.");
ItemJournalLine.VALIDATE("Applies-to Entry",ItemLedgerEntryRec."Entry No.");
ItemJournalLine.VALIDATE("Unit Cost (Revalued)",0);
ItemJournalLine.INSERT(TRUE);

Thanks in advance!

  • Anita Spirax Profile Picture
    Anita Spirax 349 on at
    RE: Adjust inventory to 0

    I too am trying to do this in my system. Want to change value in inventory Unit cost to zero. Our costing method is average. When I try and run the Revaluation Journal  on the 'calc inventory value - test' I keep getting error text "you must fill in a location filter and variant filter or select the By location field and the By Variant field, if you revalue items with Costing Method Average, and if Average cost Calc. type is item & location & variant in inventory setup." We do have our inventory setup this way but don't use variants. in answer to the queries I am putting calculate per "item", by location, show results with my item number and limit totals to my location.  Any suggestion as to what I am doing wrong.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adjust inventory to 0

    Run again Revaluation Journal for specific Item (having Cost) and see if it reduce the cost to zero.

    Do you have any open transactions?

    What is your Item Costing Method?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adjust inventory to 0

    @Vishal

    thanks for the help

    I have followed your steps and ran the inventory valuation report afterwards. I now have an inventory value of 400k compared to 8mill before.

    When I look at the item ledger entries there are still a lot of entries with cost amoun actual <> 0. That should not be the case right?

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adjust inventory to 0

    Revaluation Journal would not change your quantity. It would only change the value.

    Follow these steps.

    1) complete all the pending transactions like purchase order received not invoiced, sales order shipped not invoiced, transfer order shipped not invoiced etc.

    2) run adjust cost item entries batch job.

    3) Go to revaluation journal. run the "Calculate Inventory Value" at Revaluation Journal and post the revaluation journal. You can enter the value as Zero in Inventory Value (Revalued) field.

    4) run adjust cost item entries batch job again.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adjust inventory to 0

    I want to keep the quantity in stock and revaluate them to 0. Thereafter I am going to revaluate them to standard cost price. I am testing and just want to set the inventory to zero value first

  • Suggested answer
    Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: Adjust inventory to 0

    Do you want to keep the quantity in stock, but just make it of zero value, or do you want to get rid of the items completely?

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adjust inventory to 0

    You should do like this.

    Follow these steps.

    1) complete all the pending transactions like purchase order received not invoiced, sales order shipped not invoiced, transfer order shipped not invoiced etc.

    2) run adjust cost item entries batch job.

    3) Go to revaluation journal. run the suggest item lines at Revaluation Journal and post the revaluation journal

    4) run adjust cost item entries batch job again.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Dynamics 365 Community Newsletter - August 2024

Catch up on the latest D365 Community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,186 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 227,996 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans