CRM0708 Create Store Order for the used materials (only for covered by guarantee)

Basic Information

Module Applications.Service
Code CRM0708
Parent Document Service Activity
Sub-document Store Order
Full Name Create Store Order for the used materials (only for covered by guarantee)
Status NEW
Deterministic/Non-deterministic YES
Transitional Documents NO
Replace Generation Procedures GenerateStoreOrderCoveredByGuarantee
Processing Orphan Rows Ignore
Introduced In Version
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 the materials which are covered by guarantee (Covered By Guarantee = true) 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

Name 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
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) and where the material is covered by the guarantee (Covered By Guarantee = 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