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.DELETEALL;
ItemJnlLine3.RESET;
ItemJnlLine3.SETRANGE ( “Journal Template Name”, “Journal Template Name”);
ItemJnlLine3.SETRANGE ( “Journal Batch Name”, “Journal Batch Name”);

IF NOT THEN ItemJnlLine3.FINDLAST
IF INCSTR ( “Journal Batch Name”) <> ” THEN BEGIN
ItemJnlBatch.DELETE;
ItemJnlBatch.Name: = INCSTR ( “Journal Batch Name”);
IF THEN ItemJnlBatch.INSERT;
“Journal Batch Name”: = ItemJnlBatch.Name;
END;

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
http://forum.mibuso.com/discussion/44485/journal-batch-names

Advertisements

Microsoft AL: AL language code samples for developing extensions #DYNDEV365


#DYNDEV365 , Microsoft AL by Microsoft Modern Dev Team

As you likely know, “Microsoft is developing new tooling for working with On Premise NAV and Dynamics 365 for Financials“. Those tools will be available later in December (announced some weeks ago @Directions Events) and in the meantime, we’d like to share some code with you so you can get familiar (and excited) about it.

We’ll add more code samples here but in the meantime, we’d really like you to:
Have a look at the “Hello World code” -> Check out the differences between classic C/AL txt format and the new .al format.

al

hello-w

FROM GITHUB PAGE “Microsoft /AL”

“Welcome to the code sample repo for developing extensions to Dynamics NAV.”

This repo contains AL language code samples for developing extensions on the Dynamics NAV platform. We’re not yet in preview, so this repo is meant as a way for you to get familiar with the new syntax and provide feedback.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Source  https://github.com/Microsoft/AL

Great Job ! .. “AL” you are Welcome !

by Microsoft Modern Dev Team,  #DYNDEV365

More Information About the Developer Preview for Dynamics NAV – 13/12/2016

https://blogs.msdn.microsoft.com/nav/2016/12/13/more-information-about-the-developer-preview-for-dynamics-nav/

by NAV Team,  #DYNDEV365