Hi, all. Recently, in our customer experienced very slow performance when running Adjust cost batch job. I’ve updated hotfixes to fix that problem mentioned here. mbs.microsoft.com/…/msdnav5adjustcostebatch.htm As my customers version is 5.0 SP1, i’ve applied two hotfixes 975251 and 976339 Even after this, i can’t run successfully Adjust Cost Batch job.
Error message is :
The Item Ledger Entry already exists.
Identification fields and values:
Entry No.=‘533742’
I’ve tried with debugger and code coverage, it stops in GetVisitedEntries procedure on table 339.
Manish is right - someone has tampered with ILE table data directly.
EVERY time someone complains about this error (Duplicate Entry No field in whatsoever table), the reason has been direct SQL INSERTS / DELETES in that table. EntryNo is PRIMARY KEY, Navision logic maintains it accurately, so do some investigation who & why has touched the DB with “dirty hands”…
Thank you guys. I’ve checked inserted transaction lines, it seems normal and right. Strange thing is before applied hotfixes we didn’t get any error message, the batch job was just slow… Now with some items the batch job is running ok, but with others not. Debugger had stop in GetVisitedEntries() procedure that is added by hotfix.
GetVisitedEntries(FromItemLedgEntry : Record “Item Ledger Entry”;ItemLedgEntryInChain : TEMPORARY Record “Item Ledger Entry”)
TrackChain := TRUE;
CheckIsCyclicalLoop(-1,FromItemLedgEntry);
IF ItemLedgEntryInChainNo.FIND(’-’) THEN
REPEAT
ToItemLedgEntry.GET(ItemLedgEntryInChainNo.Number);
ItemLedgEntryInChain := ToItemLedgEntry; ItemLedgEntryInChain.INSERT;
UNTIL ItemLedgEntryInChainNo.NEXT = 0;
I had checked this procedure and thought ItemLedgerEntryInChain must be temporary record. But it isn’t… if i change this record as temporary Adjust Cost batch works without error and item is adjusted!!!
Add a new GetVisitedEntries procedure in the Item Application Entry table (339) as follows:
Variable:
``
ItemLedgEntryInChainNo@1003 : TEMPORARY Record 2000000026; // Add a global variable.
TrackChain@1002 : Boolean; // Add a global variable.
Procedure:
``
GetVisitedEntries@15(FromItemLedgEntry@1000 : Record 32;**VAR ItemLedgEntryInChain@1001 : Record 32);** //Add a new procedure.
*This record variable is not temporary.....*
VAR: ToItemLedgEntry@1002 : Record 32;
// Add this variable.
TrackChain := TRUE;
CheckIsCyclicalLoop(-1,FromItemLedgEntry);
IF ItemLedgEntryInChainNo.FIND('-') THEN
REPEAT
ToItemLedgEntry.GET(ItemLedgEntryInChainNo.Number);
ItemLedgEntryInChain := ToItemLedgEntry;
ItemLedgEntryInChain.INSERT;
UNTIL ItemLedgEntryInChainNo.NEXT = 0;