ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] codeunit 5813 "Undo Purchase Receipt Line" - OnAfterCollectItemLedgEntriesOnPostItemJnlLine

Open MiRo65 opened this issue 6 years ago • 3 comments

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

MiRo65 avatar Jan 28 '20 12:01 MiRo65

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.

AlexanderYakunin avatar Feb 07 '20 09:02 AlexanderYakunin

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!?!

StHillmann avatar Mar 19 '20 10:03 StHillmann

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.

bc-ghost avatar Mar 24 '20 07:03 bc-ghost