The procedure changed and now the customers have to post it one by one as they do not need to enable Force Document Balance and post.
BC22.0 codeunit 13 - procedure ProcessBalanceOfLines:
This code will NOT sort the Journal on "Bal. Account No." and will post fine.
begin
IsProcessingKeySet := false;
OnBeforeProcessBalanceOfLines(GenJnlLine, GenJnlBatch, GenJnlTemplate, IsProcessingKeySet);
if not IsProcessingKeySet then
if GenJnlTemplate."Force Doc. Balance" then
GenJnlLine.SetCurrentKey("Document No.", "Posting Date");
LineCount := 0;
LastDate := 0D;
LastDocType := LastDocType::" ";
LastDocNo := '';
BC23.2 codeunit 13 - procedure ProcessBalanceOfLines:
This code has added an ELSE with a new SetCurrentKey, it will sort the journal differently, thus generating a failure on checking whether the next Document No. is correct. Definitely not an optimal design.
begin
IsProcessingKeySet := false;
OnBeforeProcessBalanceOfLines(GenJnlLine, GenJnlBatch, GenJnlTemplate, IsProcessingKeySet);
if not IsProcessingKeySet then
if GenJnlTemplate."Force Doc. Balance" then
GenJnlLine.SetCurrentKey("Document No.", "Posting Date")
else
GenJnlLine.SetCurrentKey("Journal Template Name", "Journal Batch Name", "Bal. Account No.");
LineCount := 0;
LastDate := 0D;
LastDocType := LastDocType::" ";
LastDocNo := '';
LastFAAddCurrExchRate := 0;
Further down Codeunit 13 is: if ShouldCheckDocNoBasedOnNoSeries then
CheckDocNoBasedOnNoSeries(LastDocNo, GenJnlBatch."No. Series", NoSeriesMgt);
Here it fails because the Journal is incorrectly sorted
Comments
GenJnlLine should not be sorted based on Bal. Account No, and then evaluate the No. Series. This will result in a failure, given that No. Series.Manual Nos is disabled, which is common on General Journals
Category: Financial Management
Business Central Team (administrator)
Thank you for reaching out. Your suggestion seems to be a product bug. Please reach out to the relevant support channel as specified in Product Support following information on link below:
https://docs.microsoft.com/dynamics365/business-central/dev-itpro/help-and-support#bugs
Business Central Team