how to transfer a new custom field from sales order to the Fa ledger entry?
i created one field in sales header and i created one fa ledger entries
For ex : Test Field how should i carry the data where should write the code in code unit can tell me the function and code unit number
Hi @Sai_Shiva,
First of all, saler order doesnât create FA Ledger Entry⌠if you mean when posting an invoice from Sales Order, ok, we can go through the processâŚ
You must add this new fields to General Journal Line and Invoice Posting Buffer (or Invoice Post. Buffer in earlier versions) tables.
Then you must transfer the data from sales header/line to the buffer (you can use OnAfterPrepareSales event from buffer, bear in mind that the info in buffer is grouped, but if there is a Fixed Asset, this is not a problem, will not be grouped).
Transfer from buffer to General Journal Line (use OnAfterCopyToGenJnlLine event from buffer table).
Finally from General Journal Line, transfer data to FA Ledger Entry (using CopyFromGenJnlLine from codeunit âMake FA Ledger Entryâ).
Best regards.
To transfer data from a custom field in a sales order to the corresponding field in the FA ledger entry, you will need to modify the code unit that handles the transfer of data between the sales order and the FA ledger entry. This code unit is typically called âPost Inventory Cost to G/Lâ (code unit number 5898 in Microsoft Dynamics NAV).
Hereâs an overview of the steps you can take:
-
In the sales order table, create a new field for the data you want to transfer to the FA ledger entry. In this case, you have already created the âTest Fieldâ in the sales header.
-
In the FA ledger entry table, create a corresponding field to hold the data from the sales order.
-
Open the âPost Inventory Cost to G/Lâ code unit and find the function that transfers data from the sales order to the FA ledger entry. This function is typically called âCreateFAEntriesFromSourceDocâ or âCreateFALinesFromSourceDocâ.
-
In this function, find the code that copies data from the sales order fields to the corresponding fields in the FA ledger entry. Add code to copy the data from your custom field in the sales order to the corresponding field in the FA ledger entry. Hereâs an example of what this code might look like:
IF SalesHeader.TESTFIELD <> ââ THEN BEGIN
FALedgerEntry.TESTFIELD := SalesHeader.TESTFIELD;
END;
This code checks if the âTest Fieldâ in the sales order is not blank, and if so, copies the data to the corresponding field in the FA ledger entry. -
Compile and test your changes to make sure the data is being transferred correctly.
Note that these steps are general guidelines and may need to be modified depending on the specific version and configuration of your Dynamics NAV system. You should also ensure that any customizations you make are thoroughly tested in a development or test environment before being deployed to your live system.
Thank You For Your replay
You are welcome. Please mark my answer as the solution if it helped you to solve your problem.