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)Hi Yoshi,
this is an "improvement" in newer versions (NAV2013+)... which breaks a few features that are useful, like "Force Doc. Balance". And another one, like here:
"And now for a more recent bug introduced in NAV2013 RTM (sorry, only in german) : www.msdynamics.de/viewtopic.php
This one is CU13, and apparently an unnecessary change that killed a feature (apply an invoice with a payment in the same general journal, during posting of the batch). This works nicely as long as the payment is entered behind the invoice (higher line no.). Now CU13 is changing the key of the gen. journal lines to be sorted by document no. If the document no. of the payment comes before the invoice (usually they are different ), this won’t work anymore. The intended effect of the change was probably optimization, or improving the checking (have all lines of a document together in consecutive order for the check). The latter would be a possible plus if documents have been nested in the general journal. That’s highly unusual, though... But it breaks the other feature that’s actually being used. It would be possible to achieve this (post by document no.) and respect the line order (document no. of the first line first). This would be better, IMO."
The best possible treatment would be to just remove the key change. I can see no adverse effects :)
with best regards
Jens