Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
APsVallelonga opened this issue Jan 17, 2025 · 0 comments
Labels
event-request Request for adding an event SCM GitHub request for SCM area

Comments

@APsVallelonga
Copy link

APsVallelonga commented Jan 17, 2025

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

@nikolakukrika nikolakukrika added SCM GitHub request for SCM area event-request Request for adding an event labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event SCM GitHub request for SCM area
Projects
None yet
Development

No branches or pull requests

2 participants