ALAppExtensions
ALAppExtensions copied to clipboard
[Event Request] CU13 OnBeforeCreateDimBalGenJnlLines
Can we have a new event "OnBeforeCreateDimBalGenJnlLines" in codeunit 13 "Gen. Jnl.-Post Batch" please.
Detail below:
local procedure CreateDimBalGenJnlLines(var SrcGenJournalLine: Record "Gen. Journal Line");
var
GenJournalLine: Record "Gen. Journal Line";
DimBalGLEntry: Record "G/L Entry";
TempInteger: Record Integer temporary;
TempBatchName: Code[10];
LineNo: Integer;
//<< NEW
IsHandled: Boolean;
//>> NEW
begin
TempBatchName := GetTempBatchName();
if SrcGenJournalLine.FindSet() then
repeat
//<< NEW
IsHandled := false;
OnBeforeCreateDimBalGenJnlLines(SrcGenJournalLine, TempBatchName, IsHandled);
If not IsHandled then begin
//>> NEW
DimBalGLEntry.Reset();
DimBalGLEntry.SetRange("G/L Account No.", SrcGenJournalLine."Account No.");
DimBalGLEntry.SetRange("Posting Date", 0D, SrcGenJournalLine."Posting Date");
SetGLEntryDimensionFilters(DimBalGLEntry, SrcGenJournalLine);
if DimBalGLEntry.FindSet() then
repeat
TempInteger.Number := DimBalGLEntry."Dimension Set ID";
if TempInteger.Insert() then;
until DimBalGLEntry.Next() = 0;
if TempInteger.FindSet() then
repeat
LineNo += 1;
DimBalGLEntry.SetRange("Dimension Set ID", TempInteger.Number);
DimBalGLEntry.CalcSums(Amount);
if DimBalGLEntry.Amount <> 0 then begin
GenJournalLine := SrcGenJournalLine;
GenJournalLine."Journal Batch Name" := TempBatchName;
GenJournalLine."Line No." := LineNo;
GenJournalLine.Validate("Dimension Set ID", TempInteger.Number);
GenJournalLine.Validate(Amount, -DimBalGLEntry.Amount);
GenJournalLine.Insert();
CopyDimBalGenJnlAlloc(SrcGenJournalLine, GenJournalLine);
end;
until TempInteger.Next() = 0;
//<< NEW
end;
//>> NEW
until SrcGenJournalLine.Next() = 0;
end;
//<< NEW
[IntegrationEvent(false, false)]
local procedure OnBeforeCreateDimBalGenJnlLines(SrcGenJournalLine: Record "Gen. Journal Line"; TempBatchName: Code[10]; var IsHandled: Boolean)
begin
end;
//>> NEW
Edit: forgot to add IsHandled in the call to the new event
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.