Skip to content

[Event Request] Codeunit 5826 "Matched Order Line Mgmt." - procedure InsertPostedMatchedOrderLines #29971

@Mariangela-DeMaio-EOS

Description

@Mariangela-DeMaio-EOS

Why do you need this change?

Hi,
i need an event in the procedure "InsertPostedMatchedOrderLines" in the codeunit 5826 "Matched Order Line Mgmt.", before inserting the Record PostedMatchedOrderLine to modify custom fields.

Describe the request

Add a new event before inserting Record PostedMatchedOrderLine in the procedure "InsertPostedMatchedOrderLines" in the codeunit 5826 "Matched Order Line Mgmt.".

`

           internal procedure InsertPostedMatchedOrderLines(var PurchInvLine: Record "Purch. Inv. Line"; PurchaseLine: Record "Purchase Line")
var
    MatchedOrderLine, MatchedOrderLine2 : Record "Matched Order Line";
    PostedMatchedOrderLine: Record "Posted Matched Order Line";
begin
    if not PurchaseLine.IsMatchedToOrder() then
        exit;

    MatchedOrderLine.SetRange("Document Line SystemId", PurchaseLine.SystemId);
    if MatchedOrderLine.FindSet() then
        repeat
            Clear(PostedMatchedOrderLine);
            PostedMatchedOrderLine.TransferFields(MatchedOrderLine);
            PostedMatchedOrderLine."Document Line SystemId" := PurchInvLine.SystemId;
            if IsNullGuid(MatchedOrderLine."Matched Rcpt./Shpt. Line SysId") then begin
                MatchedOrderLine2.SetRange("Document Line SystemId", MatchedOrderLine."Document Line SystemId");
                MatchedOrderLine2.SetRange("Matched Order Line SystemId", MatchedOrderLine."Matched Order Line SystemId");
                MatchedOrderLine2.SetFilter("Matched Rcpt./Shpt. Line SysId", '<> %1', NullGuid);
                MatchedOrderLine2.CalcSums("Qty. to Invoice", "Qty. to Invoice (Base)");
                PostedMatchedOrderLine."Qty. Invoiced" := MatchedOrderLine2."Qty. to Invoice";
                PostedMatchedOrderLine."Qty. Invoiced (Base)" := MatchedOrderLine2."Qty. to Invoice (Base)";
            end;
            if PostedMatchedOrderLine."Qty. Invoiced" <> 0 then 
            begin
                        
                   // New Event
                     
                   OnBeforeInsertPostedMatchedOrderLine(PostedMatchedOrderLine, MatchedOrderLine, PurchInvLine, PurchaseLine);
               
                    PostedMatchedOrderLine.Insert();
            end;
               
        until MatchedOrderLine.Next() = 0;

    MatchedOrderLine.DeleteAll();
end;

`

`

        [IntegrationEvent(false, false)]
        local procedure OnBeforeInsertPostedMatchedOrderLine(var PostedMatchedOrderLine: Record "Posted Matched Order Line"; MatchedOrderLine: Record "Matched Order Line"; var PurchInvLine: Record "Purch. Inv. Line"; PurchaseLine: Record "Purchase Line")
       begin
       end;

`

Metadata

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