CRM0106 Create Shipment Orders

Basic Information

Module CRM.Sales
Code CRM0106
Parent Document SalesOrder
Sub-document ShipmentOrder
Full Name Create Shipment orders
Status NEW
Deterministic/Non-deterministic Deterministic
Transitional Documents YES
Replace Generation Procedure GenerateShipmentOrderV2
Processing Orphan Rows Ignore
Introduced In Version
Date of Suspension -

Used Metrics

Metrics Base Measurement Unit Quantity For Fulfilment Fulfilling Quantity Records Comparison
Quantity SalesOrderLine.QuantityUnit SalesOrderLine.Quantity ShipmentOrderLine.Quantity ShipmentOrderLine.ParentDocument=SalesOrder; ShipmentOrderLine.ParentLineNo=SalesOrderLine.LineNo
QuantityBase SalesOrderLine.Product.BaseMeasurementUnit SalesOrderLine.QuantityBase ShipmentOrderLine.QuantityBase ShipmentOrderLine.ParentDocument=SalesOrder; ShipmentOrderLine.ParentLineNo=SalesOrderLine.LineNo

Business Logic

This Generation is used to create Shipment Orders for the products of the current Sales Order that are shipped (a product "Is Shipped" if it belongs to a Product Type in whose definition "Is Shipped = True") and which reflect a "normal" Sale (ie there are no return lines, for more information see Sales Order Row Types). For the rest of the products, no Shipment Orders are created, and the Store Orders and Shipment Orders are created directly from the Sales Order.

Before the sub-document is created, certain Validations of the data in the current Sales Order are performed.

Validations assure that the fields Lines Store, Required Delivery Date and Ship To Party Contact Mechanism have values in all lines for which the generation procedure is used. If any of fields SalesOrder.SalesOrderLine.LineStore or SalesOrder.SalesOrderLine.RequiredDeliveryDate or SalesOrder.SalesOrderLine.ShipToPartyContactMechanism is equal to "NULL" in any of those lines an error message is thrown:

> The field 'Line Store' in line number '{LineNo}' in document '{DocumentText}' must have a value.

or

> The field 'Required Delivery Date' in line number '{LineNo}' in document '{DocumentText}' must have a value.

or

> The field 'Ship To Party Contact Mechanism' in line number '{LineNo}' in document '{DocumentText}' must have a value.

Different lines in the Sales Order may have different Stores or Required Delivery Dates, and for different values in these fields - different Shipment Orders should be created. Therefore, at the beginning of the generation procedure, all combinations of Store and Required Delivery Date from the Sales Order Lines are determined (but only for the lines that are not used for returning goods according to the classification in topic Sales Order Row Types and whose products are shipped).

For each of these combinations of Store and Required Delivery Date, a separate Shipment Order is created. The Shipment Order’s header is created based on the Sales Order’s header as follows:

ShipmentOrder.Customer = SalesOrder.Customer

ShipmentOrder.ShipToPartyContactMechanism = SalesOrder.ShipToPartyContactMechanism

ShipmentOrder.RequiredDeliveryDate = RequiredDeliveryDate

ShipmentOrder.ShipFromStore = Store

ShipmentOrder.IssuedByPerson =

  if Store.ResponsibleParty is Person

​    then get person for Store.ResponsibleParty

​    else empty

The lines of the new document are created based on the data for the Fulfilled Part of quantities by Shipment Oders that are already created (for more information, see topic Discrepancy System). For example, for each SalesOrderLine of Sales Order for the current Store and Required Delivery Date combination, which is not a return line (see topic Sales Order Row Types), and in which the product Is Shipped, the unfulfilled quantities of ShipmentOrderRemainingQuantity and ShipmentOrderRemainingQuantityBase are determined. Thus, if at least one of the two values is different from 0, a new line of ShipmentOrderLine is created:

ShipmentOrderLine.LineNo = SalesOrderLine.LineNo

ShipmentOrderLine.ParentSalesOrderLine = SalesOrderLine

ShipmentOrderLine.Quantity = ShipmentOrderRemainingQuantity

ShipmentOrderLine.QuantityUnit = SalesOrderLine.QuantityUnit

ShipmentOrderLine.StoreBin = SalesOrderLine.StoreBin

ShipmentOrderLine.Lot = SalesOrderLine.Lot

ShipmentOrderLine.GuaranteePeriodDays = SalesOrderLine.GuaranteePeriodDays

ShipmentOrderLine.QuantityBase = ShipmentOrderRemainingQuantityBase

ShipmentOrderLine.PersistLot = SalesOrderLine.PersistLot

ShipmentOrderLine.SerialNumber = SalesOrderLine.SerialNumber

ShipmentOrderLine.Notes = SalesOrderLine.Notes

ShipmentOrderLine.ParentLineNo = SalesOrderLine.LineNo

Note

WARNING: Any of the Shipment Orders created according to the description above is saved then and only when there is at least one line in it.