Dynamics NAV Posting Descriptions
I started in Navision back around 1996 for a small Company in Teddington (UK) called Timeweave who have like the Navision Product long since been swallowed up with a buyout, one of the first tasks I had to do and have done a number of times since was to take the Purchase Line Description down to the Ledgers and make the Posting Description more friendly.
Dynamics NAV has always “Rolled Up” Line Values in a Buffer table in the Posting Routines when the Navision Licence was sold by Database size units this saved space in the database and made economic sense.
In this Post I will show how this can be done by adding one field, Dropping another field onto a Page or Form, and adding just Ten lines of Code including 4 Placeholder Lines to the Posting Codeunit, there are a number of reasons this change could be requested in this Example I will look at something simple like an Invoice for a Cell (Mobile) Phone Supplier used by the Companies Resources.
A Normal Purchase Invoice
The Line Descriptions entered by the user show the individual Phone Users Names and the cost for the Previous Period.
If I navigate to the G/L Ledger Entries I only have the three lines for the G/L Accounts Phone and Fax, Purchase VAT and the Vendors Control Account, the Description for all entries is the Posting Description.
A Possible Solution
Table 49: Invoice Post. Buffer
In the Invoice Post. Buffer Table I add a new field to hold the Line Description, a different approach could be to retrieve the Line in the Posting Codeunit, this is the method I prefer.
I start by adding some Documentation to make it easier for other Developers and Upgrades.
The field has no Code or Property Changes just a simple field called Description Text 50.
While I am there looking at the Primary Key Fields the Last Field is the “Fixed Asset Line No.”.
Codeunit 90: Purch.-Post
Opening Codeunit 90 “Purch.-Post” and Searching for the “Fixed Asset Line No.” it is only found in one place the Function UpdInvPostingBuffer, another Search on the variable FALineNo also reveals that it is not used anywhere else, therefor this Field is only used to ensure that the Fixed Asset Line Values are not “Rolled Up”, this is what I want to do with my G/L Account Purchase Lines.
Again I start by adding some Documentation to make it easier for other Developers and Upgrades.
I know that I will be transferring the Description to the General Journal Line, knowing the Dynamics NAV Naming Convention I do a Search for GenJnlLine.INIT, after the Line that Updates the Description I add two lines of code and two placeholders lines so the Code can be easily found, if the Invoice Posting Buffer has a Description this will now be used.
To populate the Description from the Purchase Line I look for the function that populated the Invoice Posting Buffer table, after the Buffer table has been initialized I add four lines of code and two placeholder lines, two values are assigned the Description and the “Fixed Asset Line No.” which will ensure that the G/L Account Line Values are not “Rolled Up”.
Page 51: Purchase Invoice
The Client want to be able to Edit the “Posting Description”, to do this I make the field available on the Page or Form.
Again I start by adding some Documentation to make it easier for other Developers and Upgrades.
The Posting Description Field is added to the General Section and the Control Property set to Not Blank = Yes.
Enhanced Purchase Invoice
When the User Inserts a New Purchase Invoice the Posting Description is made available to be Edited.
In my New Purchase Invoice I updated the Posting Description and Added the Lines, Since I added the Posting Description the Posting Date is in the Wrong Column, I would move this to a more suitable location before releasing the Changes.
After Posting the Invoice the Line Description now goes down to the G/L Entries and the Posting Description to the Vendor Ledger, one thing to weigh up is that more entries will be created as the VAT account will have a One to One relationship to the Leger Lines.
Adding Value
Over the Years value has been added to this modification, adding the Posting Description to the Order, Credit Memo, adding a Flag to the G/L Account to only Post the Description for Selected Accounts, Controlling who can edit the Posting Description with a Flag on the User Setup Table, and doing the same to the Sales Documents and Sales Post Codeunit.