Hopefully this post will save people with the same problem some time.
Error in Dutch Telebanking module since NAV 2018 when posting G/L Account Lines from page 11400 “Bank/Giro Journal”.
“Gen. Posting Type must not be in Gen. Journal Line: Journal Template Name=ABC, Journal Batch Name=DEFAULT, Line No.=10000”
Last week I upgraded one of my customer from 2017CU10 to 2018CU1 and they ran into the error when posting in the “Bank/Giro Journal”
It took me a while to figure out the reason of the error. But found the reason: a combination of a new standard field and Customer specific setup.
- Have a G/L Account with a “Gen. Prod. Posting Group” (and “VAT Prod. Posting Group” > not tested) filled
- In table 232 “Gen. Journal Batch” that is used by the Telebanking module to when posting the “Bank/Giro Journal “ (page 11400), have “Copy VAT Setup to Jnl. Lines” turned off. So, I do NOT want to used/fill Posting Groups in the Journals. The reason that “Gen. Prod. Posting Group” (and “VAT Prod. Posting Group”) are filled in the G/L Account is that NAV requires the Posting Groups when the G/L Account is used in a Sales or Purchase Order.
- Create a new “Bank/Giro Journal” line in Page 11400/11401 with the above “G/L Account” .
- Try to post it. It will raise the error above.
At first I thought something had changed in the settings of the Bank or G/L Account, perhaps a mistake by a user or something in the data upgrade process. But the reason was a new field in table 81 “Gen. Journal Line”.
Since NAV 2018 (at least CU1, build 19846) there is a new field in table 81 “Gen. Journal Line”, ie. 123 “Copy VAT Setup to Jnl. Lines”. This field has the InitValue set to Yes. In the table there is also code added to the OnInsert to fill this field with the value of the same field in the “Gen. Journal Batch”. This field in “Gen. Journal Batch” was used before to determine what had to be checked in table 81, but now the value of this field is copied to the new field in table 81. No problem so far. The new field and functionality work fine when working from the Journal directly.
But the Dutch Telebanking module uses table 81 in the background to post to the G/L and the ‘Dutch’ code is not aware of the new field yet. And this can raise the error above when posting from page 11400 “Bank/Giro Journal”.
Something like the code below fixes the problem.
Note that there wouldn’t have been a problem if this function had not been crap code, but written according to the NAV standards and an INSERT had been done before validating a lot other fields (thanks to the moron who wrote this crappy module).
CreateGenJournalLine(VAR GenJnlLine : Record "Gen. Journal Line")
GenJnlLine."Journal Template Name" := "Journal Template Name";
GenJnlLine."Journal Batch Name" := Text1000016;// STRSUBSTNO('%1',"No.");
GenJnlLine."Line No." := 0;
GenJnlBatch.GET(GenJnlLine."Journal Template Name",GenJnlLine."Journal Batch Name");
GenJnlLine."Copy VAT Setup to Jnl. Lines" := GenJnlBatch."Copy VAT Setup to Jnl. Lines";
Perhaps a better solution would be to also add the new field 123 “Copy VAT Setup to Jnl. Lines” to table 11401 and fill it on the OnInsert and/or OnValidate of the field “Account No.”.
Hopefully MS will work on this issue and release a proper solution in one of the next CU's.
I also suggest them to have a look at the code below.
Table 11401 field “Account No.” - OnValidate(). Imho this should be removed, or at least be replaced by Batch io. Template!?
IF JrnlTemplate."Copy VAT Setup to Jnl. Lines" THEN BEGIN
"VAT Bus. Posting Group" := GLAccount."VAT Bus. Posting Group";
"VAT Prod. Posting Group" := GLAccount."VAT Prod. Posting Group";