CRM0707 Create Store order for the used materials

Basic Information

Module Applications.Service
Code CRM0707
Parent Document Service Activity
Sub-document Store Order
Full Name Create Store Order for the used materials
Status NEW
Deterministic/Non-deterministic YES
Transitional Documents NO
Replace Generation Procedures GenerateStoreOrder
Processing Orphan Rows Ignore
Introduced In Version 2022
Date of Suspension -

Business Logic

The generation procedure creates store orders from the store so the materials which are necessary for the service activity to be executed are issued. The procedure orders all materials listed in the service activity to be issued.

For each store from the service activity a new Store Order is created. Thus in the beginning the generation procedure groups the materials by store and for each store a new store order is created.

The store order header is based on the service activity header as follows:

StoreOrder.Store = Store
StoreOrder.MovementType = Issue
StoreOrder.DueDate = Today
StoreOrder.ReceivedByParty = ServiceActivity.ReceiverPerson.Party
StoreOrder.DocumentCurrency = ServiceActivity.EnterpriseCompany.BaseCurrency

Store is the store of the current group;

Note

The attributes which are not specified here are filled in as described in Standard Document Attributes

The new store order is saved then and only when there is at least one line in it.

Fulfillments

ServiceActivityMaterialToStoreOrderLine
Parent Entity ServiceActivityMaterial
Child Entity StoreOrderLine
Parent / Child Relationship StoreOrderLine.ParentDocument = ServiceActivityStoreOrderLine.ParentLineNo = ServiceActivityMaterial.LineNo

Metrics

Fulfillment Name Metric Name Measurement Unit Parent Value Child Value New Record
Fulfillment Name Metric Name Measurement Unit Parent Value Child Value New Record
ServiceActivityMaterialToStoreOrderLine MStandardQuantityBase ServiceActivityMaterial.Product.BaseMeasurementUnit ServiceActivityMaterial.StandardQuantityBase StoreOrderLine.StandardQuantityBase YES
ServiceActivityMaterialToStoreOrderLine MQuantity ServiceActivityMaterial.QuantityUnit ServiceActivityMaterial.Quantity StoreOrderLine.Quantity NO
ServiceActivityMaterialToStoreOrderLine MQuantityBase ServiceActivityMaterial.Product.BaseMeasurementUnit ServiceActivityMaterial.QuantityBase StoreOrderLine.QuantityBase NO

The Store order lines are created from the lines with materials in the service activity in which the product is stocked (Product.ProductType.IsStocked = true). For each material line the unfulfilled quantities are calculated - MQuantity, MQuanaityBase and MStandardQuantityBase. If StoreOrderRemainingStandardQuantityBase is not 0, then the current ServiceActivityMaterial creates new StoreOrderLine as follows:

StoreOrderLine.LineNo = ServiceActivityMaterial.LineNo

StoreOrderLine.ParentLineId = ServiceActivityMaterial.ServiceActivityMaterialId

StoreOrderLine.Product = ServiceActivityMaterial.Product

StoreOrderLine.Quantity = REMAINING(MQuantity)

StoreOrderLine.QuantityUnit = ServiceActivityMaterial.QuantityUnit

StoreOrderLine.QuantityBase = REMAINING(MQuantityBase)

StoreOrderLine.StandardQuantityBase = REMAINING(MStandardQuantityBase)

StoreOrderLine.ParentLineNo = ServiceActivityMaterial.LineNo

StoreOrderLine.SerialNumber = ServiceActivityMaterial.SerialNumber

StoreOrderLine.Lot = ServiceActivityMaterial.Lot