Problem with codeunit 22 - function ApplyItemLedgEntry

lphanlphan Member Posts: 10
Hi

Suddently, our customer had the problem when posting consumption journal - the system complained "Item is not in inventory" although there had enough stock. For that item, there were 2 open entries, one with remaining = 6, and one with remaining = 60, but the consumption only required 10. So in theory, the system should apply the first open entry with qty 6, and find the next open entry to apply the remaining 4. But when debugging it, in CU 22, fnction ApplyItemLedgEntry - we found out that the system applied the first open entry correctly but could not go to the next record. It seemed that the OldItemLedgEntry.MODIFY statement to modify the Open field which is one of the field of the key and then that caused the NEXT record unpredictable. But the point is the key is on ItemLedgEntry2 not on OldItemLedgEntry. So I coud not understand why. As if it is a bug, I should have heard that as it is the first time I have received this kind of problem and I have a lot of customers are using manufacturing in SQL without any problem.

Could any one of you to set some light why this problem happens.
FYI: We have changed the code to get around the problem but I am not so comfortable as this problem is so strange for me.

Thanks in advance.

Comments

  • wochmwochm Member Posts: 26
    Hello,
    Maybe these entries had different location codes or variant codes? Or there were a reservation?

    Best Regards
    Marcin Woch
    _____________________
    "ANTEI" Woch Marcin
    email: marcinwoch@wp.pl
    tel.: (+48608) 39 46 29
    Poland
  • lphanlphan Member Posts: 10
    Hi

    Thanks for reply.

    No, they all had the same location, variant as when I debugged it, the filter returned 2 lines but when the first line being modified, system did not find the next line as .NEXT returned 0
  • jreynoldsjreynolds Member Posts: 175
    I have seen this happening once and it turns out that there is a bug in the SQL version where NEXT will in fact move to the next record but will report 0 as it's result. As far as I know there is no fix from Microsoft. As a work around you can execute the NEXT without regard to it's result and then compare the "Entry No." on the current record and the previous record to determine if you are indeed at the end of the record set.
  • csimoneauxcsimoneaux Member Posts: 168
    You might want to make sure the the Open column is checked, in order to usethese items. I have seen a problem with is issue.
Sign In or Register to comment.