Skip to content

[Event Request] Report 5754 "Create Pick" - procedure CreateTempLine() #30379

Description

@SarkeSrb

Why do you need this change?

During warehouse pick creation, the standard implementation always prints pick documents individually because CreateTempLine() iterates through the generated warehouse activity headers using a repeat..until loop and invokes printing for each pick separately.

Our scenario requires group printing of all generated picks in a single report execution.

Alternatives evaluated

We evaluated subscribing to the existing OnBeforePrintPickList event. However, this event is raised inside the repeat..until loop after the pick headers have already been found.

Although the event allows replacing the actual print call, it does not allow bypassing the iteration itself. When multiple picks are created (FirstSetPickNo..LastPickNo), the subscriber is still invoked once for every pick header. Since the filters remain on the entire pick range, the request page is shown for every iteration while printing the same filtered set repeatedly.

No existing event provides an extensibility point before the pick headers are enumerated.

Justification for IsHandled

An IsHandled parameter is required because the extension needs to completely replace the standard printing flow.

A standard integration event would still continue executing the repeat..until loop and invoke the printing logic for every individual pick. The extension must be able to bypass this loop entirely and perform a single group print instead.

Performance considerations

The event is executed only once after the warehouse picks have been created and before the pick headers are retrieved.

The expected performance impact is negligible and may even improve performance by replacing multiple report executions with a single consolidated print.

Data sensitivity review

No additional sensitive data is exposed.

The event only exposes the existing Warehouse Activity Header record together with the current PrintPick flag that are already available within the standard process.

Multi-extension interaction

As with other IsHandled events, only one extension should replace the standard behavior.

If multiple extensions subscribe and set IsHandled := true, standard Business Central extensibility rules apply. In all cases, warehouse picks are still printed; the only difference is whether printing is performed individually (standard behavior) or as a consolidated group by the subscribing extension.


Describe the request

Please add an integration event immediately before the warehouse activity headers are retrieved.

This would allow extensions to intercept the process before the standard iteration over the pick headers begins and optionally replace the standard per-pick printing with a custom implementation such as group printing.

        ...

        CreatePick.ReturnTempItemTrkgLines(TempWhseItemTrkgLine);
        ItemTrackingMgt.UpdateWhseItemTrkgLines(TempWhseItemTrkgLine);
        Commit();
    end;

    PickWhseActivHeader.SetRange(Type, PickWhseActivHeader.Type::Pick);
    PickWhseActivHeader.SetRange("No.", FirstSetPickNo, LastPickNo);

    //>>> New
    IsHandled := false;
    OnBeforeFindPickHeader(PickWhseActivHeader, PrintPick, IsHandled);
    if IsHandled then
        exit;
    //<<< New

    PickWhseActivHeader.Find('-');

    repeat
        if SortActivity <> SortActivity::None then
            PickWhseActivHeader.SortWhseDoc();

        Commit();

        if PrintPick then begin
            PickListReportID := Report::"Picking List";
            OnBeforePrintPickList(PickWhseActivHeader, PickListReportID, IsHandled);

            if not IsHandled then
                WarehouseDocumentPrint.PrintPickHeader(PickWhseActivHeader);
        end;
    until PickWhseActivHeader.Next() = 0;
end;

//>>> New
[IntegrationEvent(false, false)]
local procedure OnBeforeFindPickHeader(
    var PickWhseActivHeader: Record "Warehouse Activity Header";
    var PrintPick: Boolean;
    var IsHandled: Boolean)
begin
end;
//<<< New

IsHandled bypass confirmation

The purpose of the proposed IsHandled event is to allow an extension to completely replace the standard printing flow starting before PickWhseActivHeader.Find('-') is executed.

The standard implementation always enumerates every generated warehouse pick and performs the print logic inside the repeat..until loop. For scenarios that require consolidated/group printing, this iteration itself must be bypassed. Replacing only the print call (using OnBeforePrintPickList) is not sufficient because the subscriber is still invoked once for every generated pick.

Therefore, when IsHandled := true, the entire standard Find -> repeat -> print flow is intentionally skipped.

Replacement behavior details

The extension assumes full responsibility for the skipped behavior.

The subscriber receives the already prepared PickWhseActivHeader record with the same filters that the standard code applies (Type = Pick and No. = FirstSetPickNo..LastPickNo).

The custom implementation will:

Use the provided filtered record to retrieve the complete set of generated warehouse picks.
Execute a single report run that prints all selected picks as one consolidated print job.
Respect the PrintPick flag and only perform printing when it is enabled.
Not modify warehouse pick creation, warehouse activity data, or any business logic executed before the event.
Not replace any warehouse processing other than the printing implementation.

The skipped standard code only performs enumeration of the generated pick headers and executes individual print operations. Since the extension performs the same functional outcome (printing the generated picks) in a single report execution, no business side effects are lost. The only behavioral difference is that multiple individual report executions are replaced by one consolidated print job.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions