[Event Request] codeunit 5813 "Undo Purchase Receipt Line" - OnAfterCollectItemLedgEntriesOnPostItemJnlLine
Could we please have an event OnAfterCollectItemLedgEntriesOnPostItemJnlLine in Codeunit 5813 "Undo Purchase Receipt Line" in function PostItemJnlLine?
Code Example: UndoPostingMgt.CollectItemLedgEntries( TempApplyToEntryList, DATABASE::"Purch. Rcpt. Line", "Document No.", "Line No.", "Quantity (Base)", "Item Rcpt. Entry No.");
// start kvspsa - Event Raiser
IsHandled := false;
OnAfterCollectItemLedgEntriesOnPostItemJnlLine(PurchRcptHeader, PurchRcptLine, SourceCodeSetup, IsHandled);
if IsHandled then
exit(0); // "Item Shpt. Entry No."
// stop kvspsa
if "Job No." <> '' then
if TempApplyToEntryList.FindSet then
repeat
UndoPostingMgt.ReapplyJobConsumption(TempApplyToEntryList."Entry No.");
until TempApplyToEntryList.Next = 0;
Event: [IntegrationEvent(false, false)] local procedure OnAfterCollectItemLedgEntriesOnPostItemJnlLine(var PurchRcptHeader: Record "Purch. Rcpt. Header"; var PurchRcptLine: Record "Purch. Rcpt. Line"; SourceCodeSetup: Record "Source Code Setup"; var IsHandled: Boolean) begin end;
Thank you and kind regards
Why you always exit(0)? What do you want to achieve by this event? Let me know and I will adjust it for general use.
We would like to handle the undo of Purchase Receipt for Job related documents by ourselves. In order to do that, we need this handled-pattern. The return value of 0 for the Item Shipment Entry No. is exactly the same, the standard uses at the end of this function!?!
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. We will update this issue with information about availability.