@AccessControl.authorizationCheck: #MANDATORY
@AccessControl.personalData.blocking: #('TRANSACTIONAL_DATA')
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.modelingPattern: #NONE
@ObjectModel.supportedCapabilities: [#CDS_MODELING_DATA_SOURCE, #SQL_DATA_SOURCE]
@ObjectModel.usageType: {serviceQuality: #A, sizeCategory: #XL, dataClass: #TRANSACTIONAL}
@VDM.lifecycle.contract.type: #PUBLIC_LOCAL_API
@VDM.viewType: #BASIC
@EndUserText.label: 'Documented Goods Movement of a Manufacturing Order'
/*+[hideWarning] { "IDS" : [ "CALCULATED_FIELD_CHECK" ] } */
define view entity I_MfgOrderDocdGoodsMovement
as select from I_OrderDocumentedGoodsMovement
association [1..1] to I_ManufacturingOrder as _MfgOrder on $projection.ManufacturingOrder = _MfgOrder.ManufacturingOrder
association [1..1] to I_MfgOrderCategory as _MfgOrderCategory on $projection.ManufacturingOrderCategory = _MfgOrderCategory.ManufacturingOrderCategory
association [1..1] to I_MfgOrderType as _MfgOrderType on $projection.ManufacturingOrderType = _MfgOrderType.ManufacturingOrderType
association [1..1] to I_Plant as _ProductionPlant on $projection.ProductionPlant = _ProductionPlant.Plant
-- start new associations for full coverage of text relations
association [1..1] to I_Plant as _ProductionPlantText on $projection.ProductionPlant = _ProductionPlantText.Plant
association [1..1] to I_Plant as _GoodsMovementPlantText on $projection.GoodsMovementPlant = _GoodsMovementPlantText.Plant
association [1..*] to I_ProductText as _MaterialText on $projection.Material = _MaterialText.Product
association [1..1] to I_ManufacturingOrder as _MfgOrderText on $projection.ManufacturingOrder = _MfgOrderText.ManufacturingOrder
association [0..1] to I_WBSElementBasicData as _WBSElementText on $projection.WBSElementInternalID = _WBSElementText.WBSElementInternalID
association [0..1] to I_StorageLocation as _StorageLocationText on $projection.ProductionPlant = _StorageLocationText.Plant
and $projection.StorageLocation = _StorageLocationText.StorageLocation
association [0..1] to I_Supplier as _SupplierText on $projection.Supplier = _SupplierText.Supplier
association [0..1] to I_ControllingArea as _ControllingAreaText on $projection.ControllingArea = _ControllingAreaText.ControllingArea
-- end new associations for full coverage of text relations
{
// Key
@ObjectModel.foreignKey.association: '_GoodsMovementHeader'
key GoodsMovement,
@ObjectModel.foreignKey.association: '_GoodsMovementYear'
key GoodsMovementYear,
@ObjectModel.foreignKey.association: '_GoodsMovementItem'
key GoodsMovementItem,
// Order data
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_MfgOrderStdVH', element: 'ManufacturingOrder' } } ]
@ObjectModel.foreignKey.association: '_MfgOrder'
cast(OrderID as manufacturingorder preserving type) as ManufacturingOrder,
@ObjectModel.foreignKey.association: '_MfgOrderCategory'
OrderCategory as ManufacturingOrderCategory,
@ObjectModel.foreignKey.association: '_MfgOrderType'
cast(OrderType as manufacturingordertype preserving type) as ManufacturingOrderType,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_PlantStdVH', element: 'Plant' } } ]
@ObjectModel.foreignKey.association: '_ProductionPlant'
cast(Plant as pwwrk preserving type) as ProductionPlant,
// Goods Movement data
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_ProductStdVH', element: 'Product' } } ]
@ObjectModel.foreignKey.association: '_Material'
@ObjectModel.text.association: '_MaterialText'
cast(Material as matnr preserving type) as Material,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_PlantStdVH', element: 'Plant' } } ]
@ObjectModel.foreignKey.association: '_GoodsMovementPlant'
cast(GoodsMovementPlant as werks_d preserving type) as GoodsMovementPlant,
@ObjectModel.foreignKey.association: '_Reservation'
cast(Reservation as rsnum preserving type) as Reservation,
@ObjectModel.foreignKey.association: '_ReservationItem'
ReservationItem,
@ObjectModel.foreignKey.association: '_ReservationRecordType'
ReservationRecordType,
ReservationIsFinallyIssued,
@ObjectModel.foreignKey.association: '_StorageLocation'
cast(StorageLocation as pph_lgort preserving type) as StorageLocation,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_BatchStdVH', element: 'Batch' } } ]
@ObjectModel.foreignKey.association: '_Batch'
cast(Batch as charg_d preserving type) as Batch,
@ObjectModel.foreignKey.association: '_InventoryValuationType'
cast(InventoryValuationType as pph_bwtar preserving type) as InventoryValuationType,
@ObjectModel.foreignKey.association: '_DebitCreditCode'
DebitCreditCode,
@ObjectModel.foreignKey.association: '_GoodsMovementType'
cast(GoodsMovementType as bwart preserving type) as GoodsMovementType,
@ObjectModel.foreignKey.association: '_GoodsMovementRefDocType'
GoodsMovementRefDocType,
@ObjectModel.foreignKey.association: '_InventorySpecialStockType'
cast(InventorySpecialStockType as pph_sobkz preserving type) as InventorySpecialStockType,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_SalesOrderStdVH', element: 'SalesOrder' } } ]
@ObjectModel.foreignKey.association: '_SalesOrder'
SalesOrder,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_SalesOrderItemStdVH', element: 'SalesOrderItem' } } ]
@ObjectModel.foreignKey.association: '_SalesOrderItem'
SalesOrderItem,
@ObjectModel.foreignKey.association: '_WBSElement'
WBSElementInternalID,
-- @ObjectModel.foreignKey.association: '_PurchaseOrder'
cast(PurchaseOrder as vdm_purchaseorder preserving type) as PurchaseOrder,
-- @ObjectModel.foreignKey.association: '_PurchaseOrderItem'
cast(PurchaseOrderItem as vdm_purchaseorderitem preserving type) as PurchaseOrderItem,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_Supplier_VH', element: 'Supplier' } } ]
@ObjectModel.foreignKey.association: '_Supplier'
cast(Supplier as lifnr preserving type) as Supplier,
@Semantics.text: true
GoodsRecipientName,
@Semantics.text: true
UnloadingPointName,
GoodsReceiptIsNonValuated,
GoodsReceiptIsCmpltlyDelivered,
// Assignments FI/CO
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_ControllingAreaStdVH', element: 'ControllingArea' } } ]
@ObjectModel.foreignKey.association: '_ControllingArea'
cast(ControllingArea as kokrs preserving type) as ControllingArea,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_GLAccountStdVH', element: 'GLAccount' } } ]
-- @ObjectModel.foreignKey.association: '_GLAccount'
cast(GLAccount as saknr preserving type) as GLAccount,
// Dates
@Semantics.businessDate.at: true
PostingDate,
@Semantics.businessDate.at: true
DocumentDate,
// Quantities and UoM
@ObjectModel.foreignKey.association: '_BaseUnit'
cast(BaseUnit as meins preserving type) as BaseUnit,
@Semantics.quantity.unitOfMeasure: 'BaseUnit'
@Aggregation.default: #SUM
QuantityInBaseUnit,
@ObjectModel.foreignKey.association: '_EntryUnit'
cast(EntryUnit as erfme preserving type) as EntryUnit,
@Semantics.quantity.unitOfMeasure: 'EntryUnit'
@Aggregation.default: #SUM
QuantityInEntryUnit,
// Amount and Currency
@ObjectModel.foreignKey.association: '_Currency'
cast(CompanyCodeCurrency as cccrcy preserving type) as CompanyCodeCurrency,
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
@Aggregation.default: #SUM
TotalGoodsMvtAmtInCCCrcy,
// Associations
_GoodsMovementYear,
_GoodsMovementHeader,
_GoodsMovementItem,
@ObjectModel.association.type: [#TO_COMPOSITION_ROOT, #TO_COMPOSITION_PARENT]
_MfgOrder,
_MfgOrderCategory,
_MfgOrderType,
_ProductionPlant,
_DocumentDate,
_PostingDate,
_Material,
_GoodsMovementPlant,
_Reservation,
_ReservationItem,
_ReservationRecordType,
_StorageLocation,
_Batch,
_BaseUnit,
_EntryUnit,
_GoodsMovementType,
_GoodsMovementRefDocType,
_InventorySpecialStockType,
_InventoryValuationType,
_DebitCreditCode,
_SalesOrder,
_SalesOrderItem,
_WBSElement,
_EnterpriseProjectElement,
_PurchaseOrder,
_PurchaseOrderItem,
_Supplier,
@Consumption.hidden: true
_SupplierCompanyByPlant,
_GLAccount,
_ControllingArea,
_Currency,
// Text relations
_MaterialText,
_GoodsMovementPlantText,
_ProductionPlantText,
_MfgOrderText,
_WBSElementText,
_StorageLocationText,
_SupplierText,
_ControllingAreaText
}
where ( OrderCategory = '10' or
OrderCategory = '40' ); //Manufacturing orders only