OnGetShipOrders_OnIncludeWarehouseShipmentHeader

Use this event to

Add filter conditions for Warehouse Activity Headers that cannot be solved by OnSetFilter-event.

Description

This event is triggered after filters have been applied to the Warehouse Shipment Header. The event should be used only when it is not possible to use OnSetFilter-event to solve if the Header should be included in the OrderList response.

The Warehouse Shipment Header can be excluded from the OrderList response by setting the parameter _IncludeInOrderList to false.

Learn about Basic vs. Complex filtering


Template

    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Ship", 'OnGetShipOrders_OnIncludeWarehouseShipmentHeader''', true, true)]
    local procedure OnGetShipOrders_OnIncludeWarehouseShipmentHeader(_WhseShipmentHeader: Record "Warehouse Shipment Header"; var _HeaderFilters: Record "MOB NS Request Element"; var _IncludeInOrderList: Boolean)
    begin
    end;


Example

    // [Example]: Do not include in order list if Customer is blocked.
    [EventSubscriber(ObjectType::CodeunitCodeunit::"MOB WMS Ship", 'OnGetShipOrders_OnIncludeWarehouseShipmentHeader''', true, true)]
    local procedure MyOnGetShipOrders_OnIncludeWarehouseShipmentHeader(_WhseShipmentHeader: Record "Warehouse Shipment Header"; var _HeaderFilters: Record "MOB NS Request Element"; var _IncludeInOrderList: Boolean)
    var
        WhseShipmentLine: Record "Warehouse Shipment Line";
        SalesHeader: Record "Sales Header";
        Customer: Record Customer;
    begin
        WhseShipmentLine.SetFilter("No.", _WhseShipmentHeader."No.");
        if WhseShipmentLine.FindSet() then
            repeat
                if WhseShipmentLine."Source Document" = WhseShipmentLine."Source Document"::"Sales Order" then begin
                    SalesHeader.Get(WhseShipmentLine."Source Subtype", WhseShipmentLine."Source No.");
                    // Exclude the Shipment if Customer is blocked
                    if Customer.Get(SalesHeader."Sell-to Customer No.") and (Customer.Blocked <> Customer.Blocked::" "then
                        _IncludeInOrderList := false;
                end;
            until (WhseShipmentLine.Next() 0) or not _IncludeInOrderList;
    end;


More examples


Version History

VersionChanges
MOB5.13Introduced