Showing posts with label Batch Job. Show all posts
Showing posts with label Batch Job. Show all posts

Sunday, March 17, 2019

Transaction No. Update in Ledger and Posted Transnational Tables in Dynamics NAV

Hello Friends,

When we create new G/L Entry manual in 17 G/L Entry table than most of time we forgot to set Transaction No. to max value + 1 in new inserted entry.

When system post any new G/L Entry, It has take transaction no.from last entry and increment by 1 to create new entry.

So, if result is that Transaction No. start duplicate values and it cause issue some reports and reverse transaction.

So, i have create batch process to correct unique incremental value in posted entries.

Identify the G/L Entry number from where the system start creating duplicate transaction number.

Now the following batch process correct data, 

Sample Code

//17
GL_lRec.RESET;
GL_lRec.SETRANGE("Posting Date","Posting Date");
GL_lRec.SETRANGE("Document No.","Document No.");
IF GL_lRec.FINDSET THEN BEGIN
  REPEAT
    IF GL_lRec."Transaction No." = OldTranscationNo_gInt  THEN BEGIN
      GL_lRec."Transaction No." := NewTranscationNo_gInt;
      GL_lRec.MODIFY;
    END;
  UNTIL GL_lRec.NEXT = 0;
END;

Download the batchjob object from attached link:
https://1drv.ms/u/s!An8nhANnLJmtkBgLpHo4bTcvA4pS

Let me know if you have any query
Thank you for reading

Keep Sharing..Keep Growing...