[Event Request] Codeunit 5817 "Undo Posting Management" - OnCollectItemLedgEntriesBeforeError #11507 missing parameter
Please see #11507 - the SourceType in the event is still missing. Please provide with #11507, thanks - otherwise the provided event isn't really helpful.
procedure CollectItemLedgEntries(var TempItemLedgEntry: Record "Item Ledger Entry" temporary; SourceType: Integer; DocumentNo: Code[20]; LineNo: Integer; BaseQty: Decimal; EntryRef: Integer) var ItemLedgEntry: Record "Item Ledger Entry"; ItemTrackingMgt: Codeunit "Item Tracking Management"; IsHandled: Boolean; begin TempItemLedgEntry.Reset(); if not TempItemLedgEntry.IsEmpty then TempItemLedgEntry.DeleteAll(); if EntryRef <> 0 then begin ItemLedgEntry.Get(EntryRef); // Assertion: will fail if no entry exists. TempItemLedgEntry := ItemLedgEntry; TempItemLedgEntry.Insert(); end else begin if SourceType in [DATABASE::"Sales Shipment Line", DATABASE::"Return Shipment Line", DATABASE::"Service Shipment Line", DATABASE::"Posted Assembly Line"] then BaseQty := BaseQty * -1; if not ItemTrackingMgt.CollectItemEntryRelation( TempItemLedgEntry, SourceType, 0, DocumentNo, '', 0, LineNo, BaseQty) then begin IsHandled:=false; OnCollectItemLedgEntriesBeforeError(DocumentNo,LineNo,SourceType,IsHandled); if not IsHandled then Error(Text013, LineNo); end; end; end;
[IntegrationEvent(false, false)] local procedure OnCollectItemLedgEntriesBeforeError(DocumentNo: Code[20]; LineNo: Integer; SourceType: Integer; var IsHandled: Boolean) begin end;
We have implemented following event for the request that you are referencing to:
OnBeforeCheckMissingItemLedgers(TempItemLedgEntry, SourceType, DocumentNo, LineNo, BaseQty, IsHandled); it's in the local CheckMissingItemLedgers inside the CollectItemLedgEntries It does provide the SourceType among other additional parameters.