Customer Legder Entry - Remaining Amount not zero after posting Gen. Journal Line - Payment

robthemobb
Member Posts: 14
Hi everyone!
I wrote some code in a XML port which set up some lines in Gen. Journal Line (table 81). Afterwards I ran CU "Gen. Jnl.-Post". It works almost fine. If I double-check in the Customer Ledger Entries, the remaining amount is still as high as the Original Amount and the Amount. If I key-in all the values manually within the General Journal, the Remaining Amount in the Customer Ledger Entry is 0 (as expected). Does anybody has a clue why and how I can tell NAV to update the Remaining Amount?
Help is appreciated.
Rob
I wrote some code in a XML port which set up some lines in Gen. Journal Line (table 81). Afterwards I ran CU "Gen. Jnl.-Post". It works almost fine. If I double-check in the Customer Ledger Entries, the remaining amount is still as high as the Original Amount and the Amount. If I key-in all the values manually within the General Journal, the Remaining Amount in the Customer Ledger Entry is 0 (as expected). Does anybody has a clue why and how I can tell NAV to update the Remaining Amount?
Help is appreciated.
Rob
GeneralJournalLine.VALIDATE("Posting Date", TODAY); GeneralJournalLine.VALIDATE("Document No.", DocNo); GeneralJournalLine.VALIDATE("Document Type", GeneralJournalLine."Document Type"::Payment); GeneralJournalLine.VALIDATE("Account Type", GeneralJournalLine."Account Type"::Customer); [...] GeneralJournalLine.VALIDATE("Account No.", CustLedgerEntry."Customer No."); GeneralJournalLine.VALIDATE("Applies-to Doc. No.", CustLedgerEntry."Document No."); GeneralJournalLine.VALIDATE("Applies-to Doc. Type", CustLedgerEntry."Document Type"); GeneralJournalLine.VALIDATE(Amount, Amount); GeneralJournalLine.VALIDATE("Bal. Account Type", GeneralJournalLine."Bal. Account Type"::"G/L Account"); GeneralJournalLine.VALIDATE("Bal. Account No.", '1210'); IsInserted := FALSE; IsInserted := GeneralJournalLine.INSERT(TRUE); IF IsInserted THEN CODEUNIT.RUN(CODEUNIT::"Gen. Jnl.-Post", GeneralJournalLine)
0
Best Answer
-
Hi,
Try first inserting empty G/L Line with only Template/Batch/Line fields populated, then fill up remaining fields, keeping population order close to how you would populate journal manually.
Populate Apply-To Type/ID fields last, then MODIFY, then post.
SlawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-035
Answers
-
Hi, could be the validation order.
Try to put Aplies-To* field validation at the end you your code and in reversed order:GeneralJournalLine.VALIDATE("Applies-to Doc. Type", CustLedgerEntry."Document Type"); GeneralJournalLine.VALIDATE("Applies-to Doc. No.", CustLedgerEntry."Document No.");
SlawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-031 -
Hi, unfortunately this isn't the solution for my problem. If you do have any other hint, I am happy to try hear it. Thanks for your help!
R0 -
Hi,
you should use the same validation sequence in code as you entered recodr manually. With standard object table 81 should be the best solution Slawek suggested.0 -
Hi,
Try first inserting empty G/L Line with only Template/Batch/Line fields populated, then fill up remaining fields, keeping population order close to how you would populate journal manually.
Populate Apply-To Type/ID fields last, then MODIFY, then post.
SlawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-035 -
After all, @Slawek_Guzek's first answer is right, though. I am sorry for flagging it wrong!
I had entered also a Validate for the field "Applies-to Ext. Doc. No.", even though the external doc number isn't linked to the G/L entry.
I do insert the populated line, now. It works fine.
Thanks anyway!
rob0
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