Hi,
we're exporting general journal lines from an external system into NAV.
Since the Document No. from the external system are a little bit messy, I unchecked the option "Force Doc. Balance" in the corresponding Journal Template. Still we have situations where the Document No. causes problems.
I created a small example that shows our problem. The lines will be posted in order of the Document No.
This makes no sense to me since i explicitly unchecked the option "Force Doc. Balance"! Now during the posting process every time there is a change in the Posting Date the system will check if the current balance is zero which of course is not, since the line that would balance the first line would only come later in the posting process.
My General Journal:
| Posting Date | Document Type | Document No. | External Document No. | Account Type | Account No. | Description | Gen. Posting Type | Amount |
| 04.08.2015 | Invoice | TEST_0 | 123 | Vendor | K00001 | Kreditor K00001 | -100 | |
| 04.08.2015 | Invoice | TEST_2 | 123 | G/L Account | 42003 | Verbindl. aus Lief. u. Leistg. AR/Einbeh | Purchase | 100 |
| 06.08.2015 | Invoice | TEST_1 | 456 | Vendor | K00001 | Kreditor K00001 | -200 | |
| 06.08.2015 | Invoice | TEST_3 | 456 | G/L Account | 42003 | Verbindl. aus Lief. u. Leistg. AR/Einbeh | Purchase | 200 |
The order of posting is like this:
1. TEST_0 on 04.08.15 -> Current Balance = -100
2. TEST_1 on 06.08.15 -> System detects a change in Posting Date and checks if the current balance is zero.
--> ERROR
If I would post every day alone there would be no error. So posting the two days together should also be correct. But NAV won't let us do this because it sorts in the order of the Document No. and I can't understand why it would do that.
This code in Codeunit 13 causes the sorting. Maybe someone can explain me why this is needed.
...
// Check lines
LineCount := 0;
StartLineNo := "Line No.";
NoOfRecords := COUNT;
REPEAT
LineCount := LineCount + 1;
UpdateDialog(RefPostingState::"Checking lines",LineCount,NoOfRecords);
CheckRecurringLine(GenJnlLine);
UpdateRecurringAmt(GenJnlLine);
CheckAllocations(GenJnlLine);
GenJnlLine5.COPY(GenJnlLine);
PrepareGenJnlLineAddCurr(GenJnlLine5);
GenJnlCheckLine.RunCheck(GenJnlLine5);
TempGenJnlLine := GenJnlLine5;
TempGenJnlLine.INSERT;
IF NEXT = 0 THEN
FINDFIRST;
UNTIL "Line No." = StartLineNo;
IF GenJnlTemplate.Type = GenJnlTemplate.Type::Intercompany THEN
CheckICDocument(TempGenJnlLine);
// Check balance
IF GenJnlBatch."No. Series" = '' THEN
SETCURRENTKEY("Document No.");
LineCount := 0;
LastDate := 0D;
LastDocType := 0;
LastDocNo := '';
...
*This post is locked for comments
I have the same question (0)

Report
All responses (
Answers (