How “not” to increase the batch name

NAV standard, in the case of use of batch name containing numbers, after posting automatically increases the last number existing in batch name (example: Batch 1 > 2 ..AL110A > AL111A.. and so on..)

This functionality is handled “Bydesign” in NAV, if you want to “NOT increase” the number and keep the same number in the batch (example in the case of fixed batch used for example for output and consumption and related numbered machines, former assets) can modify the codeunit 23 “Item Jnl.-Post Batch”

To achieve this, you need to change this line ItemJnlBatch.Name: = INCSTR ( “Journal Batch Name”) in function HandleNonRecurringLine

Function HandleNonRecurringLine

(VAR ItemJnlLine: Record “Item Journal Line”; OldEntryType: ‘Purchase, Sale, Adjmt Positive., Negative Adjmt., Transfer, Consumption, Output,, Assembly Consumption, Output Assembly’)

Original Code
ItemJnlLine3.COPY (ItemJnlLine);
ItemJnlLine3.SETRANGE ( “Journal Template Name”, “Journal Template Name”);
ItemJnlLine3.SETRANGE ( “Journal Batch Name”, “Journal Batch Name”);

IF INCSTR ( “Journal Batch Name”) <> ” THEN BEGIN
ItemJnlBatch.Name: = INCSTR ( “Journal Batch Name”);
“Journal Batch Name”: = ItemJnlBatch.Name;

You can change code in this way … for example in case of Outputs Consumptions entries to post from machine from MES..
IF NOT (ItemJnlLine2. “Entry Type” IN [ItemJnlLine2. “Entry Type” :: Consumption, ItemJnlLine2. “Entry Type” :: Output]) THEN
//ItemJnlBatch.Name: = INCSTR ( “Journal Batch Name”); // OLD
ItemJnlBatch.Name: = “Journal Batch Name”; // NEW, maintain old batch name, don’t use INCRSTR statement

Nice post here on Mibuso about this issue.
Journal batch names post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.