Why does job Calculate Inventory posts two lines per item?

NagiNagi Member Posts: 151
One of our customers reported an issue with the job Calculate Inventory (report 790). They began noticing that some of the items listed were listed two times in the journal instead of just one. At first you'd think this would be because one of the entries in the item ledger might have location code A and the other B, but this is not the case. All entries have the same location code. It gets even weirder when you filter the job to only include the one item with a double entry. If you do this, then only one line will be posted. ](*,) I can't understand why a simple filter could cause the change in behaviour.

I also can't make sense of the quantity that is calculated on the extra line. In our case, the item has two entries in item ledger entry. The first is an initial purchase of 5 quantities on location A. Then, later, 1 quantity is sold from location A. The first line in the item journal will read a calculated inventory of 3, which is wrong, and the second line will read a calculated inventory of 4, which is correct.

I noticed this post, which appear to be the same problem, but no solution was given there.

http://www.mibuso.com/forum/viewtopic.php?f=23&t=32997&hilit=calculate+inventory

Can anybody tell me the reason for this behaviour? I'm really at a loss here. I've tried debugging, but I just can tell why or where the second line is created. :-k

//BEGIN EDIT//
This is NAV 4.0 SP2..
//END EDIT//

Comments

  • KowaKowa Member Posts: 923
    This may be due to these codelines in the Integer DataItem in the OnAfterGetRecord-Trigger
    IF Step = 0 THEN BEGIN
        Item.COPYFILTER("Location Filter",ItemLedgEntry."Location Code");
        Step := ItemLedgEntry.NEXT;
        IF ItemLedgEntry."Location Code" <> Location.Code THEN
          DimBufMgt.DeleteAllDimensions;
      END;
    (...)
    
    there is a hotfix available (KB 892600 ,requires a developer license) to correct this.
    Kai Kowalewski
  • NagiNagi Member Posts: 151
    Hello and thank you for your reply. However, I'm not sure if we're exactly on the same page, because report 790 Calculate Inventory does not have an Integer dataitem (only Item and Item Ledger Entry).

    I did try to merge the report with version 5.0 SP1, because a few changes have been made in the later version, but the result is still the same.

    When debugging, I have now noticed that the call to function InsertItemJnlLine only happens once for the item in question, even so we are still left with two lines in the journal once the job has finished. ](*,) ](*,) ](*,) That makes no sense to me :-k
  • KowaKowa Member Posts: 923
    Nagi wrote:
    However, I'm not sure if we're exactly on the same page, because report 790 Calculate Inventory does not have an Integer dataitem (only Item and Item Ledger Entry).
    The code fix applies only to the report version in NAV 4.0, MS rewrote the report in SP1 completely. Have you checked the dimensions for the two lines? Maybe they are different.
    Kai Kowalewski
Sign In or Register to comment.