How to update G/L Entry and CLE in Sales Order Prepayment?

Aravindh_Navision
Member Posts: 258
Hi Friends,
I have created a new option field (Name: OptionField with optionstrings Blank,Option1, Option2) in Sales Order (Table: "Sales Header") with an field ID 50000. With the same field ID, field name and options value, I created a new field in Posted Sales Invoice (Table: "Sales Invoice Header"), "G/L Entry", "Cust. Ledger Entry" tables. I need to update the field value in the above mentioned tables after posting the sales order.
To update in Posted Sales Invoice, NAV will take care automatically by matching the field ID. To update in "G/L Entry" and "Cust. Ledger Entry", I wrote a code in PostGLAcc() function in the codeunit "Gen. Jnl.-Post Line" (codeunit 12).
and in PostCust() function in the same codeunit "Gen. Jnl.-Post Line" (codeunit 12).
Issue: I got struck when I make a Sales Prepayment. From Sales Order form > Posting (button) > Prepayment > Post Prepayment Invoice. It is calling a codeunit "Sales-Post Prepayment (Yes/No)" (codeunit 443), which again calls functions in "Sales-Post Prepayments" (codeunit 442).
The option field value is not getting updated in "G/L Entry" and "Cust. Ledger Entry" tables. I tried debugger, but I could not able to make it up where this activity is happening.
Can anyone tell me the codeunit/function of where it is getting hitted and assigning the values?
Thanks in advance,
Aarvi.
I have created a new option field (Name: OptionField with optionstrings Blank,Option1, Option2) in Sales Order (Table: "Sales Header") with an field ID 50000. With the same field ID, field name and options value, I created a new field in Posted Sales Invoice (Table: "Sales Invoice Header"), "G/L Entry", "Cust. Ledger Entry" tables. I need to update the field value in the above mentioned tables after posting the sales order.
To update in Posted Sales Invoice, NAV will take care automatically by matching the field ID. To update in "G/L Entry" and "Cust. Ledger Entry", I wrote a code in PostGLAcc() function in the codeunit "Gen. Jnl.-Post Line" (codeunit 12).
WITH GenJnlLine DO BEGIN IF "Delayed Unrealized VAT" AND "Realize VAT" THEN IF ("Applies-to Doc. No." <> '') OR ("Applies-to ID" <> '') THEN PostDelayedUnrealizedVAT; // Post G/L entry InitGLEntry( "Account No.","Amount (LCY)", "Source Currency Amount",TRUE,"System-Created Entry"); IF NOT "System-Created Entry" THEN IF "Posting Date" = NORMALDATE("Posting Date") THEN GLAcc.TESTFIELD("Direct Posting",TRUE); GLEntry."Gen. Posting Type" := "Gen. Posting Type"; GLEntry."Bal. Account Type" := "Bal. Account Type"; GLEntry."Bal. Account No." := "Bal. Account No."; GLEntry."No. Series" := "Posting No. Series"; GLEntry."Option Field" := "Option Field"; // Newly assigned option field value IF "Additional-Currency Posting" = "Additional-Currency Posting"::"Additional-Currency Amount Only" THEN BEGIN GLEntry."Additional-Currency Amount" := Amount; GLEntry.Amount := 0; END; InitVat; InsertGLEntry(TRUE); IF EntryType = GLEntry."Entry Type"::Definitive THEN BEGIN PostJob; PostVAT; END; END;
and in PostCust() function in the same codeunit "Gen. Jnl.-Post Line" (codeunit 12).
WITH GenJnlLine DO BEGIN IF Cust."No." <> "Account No." THEN Cust.GET("Account No."); Cust.CheckBlockedCustOnJnls(Cust,"Document Type",TRUE); IF "Posting Group" = '' THEN BEGIN Cust.TESTFIELD("Customer Posting Group"); "Posting Group" := Cust."Customer Posting Group"; END; CustPostingGr.GET("Posting Group"); CustPostingGr.TESTFIELD("Receivables Account"); DtldCustLedgEntry.LOCKTABLE; CustLedgEntry.LOCKTABLE; CustLedgEntry.INIT; CustLedgEntry."Customer No." := "Account No."; CustLedgEntry."Posting Date" := "Posting Date"; . . . CustLedgEntry.Prepayment := Prepayment; CustLedgEntry."Option Field" := "Option Field"; // Newly assigned option field value . . .This is working fine.
Issue: I got struck when I make a Sales Prepayment. From Sales Order form > Posting (button) > Prepayment > Post Prepayment Invoice. It is calling a codeunit "Sales-Post Prepayment (Yes/No)" (codeunit 443), which again calls functions in "Sales-Post Prepayments" (codeunit 442).
The option field value is not getting updated in "G/L Entry" and "Cust. Ledger Entry" tables. I tried debugger, but I could not able to make it up where this activity is happening.
Can anyone tell me the codeunit/function of where it is getting hitted and assigning the values?
Thanks in advance,
Aarvi.
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions