Calculate aggregate number of packages (Shipment)

Event action – Abstract

Purpose: Populates the fields for 'Aggregate number of packages' across line item levels of all or selected line item types in a shipment and optionally (additionally) summarizes the 'Number of packages' of the direct line items as on the header level.


See also: Calculate aggregate number of packages, Calculate aggregate number of packages (Order)

images/download/attachments/177912585/image-2024-9-19_10-50-42-version-1-modificationdate-1726735841531-api-v2.png

The event action Calculate aggregate number of packages (Shipment) executes the following steps for all or selected Line item types (see Line item type) in a reference object of the 'Shipment' type (see Shipments):

  1. Within the line item hierarchy for each relevant Line item type, the field 'Number of packages' (numberOfPackages) is assigned the value 1 for each line item if it is empty or filled with 0.

  2. Within the line item hierarchy for each relevant Line item type, the field 'AggregateNumberOfPackages' (aggregateNumberOfPackages) is filled for each line item according to the procedure described in the section 'Calculation logic'.

  3. If the option Calculate summary is selected (default), then the total is additionally calculated via the field 'Number of packages' (numberOfPackages) in all direct line items for all relevant Line item types.

  4. This total number is assigned to the field 'Number of packages' (numberOfPackages) of the reference object.

NOTE◄ Details on the calculation logic and an informative runtime example can be found on the page for the entity type Common business object:

Configuration

images/download/attachments/177912585/image-2024-9-19_10-50-6-version-1-modificationdate-1726735805617-api-v2.png

The event action Calculate aggregate number of packages (Shipment) expects a shipment (see Shipments) as the reference object. In the context of another object type, the event action has no effect without an error occurring at runtime.

The Calculate summary option (set by default) controls whether the 'Number of packages' field in the reference object header data should be updated based on the information for Direct line items of the relevant Line item types.

Multiple selection for Line item types can be used to define a positive list for relevant Line item types (see Line item type).

  • If no Line item types are selected, all line items in the reference object are evaluated regardless of the Line item type.