[Event Request] Codeunit 5600 - FA Insert Ledger Entry - OnInsertReverseEntryOnBeforeCheckConsistency
Dear ALAppExtensions team,
Through this issue we would like to request adding event publisher OnInsertReverseEntryOnBeforeCheckConsistency in Codeunit 5600 FA Insert Ledger Entry with the following signature:
[IntegrationEvent(false, false)]
local procedure OnInsertReverseEntryOnBeforeCheckConsistency(var FALedgEntry3: Record "FA Ledger Entry")
begin
end;
with VAR parameter FALedgEntry3.
which would be called as follows in InsertReverseEntry:
procedure InsertReverseEntry(NewGLEntryNo: Integer; FAEntryType: Option " ","Fixed Asset",Maintenance; FAEntryNo: Integer; var NewFAEntryNo: Integer; TransactionNo: Integer)
var
SourceCodeSetup: Record "Source Code Setup";
FALedgEntry3: Record "FA Ledger Entry";
MaintenanceLedgEntry3: Record "Maintenance Ledger Entry";
DimMgt: Codeunit DimensionManagement;
TableID: array[10] of Integer;
AccNo: array[10] of Code[20];
begin
if FAEntryType = FAEntryType::"Fixed Asset" then begin
FALedgEntry3.Get(FAEntryNo);
FALedgEntry3.TestField("Reversed by Entry No.", 0);
FALedgEntry3.TestField("FA Posting Category", FALedgEntry3."FA Posting Category"::" ");
if FALedgEntry3."FA Posting Type" = FALedgEntry3."FA Posting Type"::"Proceeds on Disposal" then
Error(
Text003,
FALedgEntry3.FieldCaption("FA Posting Type"),
FALedgEntry3."FA Posting Type",
FALedgEntry.TableCaption, FALedgEntry3."Entry No.");
if FALedgEntry3."FA Posting Type" <> FALedgEntry3."FA Posting Type"::"Salvage Value" then begin
if not DimMgt.CheckDimIDComb(FALedgEntry3."Dimension Set ID") then
Error(Text006, FALedgEntry3.TableCaption, FALedgEntry3."Entry No.", DimMgt.GetDimCombErr);
Clear(TableID);
Clear(AccNo);
TableID[1] := DATABASE::"Fixed Asset";
AccNo[1] := FALedgEntry3."FA No.";
OnInsertReverseEntryOnNonSalvageValueFAPostingTypeOnBeforeCheckDimValuePosting(TableID, AccNo, FALedgEntry3);
if not DimMgt.CheckDimValuePosting(TableID, AccNo, FALedgEntry3."Dimension Set ID") then
Error(DimMgt.GetDimValuePostingErr);
if NextEntryNo = 0 then begin
FALedgEntry.LockTable();
NextEntryNo := FALedgEntry.GetLastEntryNo();
SourceCodeSetup.Get();
InitRegister(0, 1, SourceCodeSetup.Reversal, '');
RegisterInserted := true;
end;
NextEntryNo := NextEntryNo + 1;
NewFAEntryNo := NextEntryNo;
TmpFALedgEntry := FALedgEntry3;
TmpFALedgEntry.Insert();
SetFAReversalMark(FALedgEntry3, NextEntryNo);
FALedgEntry3."Entry No." := NextEntryNo;
...
FALedgEntry3.Insert(true);
// >>>> New >>>>>>>>>>>>>>>>
OnInsertReverseEntryOnBeforeCheckConsistency(FALedgEntry3);
// <<<< New <<<<<<<<<<<<<<<<
CODEUNIT.Run(CODEUNIT::"FA Check Consistency", FALedgEntry3);
OnInsertReverseEntryOnBeforeInsertRegister(FALedgEntry3);
InsertRegister(0, NextEntryNo);
end;
end;
...
end;
It is required due to some intermediate operations between Insert and FA Check Consistency.
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.