... IF FIND('-') THEN BEGIN FindNextRange := TRUE; SETRANGE("Valuation Date","Valuation Date"); REPEAT IF "Item Charge No." = '' THEN BEGIN IF "Valued By Average Cost" AND NOT Adjustment AND ("Valued Quantity" < 0) THEN BEGIN OutbndValueEntry := ValueEntry; OutbndValueEntry.INSERT; FindNextRange := FALSE; END; // GRA1.01 - Add Start // Add the following lines. IF ("Entry Type" = "Entry Type"::Revaluation) OR NOT (("Item Ledger Entry Type" = "Item Ledger Entry Type"::Transfer) AND InvtSetup.IsAvgCostCalcTypeItem) THEN BEGIN ExcludedValueEntry := ValueEntry; ExcludedValueEntry.INSERT; END; // End of the added lines. // GRA1.01 - Add End // GRA1.01 - Delete Start { IF "Partial Revaluation" OR "Valued By Average Cost" THEN BEGIN ExcludedValueEntry := ValueEntry; ExcludedValueEntry.INSERT; END; } // GRA1.01 - Delete End END; UNTIL NEXT = 0; END; IF FindNextRange THEN BEGIN AvgCostAdjmtEntryPoint."Valuation Date" := GetNextDate("Valuation Date"); AvgValueEntriesToAdjustExist(OutbndValueEntry,ExcludedValueEntry,AvgCostAdjmtEntryPoint); END; ...
... WITH ValueEntry DO BEGIN IF "Partial Revaluation" THEN EXIT(TRUE); IF "Item Ledger Entry No." = OutbndValueEntry."Item Ledger Entry No." THEN EXIT(TRUE); // GRA1.01 - Add Start IF "Item Ledger Entry Type" = "Item Ledger Entry Type"::Transfer THEN IF Adjustment AND ("Applies-to Entry" < OutbndValueEntry."Entry No.") THEN EXIT(FALSE); // GRA1.01 - Add End IF NOT "Valued By Average Cost" THEN EXIT(FALSE); // GRA1.01 - Delete Start { IF NOT InvtSetup.IsAvgCostCalcTypeItem AND ("Item Ledger Entry Type" = "Item Ledger Entry Type"::Transfer) AND ("Valued Quantity" >= 0) THEN EXIT(FALSE); } // GRA1.01 - Delete End ...
... // GRA1.01 - Delete Start { AvgCostAdjmtEntryPoint.UpdateValuationDate( ValueEntry,IsAvgCostItem,InvtSetup.IsAvgCostCalcTypeItem); } // GRA1.01 - Delete End // GRA1.01 - Add Start // Add the following lines. IF (ValueEntry."Item Ledger Entry Type" = ValueEntry."Item Ledger Entry Type"::Transfer) AND InvtSetup.IsAvgCostCalcTypeItem THEN EXIT; AvgCostAdjmtEntryPoint.UpdateValuationDate(ValueEntry,IsAvgCostItem,InvtSetup.IsAvgCostCalcTypeItem); // End of the added lines. // GRA1.01 - Add End
Comments
I've experienced, that endless loops can appear when entries are manipulated incorrectly. Such as deleted item ledger entries or modified closed by entry no field. The same for item application entries.
You can trace the entries causing the problem using the debugger. Then check if all fields and relations are plausible.
Here its helpful if you would run adjust cost for only that item which causes the problem. I could give you a code for that on tuesday
Thanks for the quick feedback. To answer your last point, yes I am running the Adjust Cost Item Entries routine for a singular item. The modification put in is similar to the way it was implemented in NAV 5.0, and it's also similar to how ara3n coded it on this forum. So no worries there...
Regarding the database, this was not a new implementation, and it has been going on for a while actually. I used the debugger and was able to find several value entries that the system keeps looping through time and time again. I know how many there are and what they are. The main challenge here is that I wasn't around when any potential manipulation was done to the system , so I cannot figure out where to start. However, maybe correcting the code above (if there's something wrong with it) would be a good start to solving this mystery.
Regards,
Raveendran.BS
The client doesn't use manfuacturing, however one of the items in question that loops endlessly has an assembly BOM. I did take Rashed's advice and ran the Adjust Cost Item Entries report on all components of an item before running it on the master item. Interestingly enough, all components finished adjustment almost instantaneously, but the master item just kept looping endlessly.
Anybody else might have a beat on this?
We run in an endless Loop caused by a blank Item Number in Tab27 some times ago.
We put Cost is Adjusted = true in this record.
If you trace through the "Item application entry" records starting from the Item ledger entry numbers that have the "Applied item to adjust" flag set you should find a loop.
Break the loop.
It's a protected table so you'll need a dev license.
TVision Technology Ltd