Hello developers,
I did some development in codeunit 12 for copying a customized field (named NARRATION) from purchse header/sales header/Gen journal to G/Lentry/Vend ledger entry/cust ledger entry. It work fine except for the G/L which is hitting because of Service Tax from Purchase order. Can anyone tell me where is the coding for the data getting copied to this particular G/L?
Hope I have made it clear
Do you want to add that field in Service tax entry table or G/L entry table ?
I want to add the field in G/L Entry table for that entry which hits “Service Tax Receivable Account”. For all other G/L Entries i.e. TDS or vat its coming but only for G/L Entry which belong to this particular “Service Tax Receivable Account” its not coming.
and this is the function which i added in last of Codeunit 12 (& i called this fucntion 3 times in codeunit 12 i.e. one for G/L Entry, once for Vend ledger & once for cust ledger)
CopyNarration() : Text[250]
WITH GenJnlLine DO BEGIN
gtx_Narration := ‘’;
lrc_GenJournalNarration.SETRANGE(“Journal Template Name”, “Journal Template Name”);
lrc_GenJournalNarration.SETRANGE(“Journal Batch Name”, “Journal Batch Name”);
lrc_GenJournalNarration.SETRANGE(“Document No.”, “Document No.”);
IF lrc_GenJournalNarration.FINDFIRST THEN
gtx_Narration := gtx_Narration + lrc_GenJournalNarration.Narration;
IF NOT lbn_NarrationFound THEN BEGIN
CASE GenJnlLine.“Source Type” OF
GenJnlLine.“Source Type”::Customer:
BEGIN
lrc_SalesInvoiceHeader.GET(“Document No.”);
gtx_Narration := lrc_SalesInvoiceHeader.InvNarration;
END;
GenJnlLine.“Source Type”::Vendor:
BEGIN
lrc_PurchInvHeader.GET(“Document No.”);
gtx_Narration := lrc_PurchInvHeader.InvNarration;
END;
END; // CASE
END; // WITH
EXIT(COPYSTR(gtx_Narration, 1, 250));
After running Debugger I saw that the code jumps to end after this line
IF NOT lbn_NarrationFound THEN BEGIN
i.e. it checks the above condition & the condition is true i.e. lbn_NarrationFound is 0 and it skips rest all code… any idea why?
What i understand is that the gtx_Narration is playing the main role of carring the data. First gtx_Narration is getting data added from lrc_GenJournalNarration.Narration then the same is overwritting by lrc_SalesInvoiceHeader.InvNarration and then with lrc_PurchInvHeader.InvNarration. Debug the code again and check the values which are passing and if it is getting blank somewhere.
While debugging I saw that when the G/L Account of service tax is running then the GenJnlLine.“Source Type” is empty while my coding is depend on “Source Type” only. I wonder why is this SOURCE TYPE empty?