Created a field in sales order and I want to post its value to customer ledger entry and item ledger entry. I'm using nav 2017. Which code units are used to do this?and explain me how to achieve this?
It is recommended to do posting entries though journal lines. The codeunits you will be using Gen Jnl Post Line and Item Jnl Post Line, you might be need to add code in the gen jnl line or item jnl line tables as well as new NAV versions such as NAV 2017 some functions have been moved to the tables which is good.
I presume you have a field on sales header. You need to create same type of field in the table 81 and 83.
also in tables 21 and 32 (ledger entries tables)
When posting happens first the value from field in sales header is copied to journal tables which are 81 and 83 then move to 21 and 32.
You need to place your code in Gen Jnl Post Line and Item Jnl Post Line codeunits.
"In the codeunit 12 in the PostCust function place code
CustLedgEntry.Examplefield := Examplefield
In the codeunit 22 in the function InitItemLedgEntry place code
ItemLedgEntry.Examplefield := Examplefield"
where can i get that ' Eaxamplefield' in codeunits??
you want me to create a variable 'Eaxmplefield' In codeunit 12 and 22 ??
or
from which tables i can get that field?
Answers
also in tables 21 and 32 (ledger entries tables)
When posting happens first the value from field in sales header is copied to journal tables which are 81 and 83 then move to 21 and 32.
You need to place your code in Gen Jnl Post Line and Item Jnl Post Line codeunits.
In the table 81 place code in CopyfromSalesHeader function
Examplefield := SalesHeader.Examplefield
In the table 83 place code in CopyfromSalesHeader function
Examplefield:= SalesHeader.Examplefield
In the codeunit 12 in the PostCust function place code
CustLedgEntry.Examplefield := Examplefield
In the codeunit 22 in the function InitItemLedgEntry place code
ItemLedgEntry.Examplefield := Examplefield
thanks in advance.
"In the codeunit 12 in the PostCust function place code
CustLedgEntry.Examplefield := Examplefield
In the codeunit 22 in the function InitItemLedgEntry place code
ItemLedgEntry.Examplefield := Examplefield"
where can i get that ' Eaxamplefield' in codeunits??
you want me to create a variable 'Eaxmplefield' In codeunit 12 and 22 ??
or
from which tables i can get that field?
so basically CustLedgEntry.Examplefield := GenJnlline.examplefield (dont need mention genjnline as its already there)
sames goes for ItemLedgEntry.Examplefield := Examplefield