@EndUserText.label: 'Goods Movement Extractor for RDP'
@AbapCatalog: {
sqlViewName: 'CRDPGDSMVTDDEX',
compiler.compareFilter: true
}
@AccessControl: {
authorizationCheck: #PRIVILEGED_ONLY,
personalData.blocking: #NOT_REQUIRED
}
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel: {
usageType: {
sizeCategory: #XXL,
serviceQuality: #D,
dataClass: #MIXED
},
sapObjectNodeType.name: 'MaterialDocument',
supportedCapabilities: [#EXTRACTION_DATA_SOURCE],
modelingPattern: #NONE
}
@VDM: {
viewType: #CONSUMPTION,
lifecycle.contract.type: #PUBLIC_LOCAL_API
}
@Analytics: {
dataCategory: #FACT,
internalName: #LOCAL,
dataExtraction: {
enabled: true,
delta.changeDataCapture:
{ mapping:
[
{ role: #MAIN, table: 'MATDOC', tableElement: ['key1', 'key2', 'key3', 'key4', 'key5', 'key6'], viewElement: ['MaterialDocumentKey1', 'MaterialDocumentKey2', 'MaterialDocumentKey3', 'MaterialDocumentKey4', 'MaterialDocumentKey5', 'MaterialDocumentKey6'] },
{ role: #LEFT_OUTER_TO_ONE_JOIN, table: 'lfa1', tableElement: ['lifnr'], viewElement: ['Supplier'] },
{ role: #LEFT_OUTER_TO_ONE_JOIN, table: 'kna1', tableElement: ['kunnr'], viewElement: ['Customer'] },
{ role: #LEFT_OUTER_TO_ONE_JOIN, table: 'mara', tableElement: ['matnr'], viewElement: ['Material'] },
{ role: #LEFT_OUTER_TO_ONE_JOIN, table: 'adrc', tableElement: ['addrnumber'], viewElement: ['PlantAddressID'] },
{ role: #LEFT_OUTER_TO_ONE_JOIN, table: 'adrc', tableElement: ['addrnumber'], viewElement: ['IssgOrRcvgPlantAddressID'] }
]
}
}
}
@Metadata: {
ignorePropagatedAnnotations: true
}
define view C_RDPGoodsMovementDocumentDEX
as select from I_MaterialDocumentRecord as MaterialDocumentRecord
association [0..1] to I_Plant as _Plant on $projection.Plant = _Plant.Plant
association [0..1] to I_Plant as _IssuingOrReceivingPlant on $projection.IssuingOrReceivingPlant = _IssuingOrReceivingPlant.Plant
association [0..1] to I_Supplier as _Supplier on $projection.Supplier = _Supplier.Supplier
association [0..1] to I_Customer as _Customer on $projection.Customer = _Customer.Customer
association [0..1] to I_Product as _Product on $projection.Material = _Product.Product
{
key MaterialDocumentRecord.MaterialDocumentKey1,
key MaterialDocumentRecord.MaterialDocumentKey2,
key MaterialDocumentRecord.MaterialDocumentKey3,
key MaterialDocumentRecord.MaterialDocumentKey4,
key MaterialDocumentRecord.MaterialDocumentKey5,
key MaterialDocumentRecord.MaterialDocumentKey6,
MaterialDocumentRecord.StockIdentifyingMaterial,
MaterialDocumentRecord.Plant,
MaterialDocumentRecord.InventorySpecialStockType,
MaterialDocumentRecord.CompanyCode,
@Semantics.unitOfMeasure: true
MaterialDocumentRecord.MaterialBaseUnit,
@Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
MaterialDocumentRecord.QuantityInBaseUnit,
@Semantics.quantity.unitOfMeasure: 'MaterialBaseUnit'
MaterialDocumentRecord.MatlStkChangeQtyInBaseUnit,
@Semantics.unitOfMeasure: true
MaterialDocumentRecord.EntryUnit,
@Semantics.quantity.unitOfMeasure: 'EntryUnit'
MaterialDocumentRecord.QuantityInEntryUnit,
@Semantics.businessDate.at: true
MaterialDocumentRecord.PostingDate,
MaterialDocumentRecord.CreationDate,
MaterialDocumentRecord.CreationTime,
@Semantics.calendar.quarter: true
MaterialDocumentRecord.CalendarQuarter,
@Semantics.calendar.month: true
MaterialDocumentRecord.CalendarMonth,
@Semantics.calendar.week: true
MaterialDocumentRecord.CalendarWeek,
@Semantics.calendar.dayOfYear: true
MaterialDocumentRecord.CalendarDay as CalendarDayOfYear, // The GFN used by the underlying basic view is wrong, and this would raise Prio 2 ATC issues on consumption-level due to a type-mismatch to the default data element
MaterialDocumentRecord.ManufactureDate,
MaterialDocumentRecord.MaterialDocument,
@Semantics.calendar.year: true
MaterialDocumentRecord.MaterialDocumentYear,
MaterialDocumentRecord.MaterialDocumentItem,
MaterialDocumentRecord.MaterialDocumentLine,
MaterialDocumentRecord.SalesOrder,
MaterialDocumentRecord.PurchaseOrder,
MaterialDocumentRecord.InvtryMgmtReferenceDocument,
MaterialDocumentRecord.ManufacturingOrder,
MaterialDocumentRecord.ReferenceDocument as AccountingDocExternalReference, // This is a FIN-specific field, and the GFN used by the underlying basic view does not reflect that. Hence changing the GFN to comply to the VDM, and avoid Prio 2 ATC issues.
MaterialDocumentRecord.DeliveryDocument,
MaterialDocumentRecord.GoodsMovementIsCancelled,
MaterialDocumentRecord.IsReversalMovementType,
MaterialDocumentRecord.GoodsMovementType,
MaterialDocumentRecord.Material,
MaterialDocumentRecord.Batch,
MaterialDocumentRecord.Supplier,
MaterialDocumentRecord.Customer,
MaterialDocumentRecord.GoodsRecipientName,
MaterialDocumentRecord.IssgOrRcvgMaterial,
MaterialDocumentRecord.IssgOrRcvgBatch,
MaterialDocumentRecord.GoodsMovementRefDocType,
MaterialDocumentRecord.IssuingOrReceivingPlant,
MaterialDocumentRecord.AccountingDocumentType,
MaterialDocumentRecord.InventoryTransactionType,
// Note: To be consistent with the extractors C_SustPlantAddressDEX, I_Supplier and I_Customer, the "Country" information are either retrieved via the
// associated Address (for Plant), or the direct field at the entity (for Supplier and Customer), even though both would be available for each entity.
@Analytics.hidden: true
_Plant.AddressID as PlantAddressID, // needed for CDC-based delta
@Analytics.hidden: true
_IssuingOrReceivingPlant.AddressID as IssgOrRcvgPlantAddressID, // needed for CDC-based delta
_Plant._Address.Country as PlantCountry,
_IssuingOrReceivingPlant._Address.Country as IssuingOrReceivingPlantCountry,
_Supplier.Country as SupplierCountry,
_Customer.Country as CustomerCountry,
_Product.ProductType as MaterialType,
_Product.ProductCategory as MaterialCategory,
// Calculated Fields
cast(case when MatlStkChangeQtyInBaseUnit > 0 and IsReversalMovementType = '' or MatlStkChangeQtyInBaseUnit < 0 and IsReversalMovementType = 'X'
then 'GR'
else case
when MatlStkChangeQtyInBaseUnit < 0 and IsReversalMovementType = '' or MatlStkChangeQtyInBaseUnit > 0 and IsReversalMovementType = 'X'
then 'GI'
else '' end
end as nsdm_stock_change_category preserving type) as StockChangeCategory,
cast(case when IssuingOrReceivingPlant <> '' and IssuingOrReceivingPlant <> Plant
then 'X'
else ''
end as nsdm_cross_plant_transfer preserving type) as IsCrossPlantTransfer,
case when _PurchaseOrderItem.IncotermsClassification <> '' then _PurchaseOrderItem.IncotermsClassification
else _PurchaseOrder.IncotermsClassification end as IncotermsClassification
}
// the following where-condition is a copy of I_GoodsMovementDocumentDEX (PO decision)
where
MaterialDocumentRecordType = 'MDOC'
or MaterialDocumentRecordType = 'MDOC_CP'
or MaterialDocumentRecordType = 'MDOC340'
or MaterialDocumentRecordType = 'CORR'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ADDRESS",
"I_CUSTOMER",
"I_MATERIALDOCUMENTRECORD",
"I_PLANT",
"I_PRODUCT",
"I_PURCHASEORDER",
"I_PURCHASEORDERITEM",
"I_SUPPLIER"
],
"ASSOCIATED":
[
"I_CUSTOMER",
"I_PLANT",
"I_PRODUCT",
"I_SUPPLIER"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/