Skip to content

Request to add parameters in the event OnBeforeCreateWhseActivHeader codeunit 7312 "Create Pick" #30292

Description

@Babul2910

Why do you need this change?

Add a parameters TempWhseActivLine: Record "Warehouse Activity Line" temporary as a var in the event OnBeforeCreateWhseActivHeader codeunit 7312 "Create Pick"

local procedure CreateWhseActivHeader(LocationCode: Code[10]; var FirstWhseDocNo: Code[20]; var LastWhseDocNo: Code[20]; var NoOfSourceDoc: Integer; var NoOfLines: Integer; var WhseDocCreated: Boolean)
    var
        IsHandled: Boolean;
    begin
        IsHandled := false;
	//Old ++
	OnBeforeCreateWhseActivHeader(CurrWarehouseActivityHeader, LocationCode, FirstWhseDocNo, LastWhseDocNo, NoOfSourceDoc, NoOfLines, WhseDocCreated, IsHandled);
	//Old --
	//New ++
        OnBeforeCreateWhseActivHeader(CurrWarehouseActivityHeader, TempWarehouseActivityLine, LocationCode, FirstWhseDocNo, LastWhseDocNo, NoOfSourceDoc, NoOfLines, WhseDocCreated, IsHandled);
	//New --
        if not IsHandled then begin
            CurrWarehouseActivityHeader.Init();
            CurrWarehouseActivityHeader."No." := '';
            if CreatePickParameters."Whse. Document Type" = CreatePickParameters."Whse. Document Type"::Movement then
                CurrWarehouseActivityHeader.Type := CurrWarehouseActivityHeader.Type::Movement
            else
                CurrWarehouseActivityHeader.Type := CurrWarehouseActivityHeader.Type::Pick;
            CurrWarehouseActivityHeader."Location Code" := LocationCode;
            if CreatePickParameters."Assigned ID" <> '' then
                CurrWarehouseActivityHeader.Validate("Assigned User ID", CreatePickParameters."Assigned ID");
            CurrWarehouseActivityHeader."Sorting Method" := CreatePickParameters."Sorting Method";
            CurrWarehouseActivityHeader."Breakbulk Filter" := CreatePickParameters."Breakbulk Filter";
            OnBeforeWhseActivHeaderInsert(CurrWarehouseActivityHeader, TempWarehouseActivityLine, CreatePickParameters, CurrWarehouseShipmentLine);
            CurrWarehouseActivityHeader.Insert(true);
            OnCreateWhseActivHeaderOnAfterWhseActivHeaderInsert(CurrWarehouseActivityHeader, TempWarehouseActivityLine, CreatePickParameters);
 
            NoOfLines := 1;
            NoOfSourceDoc := 1;
 
            if not WhseDocCreated then begin
                FirstWhseDocNo := CurrWarehouseActivityHeader."No.";
                WhseDocCreated := true;
            end;
            LastWhseDocNo := CurrWarehouseActivityHeader."No.";
        end;
    end;
 
    //Old ++
        [IntegrationEvent(false, false)]
    local procedure OnBeforeCreateWhseActivHeader(var CurrWarehouseActivityHeader: Record "Warehouse Activity Header"; LocationCode: Code[10]; var FirstWhseDocNo: Code[20]; var LastWhseDocNo: Code[20]; var NoOfSourceDoc: Integer; var NoOfLines: Integer; var WhseDocCreated: Boolean; var IsHandled: Boolean)
    begin
    end;
    //Old --
    //New ++
    [IntegrationEvent(false, false)]
    local procedure OnBeforeCreateWhseActivHeader(var CurrWarehouseActivityHeader: Record "Warehouse Activity Header"; var TempWhseActivLine: Record "Warehouse Activity Line" temporary; LocationCode: Code[10]; var FirstWhseDocNo: Code[20]; var LastWhseDocNo: Code[20]; var NoOfSourceDoc: Integer; var NoOfLines: Integer; var WhseDocCreated: Boolean; var IsHandled: Boolean)
    begin
    end;
    //New --

### Describe the request

To support the requirement of adding new items from an order to an existing warehouse pick for Sales Orders, Transfer Orders, and Purchase Return Orders, we need access to a temporary instance of the Warehouse Activity Line record during the pick creation process.
Currently, the OnBeforeCreateWhseActivHeader() event in Codeunit 7312 "Create Pick" does not provide a mechanism to pass or manipulate temporary warehouse activity lines. To enable this extensibility, we request enhancing the event signature by adding a var TempWhseActivLine: Record "Warehouse Activity Line" temporary parameter.
This will allow custom logic to prepare and manage additional lines before the warehouse activity header is created, ensuring seamless extension of the pick creation process while adhering to standard framework design.

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing-infoThe issue misses information that prevents it from completion.

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions