Skip to content

[EventRequest] Table 6651 "Return Shipment Line" - Procedure InsertInvLineFromRetShptLine - OnAfterDescriptionPurchaseLineInsert #27954

Open
@APsVallelonga

Description

Describe the request

Hello,
We would need a new event on the "InsertInvLineFromRetShptLine" procedure in the Table 6651 "Return Shipment Line", in order to be specular to the procedure in the "Sales Shipment Line".

New Event:

  procedure InsertInvLineFromRetShptLine(var PurchLine: Record "Purchase Line")
    var
        PurchHeader: Record "Purchase Header";
        PurchHeader2: Record "Purchase Header";
        PurchOrderLine: Record "Purchase Line";
        TempPurchLine: Record "Purchase Line" temporary;
        PurchSetup: Record "Purchases & Payables Setup";
        TransferOldExtLines: Codeunit "Transfer Old Ext. Text Lines";
        ItemTrackingMgt: Codeunit "Item Tracking Management";
        NextLineNo: Integer;
        ExtTextLine: Boolean;
        IsHandled: Boolean;
    begin
        SetRange("Document No.", "Document No.");

        TempPurchLine := PurchLine;
        if PurchLine.Find('+') then
            NextLineNo := PurchLine."Line No." + 10000
        else
            NextLineNo := 10000;

        if PurchHeader."No." <> TempPurchLine."Document No." then
            PurchHeader.Get(TempPurchLine."Document Type", TempPurchLine."Document No.");

        if PurchLine."Return Shipment No." <> "Document No." then begin
            PurchLine.Init();
            PurchLine."Line No." := NextLineNo;
            PurchLine."Document Type" := TempPurchLine."Document Type";
            PurchLine."Document No." := TempPurchLine."Document No.";
            PurchLine.Description := StrSubstNo(Text000, "Document No.");
            IsHandled := false;
            OnInsertInvLineFromRetShptLineOnBeforePurchLineInsert(Rec, PurchLine, NextLineNo, IsHandled);
            if not IsHandled then begin
                PurchLine.Insert();
           /*New Event
            OnAfterDescriptionPurchaseLineInsert(PurchLine,Rec,NextLineNo);
           */
                NextLineNo := NextLineNo + 10000;
            end;
        end;

Signature:

    [IntegrationEvent(false, false)]
    local procedure OnAfterDescriptionPurchaseLineInsert(var PurchLine: Record "Purchase Line"; ReturnShipmentLine: Record "Return Shipment Line"; var NextLineNo: Integer)
    begin
    end;

Thank You,
Luca

Additional context

We need this event to be able to insert additional Credit Memo lines in the Get Return Shipment Lines function.
Internal work item: AB#562720

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an event

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions