Categories
NAV 2017 (10) Reminder

Incrementing Batch Name in Journal Batch Name

Incrementing Journal Batch Name is a nice feature, but frequently we don’t use it. Read more to know how to inactivate it.

When using Journal, if the Journal Batch Name contains any number, then if all the lines are posted, and none lines remaining, then NAV will automatically delete the Batch Name, and create a new Batch Name by incrementing the Batch Name, ie. BATCH-01A will be BATCH-02A.

Although this feature is not used publicly by the customers, this feature is existing and no setup to manage that.

However, the code responsible for that job lies in:

Codeunit 13 Gen. Jnl.-Post Batch

UpdateAndDeleteLines

END ELSE BEGIN
// Not a recurring journal
GenJnlLine2.COPY(GenJnlLine);
GenJnlLine2.SETFILTER(“Account No.”,’%1′,”);
IF GenJnlLine2.FINDLAST THEN; // Remember the last line
GenJnlLine3.COPY(GenJnlLine);
GenJnlLine3.SETCURRENTKEY(“Journal Template Name”,”Journal Batch Name”,”Line No.”);
GenJnlLine3.DELETEALL;
GenJnlLine3.RESET;
GenJnlLine3.SETRANGE(“Journal Template Name”,GenJnlLine.”Journal Template Name”);
GenJnlLine3.SETRANGE(“Journal Batch Name”,GenJnlLine.”Journal Batch Name”);
IF NOT GenJnlLine3.FINDLAST THEN
IF INCSTR(GenJnlLine.”Journal Batch Name”) ” THEN BEGIN
GenJnlBatch.DELETE;
IF GenJnlTemplate.Type = GenJnlTemplate.Type::Assets THEN
FAJnlSetup.IncGenJnlBatchName(GenJnlBatch);
GenJnlBatch.Name := INCSTR(GenJnlLine.”Journal Batch Name”); //AW: This is the responsible line
IF GenJnlBatch.INSERT THEN;
GenJnlLine.”Journal Batch Name” := GenJnlBatch.Name;
END;

Hence, I you want to remove this ‘annoying’ feature, you know what to do 🙂

Reference:
https://msdn.microsoft.com/en-us/dynamics-nav/incstr-function–code–text-

Have a good day!

2 replies on “Incrementing Batch Name in Journal Batch Name”

Leave a reply to Andri Wianto Cancel reply