I have some fields in sales Line, and in sales order I gave the data to those fields but after invoicing how can I pass the information of those fields to Cust.Ledger entry table.
using flowfields in ledger entry tables can reduce performance.
so better add the needed fields in ledger entry table.
edit table 21 cust. ledger entry
goto fct. CopyFromGenJnlLine(GenJnlLine : Record "Gen. Journal Line")
add your code at the end of the fct.
load the document with "Document Type" and "Document No."
set the values.
best regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
yes, InitCustLedgEntry is an existing function in that codeunit.
the code above is already existing. so nothing to do for you.
... means: some lines in between
the shown code ist part of function "PostCust" in codeunit 12.
there goto line
CustLedgEntry.INSERT;
and write your own code above that line as shown in the code above.
best regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
Yes, I have observed those codeunits, but where can I assign my field and in which function? My target is to dispaly the total amount present in amount including tax field in customer ledger entry after posting and display the charges that I have added this field in sales Line table before posting I added charges amount to amount including tax field, but it didn't display the total amount present in amount including tax field in customer ledger entry table?
using flowfields in ledger entry tables can reduce performance.
so better add the needed fields in ledger entry table.
edit table 21 cust. ledger entry
goto fct. CopyFromGenJnlLine(GenJnlLine : Record "Gen. Journal Line")
add your code at the end of the fct.
load the document with "Document Type" and "Document No."
set the values.
best regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
edit table 21 "cust. ledger entry" (button design in development environment).
search for function (fct.) CopyFromGenJnlLine.
in this function the fields of a new cust. ledger entry are set.
you only have to add some lines of code at the end.
you can at least add the values of the additional fields from sales header here.
fields "document type" and "document no." are the key fields of table sales header. with them you can load the according sales header record (SalesHeader.GET("Document Type","Document No.");).
after that write something like that ...
CustLedgerEntry."Your Field 1" := SalesHeader."Your Field 1";
...
best regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
i checked again.
it's better you add you code to codeunit (CU) 12.
scroll down to function PostCust. ...
DtldCustLedgEntry.LOCKTABLE;
CustLedgEntry.LOCKTABLE;
InitCustLedgEntry(GenJnlLine,CustLedgEntry); // here above fct. CopyFromGenJnlLine is called
IF NOT Cust."Block Payment Tolerance" THEN
...
CVLedgEntryBuf.CopyFromCustLedgEntry(CustLedgEntry); // the new created cust.led.entry record is copied and then changed. your fields and values are not copied here.
...
// Post customer entry
CVLedgEntryBuf.CopyToCustLedgEntry(CustLedgEntry); // the changed data ist copied back to the cust.led.entry record
CustLedgEntry."Amount to Apply" := 0;
CustLedgEntry."Applies-to Doc. No." := '';
// start her your own code
// declare local variable SalesHeader of type "Sales Header"
// e.g.
SalesHeader.get(CustLedgEntry."document type",CustLedgEntry."document no.");
CustLedgEntry."your field 1" := SalesHeader."Your Field 1";
...
// end of your code
CustLedgEntry.INSERT;
...
best regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
yes, InitCustLedgEntry is an existing function in that codeunit.
the code above is already existing. so nothing to do for you.
... means: some lines in between
the shown code ist part of function "PostCust" in codeunit 12.
there goto line
CustLedgEntry.INSERT;
and write your own code above that line as shown in the code above.
best regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
Charges amount should get added to the amount including tax field while posting in sales order and that amount should post to the item for example amount including field has 100 and charges has 10 and while posting amount including field should has 110 and get posted the item amount as 110 in item card of sales amount(actual) field please suggest me....
but when ever I am posting in sales order the amount present in amount including tax field is get posted but I don't want that I just want only to post the amount field that I have created
please suggest me where can I change the code to achieve this.....
Answers
You can change the posting codeunits (sales = 80, ledger entries = 12) to achieve this but what is your target?
You could also use flow fields to lookup information in the posted documents.
Best regards,
Sebastien
please help me
so better add the needed fields in ledger entry table.
edit table 21 cust. ledger entry
goto fct. CopyFromGenJnlLine(GenJnlLine : Record "Gen. Journal Line")
add your code at the end of the fct.
load the document with "Document Type" and "Document No."
set the values.
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/
search for function (fct.) CopyFromGenJnlLine.
in this function the fields of a new cust. ledger entry are set.
you only have to add some lines of code at the end.
you can at least add the values of the additional fields from sales header here.
fields "document type" and "document no." are the key fields of table sales header. with them you can load the according sales header record (SalesHeader.GET("Document Type","Document No.");).
after that write something like that ...
CustLedgerEntry."Your Field 1" := SalesHeader."Your Field 1";
...
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/
it's better you add you code to codeunit (CU) 12.
scroll down to function PostCust.
...
DtldCustLedgEntry.LOCKTABLE;
CustLedgEntry.LOCKTABLE;
InitCustLedgEntry(GenJnlLine,CustLedgEntry); // here above fct. CopyFromGenJnlLine is called
IF NOT Cust."Block Payment Tolerance" THEN
...
CVLedgEntryBuf.CopyFromCustLedgEntry(CustLedgEntry); // the new created cust.led.entry record is copied and then changed. your fields and values are not copied here.
...
// Post customer entry
CVLedgEntryBuf.CopyToCustLedgEntry(CustLedgEntry); // the changed data ist copied back to the cust.led.entry record
CustLedgEntry."Amount to Apply" := 0;
CustLedgEntry."Applies-to Doc. No." := '';
// start her your own code
// declare local variable SalesHeader of type "Sales Header"
// e.g.
SalesHeader.get(CustLedgEntry."document type",CustLedgEntry."document no.");
CustLedgEntry."your field 1" := SalesHeader."Your Field 1";
...
// end of your code
CustLedgEntry.INSERT;
...
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/
Is InitCustLedgEntry a function?
the code above is already existing. so nothing to do for you.
... means: some lines in between
the shown code ist part of function "PostCust" in codeunit 12.
there goto line
CustLedgEntry.INSERT;
and write your own code above that line as shown in the code above.
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/
I got it
for details follow https://msdn.microsoft.com/en-us/library/hh173037(v=nav.90).aspx
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/
please suggest me where can I change the code to achieve this.....
Glad someone showed you where to find .INSERT in code unit 12.
@FlowFields: Regarding flow fields and performance I wanted to clarify this depends on how well your indexes are defined, how complex the conditions are to search for information and where you want to display the flow fields. I don't think one should generally avoid flowfields in these tables: https://blogs.msdn.microsoft.com/nav/2014/11/12/microsoft-dynamics-nav-faster-than-ever/
@Item Charges: http://forum.mibuso.com/discussion/67029/about-carrier-charges#latest
I think I understood you now: do you mean how to post item charges without applying taxes / VAT?
Best regards,
Sébastien