Adjust Cost -Item Entries, The Item Ledger Entry No. already exist ERROR!

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.

Please, help me guys…

Any Data modification involved from the back.

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”…

Cool down modris, its just the end user who never knows until they are stuck & then asks for solution.

@Manish - enduser in Dev forum, who uses Debugger and gives precise technical info? I strongly doubt, but let’s wait for updates from OP himself…

End user are the one’s who force the developer to modify the data as this is the requirement.

Anyways lets wait,might be we get to see somethign new.

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!!!

Should i change microsoft hotfix?!?!?!

https://mbs2.microsoft.com/Knowledgebase/KBDisplay.aspx?scid=kb;en-us;975251

  1. 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;
    
    

If it related to HF then report it to Microsoft.

The problem was in GetVisitedEntries procedure… One parameter should have been Var tick is checked. :slight_smile: