Skip to content

[W1][Codeunit][7312][Create Pick] Add integration event OnBeforeOnCreateTempLine in Procedure CreateTempLine #30061

@mavohra

Description

@mavohra

Why do you need this change?

We need to skip pick line creation entirely for specific items at the very start of CreateTempLine in Codeunit 7312 "Create Pick", before any quantities are reset or location data is loaded.

The standard procedure begins immediately with TotalQtyPickedBase := 0 and GetLocation(LocationCode), with no hook before this block. There is no way for an extension to evaluate item-level conditions and exit early without those side effects having already occurred.

No event exists before TotalQtyPickedBase := 0 in CreateTempLine that exposes ItemNo, LocationCode, and VariantCode together with an IsHandled flag to allow a subscriber to suppress the entire procedure.

Describe the request

Add an integration event OnBeforeOnCreateTempLine in CreateTempLine in Codeunit 7312 "Create Pick" before TotalQtyPickedBase is reset and before GetLocation is called, so that a subscriber can exit early and suppress pick line creation for a given item.

procedure CreateTempLine(LocationCode: Code[10]; ItemNo: Code[20]; VariantCode: Code[10]; UnitofMeasureCode: Code[10]; FromBinCode: Code[20]; ToBinCode: Code[20]; QtyPerUnitofMeasure: Decimal; QtyRoundingPrecision: Decimal; QtyRoundingPrecisionBase: Decimal; var TotalQtytoPick: Decimal; var TotalQtytoPickBase: Decimal)
var
    ...
    IsHandled: Boolean;
begin
    IsHandled := false;
    OnBeforeOnCreateTempLine(LocationCode, ItemNo, VariantCode, IsHandled); // <---- New Event
    if IsHandled then
        exit;

    TotalQtyPickedBase := 0;
    GetLocation(LocationCode);

    InitCalculationSummary(LocationCode, ItemNo, VariantCode, UnitofMeasureCode, FromBinCode, TotalQtytoPick, TotalQtytoPickBase);

    if CheckReservationAndUpdateQtyToPick(LocationCode, ItemNo, VariantCode, UnitofMeasureCode, FromBinCode, QtyPerUnitofMeasure, TotalQtytoPick, TotalQtytoPickBase) then begin
        FinalizeCalculationSummary();
        exit;
    end;

Event Signature:

[IntegrationEvent(false, false)]
local procedure OnCreateTempLineOnBeforeDoNotPickItem(LocationCode: Code[10]; ItemNo: Code[20]; VariantCode: Code[10]; var IsHandled: Boolean)
begin
end;

Alternatives evaluated: No event currently exists before TotalQtyPickedBase := 0 in the public CreateTempLine overload. OnCreateTempLineOnBeforeCheckReservation fires later inside CheckReservationAndUpdateQtyToPick after TotalQtyPickedBase has already been reset and GetLocation has already executed, making it too late to suppress the full procedure cleanly. No other event in CreateTempLine is positioned before the quantity reset and location load.
Internal work item: AB#636049

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an event

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions