I_DeliveryDocItemAnalytics

DDL: I_DELIVERYDOCITEMANALYTICS SQL: ISDDELDOCITMANA Type: view COMPOSITE Package: VDM_SD_ANALYTICS

Delivery Document Item Analytics

I_DeliveryDocItemAnalytics is a Composite CDS View that provides data about "Delivery Document Item Analytics" in SAP S/4HANA. It reads from 2 data sources (I_DeliveryDocumentItem, I_SalesDocumentItem) and exposes 222 fields with key fields DeliveryDocument, DeliveryDocumentItem. It has 1 association to related views. Part of development package VDM_SD_ANALYTICS.

Data Sources (2)

SourceAliasJoin Type
I_DeliveryDocumentItem DDI from
I_SalesDocumentItem SDI inner

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_Currency _StatisticsCurrency $projection.StatisticsCurrency = _StatisticsCurrency.Currency

Annotations (9)

NameValueLevelField
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
EndUserText.label Delivery Document Item Analytics view
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #BLOCKED_DATA_EXCLUDED view
AbapCatalog.sqlViewName ISDDELDOCITMANA view

Fields (222)

KeyFieldSource TableSource FieldDescription
KEY DeliveryDocument I_DeliveryDocumentItem DeliveryDocument
KEY DeliveryDocumentItem I_DeliveryDocumentItem DeliveryDocumentItem
SDDocumentCategory I_DeliveryDocumentItem SDDocumentCategory
DeliveryDocumentItemCategory I_DeliveryDocumentItem DeliveryDocumentItemCategory
SalesDocumentItemType I_DeliveryDocumentItem SalesDocumentItemType
CreatedByUser I_DeliveryDocumentItem CreatedByUser
CreationDate I_DeliveryDocumentItem CreationDate
CreationTime I_DeliveryDocumentItem CreationTime
LastChangeDate I_DeliveryDocumentItem LastChangeDate
SalesOrganization
DistributionChannel I_DeliveryDocumentItem DistributionChannel
Division I_DeliveryDocumentItem Division
SalesGroup I_DeliveryDocumentItem SalesGroup
SalesOffice I_DeliveryDocumentItem SalesOffice
DepartmentClassificationByCust I_DeliveryDocumentItem DepartmentClassificationByCust
Material I_DeliveryDocumentItem Material
Product I_DeliveryDocumentItem Product
MaterialByCustomer I_DeliveryDocumentItem MaterialByCustomer
OriginallyRequestedMaterial I_DeliveryDocumentItem OriginallyRequestedMaterial
InternationalArticleNumber I_DeliveryDocumentItem InternationalArticleNumber
Batch I_DeliveryDocumentItem Batch
BatchClassification I_DeliveryDocumentItem BatchClassification
BatchBySupplier I_DeliveryDocumentItem BatchBySupplier
MaterialIsIntBatchManaged I_DeliveryDocumentItem MaterialIsIntBatchManaged
MaterialIsBatchManaged I_DeliveryDocumentItem MaterialIsBatchManaged
MaterialGroup I_DeliveryDocumentItem MaterialGroup
ProductGroup I_DeliveryDocumentItem ProductGroup
MaterialFreightGroup I_DeliveryDocumentItem MaterialFreightGroup
AdditionalMaterialGroup1 I_DeliveryDocumentItem AdditionalMaterialGroup1
AdditionalMaterialGroup2 I_DeliveryDocumentItem AdditionalMaterialGroup2
AdditionalMaterialGroup3 I_DeliveryDocumentItem AdditionalMaterialGroup3
AdditionalMaterialGroup4 I_DeliveryDocumentItem AdditionalMaterialGroup4
AdditionalMaterialGroup5 I_DeliveryDocumentItem AdditionalMaterialGroup5
Plant I_DeliveryDocumentItem Plant
PlantName
StorageLocation I_DeliveryDocumentItem StorageLocation
StorageLocationName
Warehouse I_DeliveryDocumentItem Warehouse
StorageBin I_DeliveryDocumentItem StorageBin
StorageType I_DeliveryDocumentItem StorageType
InventorySpecialStockType I_DeliveryDocumentItem InventorySpecialStockType
ShelfLifeExpirationDate I_DeliveryDocumentItem ShelfLifeExpirationDate
NumberOfSerialNumbers I_DeliveryDocumentItem NumberOfSerialNumbers
ProductConfiguration I_DeliveryDocumentItem ProductConfiguration
ProductHierarchyNode I_DeliveryDocumentItem ProductHierarchyNode
ManufactureDate I_DeliveryDocumentItem ManufactureDate
DeliveryDocumentItemText I_DeliveryDocumentItem DeliveryDocumentItemText
HigherLevelItem I_DeliveryDocumentItem HigherLevelItem
ActualDeliveryQuantity I_DeliveryDocumentItem ActualDeliveryQuantity
QuantityIsFixed I_DeliveryDocumentItem QuantityIsFixed
OriginalDeliveryQuantity I_DeliveryDocumentItem OriginalDeliveryQuantity
DeliveryQuantityUnit I_DeliveryDocumentItem DeliveryQuantityUnit
ActualDeliveredQtyInBaseUnit I_DeliveryDocumentItem ActualDeliveredQtyInBaseUnit
DeliveryToBaseQuantityDnmntr I_DeliveryDocumentItem DeliveryToBaseQuantityDnmntr
DeliveryToBaseQuantityNmrtr I_DeliveryDocumentItem DeliveryToBaseQuantityNmrtr
ProductAvailabilityDate I_DeliveryDocumentItem ProductAvailabilityDate
ProductAvailabilityTime I_DeliveryDocumentItem ProductAvailabilityTime
DeliveryGroup I_DeliveryDocumentItem DeliveryGroup
ItemGrossWeight I_DeliveryDocumentItem ItemGrossWeight
ItemNetWeight I_DeliveryDocumentItem ItemNetWeight
ItemWeightUnit I_DeliveryDocumentItem ItemWeightUnit
ItemVolume I_DeliveryDocumentItem ItemVolume
ItemVolumeUnit I_DeliveryDocumentItem ItemVolumeUnit
InspectionLot I_DeliveryDocumentItem InspectionLot
InspectionPartialLot I_DeliveryDocumentItem InspectionPartialLot
PartialDeliveryIsAllowed I_DeliveryDocumentItem PartialDeliveryIsAllowed
UnlimitedOverdeliveryIsAllowed I_DeliveryDocumentItem UnlimitedOverdeliveryIsAllowed
OverdelivTolrtdLmtRatioInPct I_DeliveryDocumentItem OverdelivTolrtdLmtRatioInPct
UnderdelivTolrtdLmtRatioInPct I_DeliveryDocumentItem UnderdelivTolrtdLmtRatioInPct
WarehouseStorageBin I_DeliveryDocumentItem WarehouseStorageBin
BOMExplosion I_DeliveryDocumentItem BOMExplosion
CustEngineeringChgStatus I_DeliveryDocumentItem CustEngineeringChgStatus
WarehouseStagingArea I_DeliveryDocumentItem WarehouseStagingArea
WarehouseStockCategory I_DeliveryDocumentItem WarehouseStockCategory
IssgOrRcvgStockCategory I_DeliveryDocumentItem IssgOrRcvgStockCategory
IssgOrRcvgMaterial I_DeliveryDocumentItem IssgOrRcvgMaterial
IssuingOrReceivingPlant I_DeliveryDocumentItem IssuingOrReceivingPlant
IssuingOrReceivingStorageLoc I_DeliveryDocumentItem IssuingOrReceivingStorageLoc
IssgOrRcvgBatch I_DeliveryDocumentItem IssgOrRcvgBatch
IssgOrRcvgValuationType I_DeliveryDocumentItem IssgOrRcvgValuationType
IssgOrRcvgSpclStockInd I_DeliveryDocumentItem IssgOrRcvgSpclStockInd
PrimaryPostingSwitch I_DeliveryDocumentItem PrimaryPostingSwitch
StockType I_DeliveryDocumentItem StockType
IsNotGoodsMovementsRelevant I_DeliveryDocumentItem IsNotGoodsMovementsRelevant
GLAccount I_DeliveryDocumentItem GLAccount
GoodsMovementReasonCode I_DeliveryDocumentItem GoodsMovementReasonCode
SubsequentMovementType I_DeliveryDocumentItem SubsequentMovementType
IsCompletelyDelivered I_DeliveryDocumentItem IsCompletelyDelivered
AlternateProductNumber I_DeliveryDocumentItem AlternateProductNumber
PickingControl I_DeliveryDocumentItem PickingControl
LoadingGroup I_DeliveryDocumentItem LoadingGroup
GoodsMovementType I_DeliveryDocumentItem GoodsMovementType
TransportationGroup I_DeliveryDocumentItem TransportationGroup
ReceivingPoint I_DeliveryDocumentItem ReceivingPoint
FixedShipgProcgDurationInDays I_DeliveryDocumentItem FixedShipgProcgDurationInDays
VarblShipgProcgDurationInDays I_DeliveryDocumentItem VarblShipgProcgDurationInDays
ProofOfDeliveryRelevanceCode I_DeliveryDocumentItem ProofOfDeliveryRelevanceCode
ItemIsBillingRelevant I_DeliveryDocumentItem ItemIsBillingRelevant
ItemBillingBlockReason I_DeliveryDocumentItem ItemBillingBlockReason
PaymentGuaranteeForm I_DeliveryDocumentItem PaymentGuaranteeForm
IntercompanyBillingStatus I_DeliveryDocumentItem IntercompanyBillingStatus
BusinessArea I_DeliveryDocumentItem BusinessArea
ControllingArea I_DeliveryDocumentItem ControllingArea
ProfitabilitySegment I_DeliveryDocumentItem ProfitabilitySegment_2
ProfitCenter I_DeliveryDocumentItem ProfitCenter
InventoryValuationType
IsSeparateValuation I_DeliveryDocumentItem IsSeparateValuation
ConsumptionPosting I_DeliveryDocumentItem ConsumptionPosting
OrderID I_DeliveryDocumentItem OrderID
OrderItem I_DeliveryDocumentItem OrderItem
CostCenter I_DeliveryDocumentItem CostCenter
ReferenceSDDocument I_DeliveryDocumentItem ReferenceSDDocument
ReferenceSDDocumentItem I_DeliveryDocumentItem ReferenceSDDocumentItem
ReferenceSDDocumentCategory I_DeliveryDocumentItem ReferenceSDDocumentCategory
ReferenceDocumentLogicalSystem I_DeliveryDocumentItem ReferenceDocumentLogicalSystem
AdditionalCustomerGroup1 I_DeliveryDocumentItem AdditionalCustomerGroup1
AdditionalCustomerGroup2 I_DeliveryDocumentItem AdditionalCustomerGroup2
AdditionalCustomerGroup3 I_DeliveryDocumentItem AdditionalCustomerGroup3
AdditionalCustomerGroup4 I_DeliveryDocumentItem AdditionalCustomerGroup4
AdditionalCustomerGroup5 I_DeliveryDocumentItem AdditionalCustomerGroup5
RetailPromotion I_DeliveryDocumentItem RetailPromotion
StatisticsDate I_DeliveryDocumentItem StatisticsDate
SDProcessStatus I_DeliveryDocumentItem SDProcessStatus
PickingConfirmationStatus I_DeliveryDocumentItem PickingConfirmationStatus
PickingStatus I_DeliveryDocumentItem PickingStatus
WarehouseActivityStatus I_DeliveryDocumentItem WarehouseActivityStatus
PackingStatus I_DeliveryDocumentItem PackingStatus
GoodsMovementStatus I_DeliveryDocumentItem GoodsMovementStatus
DeliveryRelatedBillingStatus I_DeliveryDocumentItem DeliveryRelatedBillingStatus
ProofOfDeliveryStatus I_DeliveryDocumentItem ProofOfDeliveryStatus
ItemGeneralIncompletionStatus I_DeliveryDocumentItem ItemGeneralIncompletionStatus
ItemDeliveryIncompletionStatus I_DeliveryDocumentItem ItemDeliveryIncompletionStatus
ItemPickingIncompletionStatus I_DeliveryDocumentItem ItemPickingIncompletionStatus
ItemGdsMvtIncompletionSts I_DeliveryDocumentItem ItemGdsMvtIncompletionSts
ItemPackingIncompletionStatus I_DeliveryDocumentItem ItemPackingIncompletionStatus
ItemBillingIncompletionStatus I_DeliveryDocumentItem ItemBillingIncompletionStatus
SoldToParty
SoldToPartyName
CustomerGroup
SoldToPartyClassification
SalesDistrict
ShippingPoint
BillingDocumentDate
TransactionCurrency I_SalesDocumentItem TransactionCurrency
StatisticsCurrency
BaseUnit
_DeliveryDocument I_DeliveryDocumentItem _DeliveryDocument
_Partner I_DeliveryDocumentItem _Partner
_SDDocumentCategory I_DeliveryDocumentItem _SDDocumentCategory
_ItemCategory I_DeliveryDocumentItem _ItemCategory
_SalesDocumentItemType I_DeliveryDocumentItem _SalesDocumentItemType
_CreatedByUser I_DeliveryDocumentItem _CreatedByUser
_DistributionChannel I_DeliveryDocumentItem _DistributionChannel
_Division I_DeliveryDocumentItem _Division
_SalesGroup I_DeliveryDocumentItem _SalesGroup
_SalesOffice I_DeliveryDocumentItem _SalesOffice
_Material I_DeliveryDocumentItem _Material
_Product I_DeliveryDocumentItem _Product
_OriginallyRequestedMaterial I_DeliveryDocumentItem _OriginallyRequestedMaterial
_ProductHierarchyNode I_DeliveryDocumentItem _ProductHierarchyNode
_MaterialGroup I_DeliveryDocumentItem _MaterialGroup
_ProductGroup I_DeliveryDocumentItem _ProductGroup
_MaterialFreightGroup I_DeliveryDocumentItem _MaterialFreightGroup
_AdditionalMaterialGroup1 I_DeliveryDocumentItem _AdditionalMaterialGroup1
_AdditionalMaterialGroup2 I_DeliveryDocumentItem _AdditionalMaterialGroup2
_AdditionalMaterialGroup3 I_DeliveryDocumentItem _AdditionalMaterialGroup3
_AdditionalMaterialGroup4 I_DeliveryDocumentItem _AdditionalMaterialGroup4
_AdditionalMaterialGroup5 I_DeliveryDocumentItem _AdditionalMaterialGroup5
_Plant I_DeliveryDocumentItem _Plant
_Warehouse I_DeliveryDocumentItem _Warehouse
_StorageLocation I_DeliveryDocumentItem _StorageLocation
_InventorySpecialStockType I_DeliveryDocumentItem _InventorySpecialStockType
_DeliveryQuantityUnit I_DeliveryDocumentItem _DeliveryQuantityUnit
_BaseUnit I_DeliveryDocumentItem _BaseUnit
_ItemWeightUnit I_DeliveryDocumentItem _ItemWeightUnit
_ItemVolumeUnit I_DeliveryDocumentItem _ItemVolumeUnit
_BOMExplosion I_DeliveryDocumentItem _BOMExplosion
_WarehouseStagingArea I_DeliveryDocumentItem _WarehouseStagingArea
_PickingControl I_DeliveryDocumentItem _PickingControl
_LoadingGroup I_DeliveryDocumentItem _LoadingGroup
_GoodsMovementType I_DeliveryDocumentItem _GoodsMovementType
_TransportationGroup I_DeliveryDocumentItem _TransportationGroup
_ItemIsBillingRelevant I_DeliveryDocumentItem _ItemIsBillingRelevant
_ItemBillingBlockReason I_DeliveryDocumentItem _ItemBillingBlockReason
_PaymentGuaranteeForm I_DeliveryDocumentItem _PaymentGuaranteeForm
_BusinessArea I_DeliveryDocumentItem _BusinessArea
_ControllingArea I_DeliveryDocumentItem _ControllingArea
_ProfitCenter I_DeliveryDocumentItem _ProfitCenter
_InventoryValuationType I_DeliveryDocumentItem _InventoryValuationType
_OrderID I_DeliveryDocumentItem _OrderID
_CostCenter I_DeliveryDocumentItem _CostCenter
_ReferenceSDDocument I_DeliveryDocumentItem _ReferenceSDDocument
_ReferenceSalesDocumentItem I_DeliveryDocumentItem _ReferenceSalesDocumentItem
_ReferenceSDDocumentCategory I_DeliveryDocumentItem _ReferenceSDDocumentCategory
_LogicalSystem I_DeliveryDocumentItem _LogicalSystem
_AdditionalCustomerGroup1 I_DeliveryDocumentItem _AdditionalCustomerGroup1
_AdditionalCustomerGroup2 I_DeliveryDocumentItem _AdditionalCustomerGroup2
_AdditionalCustomerGroup3 I_DeliveryDocumentItem _AdditionalCustomerGroup3
_AdditionalCustomerGroup4 I_DeliveryDocumentItem _AdditionalCustomerGroup4
_AdditionalCustomerGroup5 I_DeliveryDocumentItem _AdditionalCustomerGroup5
_SDProcessStatus I_DeliveryDocumentItem _SDProcessStatus
_PickingConfirmationStatus I_DeliveryDocumentItem _PickingConfirmationStatus
_PickingStatus I_DeliveryDocumentItem _PickingStatus
_WarehouseActivityStatus I_DeliveryDocumentItem _WarehouseActivityStatus
_PackingStatus I_DeliveryDocumentItem _PackingStatus
_GoodsMovementStatus I_DeliveryDocumentItem _GoodsMovementStatus
_DeliveryRelatedBillingStatus I_DeliveryDocumentItem _DeliveryRelatedBillingStatus
_ProofOfDeliveryStatus I_DeliveryDocumentItem _ProofOfDeliveryStatus
_ItemGeneralIncompletionStatus I_DeliveryDocumentItem _ItemGeneralIncompletionStatus
_ItemDelivIncompletionSts I_DeliveryDocumentItem _ItemDelivIncompletionSts
_ItemPickingIncompletionStatus I_DeliveryDocumentItem _ItemPickingIncompletionStatus
_ItemGdsMvtIncompletionSts I_DeliveryDocumentItem _ItemGdsMvtIncompletionSts
_ItemPackingIncompletionStatus I_DeliveryDocumentItem _ItemPackingIncompletionStatus
_ItemBillingIncompletionStatus I_DeliveryDocumentItem _ItemBillingIncompletionStatus
_SalesOrganization
_CustomerGroup
_SalesDistrict
_ShippingPoint
_SoldToParty
_CustomerClassification
_StatisticsCurrency _StatisticsCurrency
_TransactionCurrency I_SalesDocumentItem _TransactionCurrency
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL
@EndUserText.label: 'Delivery Document Item Analytics'    
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck:#CHECK
@AccessControl.privilegedAssociations: [ '_CreatedByUser', '_Partner' ]
@AccessControl.personalData.blocking: #BLOCKED_DATA_EXCLUDED
@AbapCatalog.sqlViewName: 'ISDDELDOCITMANA'

define view I_DeliveryDocItemAnalytics   
  
as select from  I_DeliveryDocumentItem as DDI   
inner join I_SalesDocumentItem as SDI on DDI.ReferenceSDDocument = SDI.SalesDocument 
                                     and DDI.ReferenceSDDocumentItem = SDI.SalesDocumentItem

--AT 21.09.2018 Incident 484039 Batch Handling: 
-- by this l.o. join to a given lips a potential SUPERordenated lips is joined. Later in KPI calculation: 
--                                                                           info of this SUBordenated lips is only considered, if the 
--                                                                           SUBordenated is billing relevant,but not the SUPERordenated !
--                                                                           (--> DDI_SUPER.DeliveryRelatedBillingStatus = A,B)
left outer to one join I_DeliveryDocumentItem as DDI_SUPER on DDI.HigherLvlItmOfBatSpltItm is not initial
                                                    and DDI_SUPER.DeliveryDocument = DDI.DeliveryDocument
                                                    and DDI.HigherLvlItmOfBatSpltItm = DDI_SUPER.DeliveryDocumentItem 

association [0..1] to I_Currency  as _StatisticsCurrency on  $projection.StatisticsCurrency = _StatisticsCurrency.Currency
{
// Key

  @ObjectModel.foreignKey.association: '_DeliveryDocument'
  key DDI.DeliveryDocument,
  key DDI.DeliveryDocumentItem,

//Dimensions 


  //category 

  @ObjectModel.foreignKey.association: '_SDDocumentCategory'
  DDI.SDDocumentCategory,  
  @ObjectModel.foreignKey.association: '_ItemCategory'
  DDI.DeliveryDocumentItemCategory,
  @ObjectModel.foreignKey.association: '_SalesDocumentItemType'
  DDI.SalesDocumentItemType,

  //Admin

  DDI.CreatedByUser,
  @Semantics.systemDate.createdAt: true
  DDI.CreationDate,
  DDI.CreationTime,
  @Semantics.systemDate.lastChangedAt: true
  DDI.LastChangeDate,
    
  //Organization  (Team View,..)

  @ObjectModel.foreignKey.association: '_SalesOrganization'
  DDI._DeliveryDocument.SalesOrganization,
  @ObjectModel.foreignKey.association: '_DistributionChannel'
  DDI.DistributionChannel,
  @ObjectModel.foreignKey.association: '_Division'
  DDI.Division,
  @ObjectModel.foreignKey.association: '_SalesGroup'
  DDI.SalesGroup,
  @ObjectModel.foreignKey.association: '_SalesOffice'
  DDI.SalesOffice,
  DDI.DepartmentClassificationByCust,
                
  //Product       --AT*2 17.2.2020 add Product

  @ObjectModel.foreignKey.association: '_Material'
  @VDM.lifecycle.status: #DEPRECATED
  @VDM.lifecycle.successor: 'Product'
  DDI.Material,
  @Analytics.internalName: #LOCAL
  @ObjectModel.foreignKey.association: '_Product'
  @VDM.lifecycle: { status: #DEPRECATED, successor: '_Product' } 
  DDI.Product,
  
  DDI.MaterialByCustomer,
  @ObjectModel.foreignKey.association: '_OriginallyRequestedMaterial'
  DDI.OriginallyRequestedMaterial,
  DDI.InternationalArticleNumber,
  DDI.Batch,
  DDI.BatchClassification,
  DDI.BatchBySupplier,
  DDI.MaterialIsIntBatchManaged,
  DDI.MaterialIsBatchManaged,
  @ObjectModel.foreignKey.association: '_MaterialGroup'
  DDI.MaterialGroup,
  @Analytics.internalName: #LOCAL
  @ObjectModel.foreignKey.association: '_ProductGroup'
  DDI.ProductGroup,  
  
  @ObjectModel.foreignKey.association: '_MaterialFreightGroup'
  DDI.MaterialFreightGroup,
  @ObjectModel.foreignKey.association: '_AdditionalMaterialGroup1'
  DDI.AdditionalMaterialGroup1,
  @ObjectModel.foreignKey.association: '_AdditionalMaterialGroup2'
  DDI.AdditionalMaterialGroup2,
  @ObjectModel.foreignKey.association: '_AdditionalMaterialGroup3'
  DDI.AdditionalMaterialGroup3,
  @ObjectModel.foreignKey.association: '_AdditionalMaterialGroup4'
  DDI.AdditionalMaterialGroup4,
  @ObjectModel.foreignKey.association: '_AdditionalMaterialGroup5'
  DDI.AdditionalMaterialGroup5,
  @ObjectModel.foreignKey.association: '_Plant'
  DDI.Plant,
  DDI._Plant.PlantName,
  @ObjectModel.foreignKey.association: '_StorageLocation'
  DDI.StorageLocation,
  DDI._StorageLocation.StorageLocationName,
  @ObjectModel.foreignKey.association: '_Warehouse'
  DDI.Warehouse,
  DDI.StorageBin,
  DDI.StorageType,
  @ObjectModel.foreignKey.association: '_InventorySpecialStockType'
  DDI.InventorySpecialStockType,
  DDI.ShelfLifeExpirationDate,
  DDI.NumberOfSerialNumbers,
  DDI.ProductConfiguration,
  DDI.ProductHierarchyNode,
  DDI.ManufactureDate,
  
  //delivery 

  DDI.DeliveryDocumentItemText,
  DDI.HigherLevelItem,
  @DefaultAggregation: #SUM
  @Semantics.quantity.unitOfMeasure: 'DeliveryQuantityUnit'
  DDI.ActualDeliveryQuantity,
  DDI.QuantityIsFixed,
  @DefaultAggregation: #SUM
  @Semantics.quantity.unitOfMeasure: 'DeliveryQuantityUnit'
  DDI.OriginalDeliveryQuantity,
  @Semantics.unitOfMeasure: true
  @ObjectModel.foreignKey.association: '_DeliveryQuantityUnit'
  DDI.DeliveryQuantityUnit,
  @DefaultAggregation: #SUM
  @Semantics.quantity.unitOfMeasure: 'BaseUnit'
  DDI.ActualDeliveredQtyInBaseUnit,       
//   @Semantics.unitOfMeasure: true                             //See Below in //Measures

//   @ObjectModel.foreignKey.association: '_BaseUnit'

//   DDI.BaseUnit,

  DDI.DeliveryToBaseQuantityDnmntr,
  DDI.DeliveryToBaseQuantityNmrtr, 
  DDI.ProductAvailabilityDate,
  DDI.ProductAvailabilityTime,
  DDI.DeliveryGroup,
  @DefaultAggregation: #SUM
  @Semantics.quantity.unitOfMeasure: 'ItemWeightUnit'
  DDI.ItemGrossWeight,
  @DefaultAggregation: #SUM
  @Semantics.quantity.unitOfMeasure: 'ItemWeightUnit'
  DDI.ItemNetWeight,
  @Semantics.unitOfMeasure: true
  @ObjectModel.foreignKey.association: '_ItemWeightUnit'
  DDI.ItemWeightUnit,
  @DefaultAggregation: #SUM
  @Semantics.quantity.unitOfMeasure: 'ItemVolumeUnit'
  DDI.ItemVolume,
  @Semantics.unitOfMeasure: true
  @ObjectModel.foreignKey.association: '_ItemVolumeUnit'
  DDI.ItemVolumeUnit,
  DDI.InspectionLot,
  DDI.InspectionPartialLot,
  DDI.PartialDeliveryIsAllowed,
  DDI.UnlimitedOverdeliveryIsAllowed,
  DDI.OverdelivTolrtdLmtRatioInPct,
  DDI.UnderdelivTolrtdLmtRatioInPct,
  DDI.WarehouseStorageBin,
  @ObjectModel.foreignKey.association: '_BOMExplosion'
  DDI.BOMExplosion,
  DDI.CustEngineeringChgStatus,
  @ObjectModel.foreignKey.association: '_WarehouseStagingArea'
  DDI.WarehouseStagingArea,
  DDI.WarehouseStockCategory,
  DDI.IssgOrRcvgStockCategory,
  DDI.IssgOrRcvgMaterial,
  DDI.IssuingOrReceivingPlant,
  DDI.IssuingOrReceivingStorageLoc,
  DDI.IssgOrRcvgBatch,
  DDI.IssgOrRcvgValuationType,
  DDI.IssgOrRcvgSpclStockInd,
  DDI.PrimaryPostingSwitch,
  DDI.StockType,
  DDI.IsNotGoodsMovementsRelevant,
  DDI.GLAccount,
  DDI.GoodsMovementReasonCode,
  DDI.SubsequentMovementType,
  DDI.IsCompletelyDelivered,
  DDI.AlternateProductNumber,
  
  //pick pack load 

  @ObjectModel.foreignKey.association: '_PickingControl'
  DDI.PickingControl,
  @ObjectModel.foreignKey.association: '_LoadingGroup'
  DDI.LoadingGroup,
  @ObjectModel.foreignKey.association: '_GoodsMovementType'
  DDI.GoodsMovementType, 
  
  //shipping 

  @ObjectModel.foreignKey.association: '_TransportationGroup'
  DDI.TransportationGroup,
  DDI.ReceivingPoint,
  DDI.FixedShipgProcgDurationInDays,
  DDI.VarblShipgProcgDurationInDays,
  DDI.ProofOfDeliveryRelevanceCode,
  
  //billing 

  @ObjectModel.foreignKey.association: '_ItemIsBillingRelevant'
  DDI.ItemIsBillingRelevant,
  @ObjectModel.foreignKey.association: '_ItemBillingBlockReason'
  DDI.ItemBillingBlockReason,
  @ObjectModel.foreignKey.association: '_PaymentGuaranteeForm'
  DDI.PaymentGuaranteeForm,
  DDI.IntercompanyBillingStatus,
  
  //accounting

  @ObjectModel.foreignKey.association: '_BusinessArea'
  DDI.BusinessArea,
  @ObjectModel.foreignKey.association: '_ControllingArea'
  DDI.ControllingArea,  
  DDI.ProfitabilitySegment_2 as ProfitabilitySegment,
  DDI.ProfitCenter,
  --@ObjectModel.foreignKey.association: '_InventoryValuationType' -- AT 24.8.16 commented due to false positive ATC check POC_ANNOTA, OMFK
  DDI.InventoryValuationType,
  DDI.IsSeparateValuation,
  DDI.ConsumptionPosting,
  @ObjectModel.foreignKey.association: '_OrderID'
  DDI.OrderID,
  DDI.OrderItem,
  DDI.CostCenter,
  
  //reference 

  @ObjectModel.foreignKey.association: '_ReferenceSDDocument'
  DDI.ReferenceSDDocument,
  @ObjectModel.foreignKey.association: '_ReferenceSalesDocumentItem'
  DDI.ReferenceSDDocumentItem,
  @ObjectModel.foreignKey.association: '_ReferenceSDDocumentCategory'
  DDI.ReferenceSDDocumentCategory,
  @ObjectModel.foreignKey.association: '_LogicalSystem'
  DDI.ReferenceDocumentLogicalSystem,
  
  //sales

  @ObjectModel.foreignKey.association: '_AdditionalCustomerGroup1'
  DDI.AdditionalCustomerGroup1,
  @ObjectModel.foreignKey.association: '_AdditionalCustomerGroup2'
  DDI.AdditionalCustomerGroup2,
  @ObjectModel.foreignKey.association: '_AdditionalCustomerGroup3'
  DDI.AdditionalCustomerGroup3,
  @ObjectModel.foreignKey.association: '_AdditionalCustomerGroup4'
  DDI.AdditionalCustomerGroup4,
  @ObjectModel.foreignKey.association: '_AdditionalCustomerGroup5'
  DDI.AdditionalCustomerGroup5,
  DDI.RetailPromotion,
  DDI.StatisticsDate,
  
  //status 

  @ObjectModel.foreignKey.association: '_SDProcessStatus'
  DDI.SDProcessStatus,
  @ObjectModel.foreignKey.association: '_PickingConfirmationStatus'
  DDI.PickingConfirmationStatus,
  @ObjectModel.foreignKey.association: '_PickingStatus'
  DDI.PickingStatus,
  @ObjectModel.foreignKey.association: '_WarehouseActivityStatus'
  DDI.WarehouseActivityStatus,
  @ObjectModel.foreignKey.association: '_PackingStatus'
  DDI.PackingStatus,
  @ObjectModel.foreignKey.association: '_GoodsMovementStatus'
  DDI.GoodsMovementStatus,
  @ObjectModel.foreignKey.association: '_DeliveryRelatedBillingStatus'
  DDI.DeliveryRelatedBillingStatus,
  @ObjectModel.foreignKey.association: '_ProofOfDeliveryStatus'
  DDI.ProofOfDeliveryStatus,
  @ObjectModel.foreignKey.association: '_ItemGeneralIncompletionStatus'
  DDI.ItemGeneralIncompletionStatus,
  @ObjectModel.foreignKey.association: '_ItemDelivIncompletionSts'
  DDI.ItemDeliveryIncompletionStatus,
  @ObjectModel.foreignKey.association: '_ItemPickingIncompletionStatus'
  DDI.ItemPickingIncompletionStatus,
  @ObjectModel.foreignKey.association: '_ItemGdsMvtIncompletionSts'
  DDI.ItemGdsMvtIncompletionSts,
  @ObjectModel.foreignKey.association: '_ItemPackingIncompletionStatus'
  DDI.ItemPackingIncompletionStatus,
  @ObjectModel.foreignKey.association: '_ItemBillingIncompletionStatus'
  DDI.ItemBillingIncompletionStatus, 
  
  //Customer

  @ObjectModel.foreignKey.association: '_SoldToParty'
  DDI._DeliveryDocument.SoldToParty,
  cast(DDI._DeliveryDocument._SoldToParty.CustomerName as vdm_sold_to_name) as SoldToPartyName,
  @ObjectModel.foreignKey.association: '_CustomerGroup'
  DDI._DeliveryDocument.CustomerGroup,
  DDI._DeliveryDocument._SoldToParty.CustomerClassification   as SoldToPartyClassification, 
  
  //Geographics

  @ObjectModel.foreignKey.association: '_SalesDistrict'
  DDI._DeliveryDocument.SalesDistrict,
  
  // Misc Attributes (for DCL, I_CalenderDate-join)

  @ObjectModel.foreignKey.association: '_ShippingPoint'
  DDI._DeliveryDocument.ShippingPoint,        -- DCL Check for DeliveryDocument
  DDI._DeliveryDocument.BillingDocumentDate,  -- For Join with I_CalendarDate and CurrencyConversion


//Measures      

  @DefaultAggregation: #SUM
  @Semantics.amount.currencyCode: 'TransactionCurrency'
  case when SDI.IsReturnsItem = '' and
           ( DDI.DeliveryRelatedBillingStatus = 'A' or 
             DDI.DeliveryRelatedBillingStatus = 'B' 
           ) and
           (  DDI.HigherLvlItmOfBatSpltItm is initial      or       --only NORMAL entries     --AT 21.09.2018 Incident 484039 Batch Handling   
              DDI_SUPER.DeliveryRelatedBillingStatus is initial     --only BATCH (SUBordonated) entries with a SUPER entry that is not billing relevant
           )
  
  then
    case when SDI.RequestedQuantityInBaseUnit > 0
    then
    --AT 21.09.2018 Incident 484039 Batch Handling
    --cast(division(abs(SDI.NetAmount) * DDI.ActualDeliveredQtyInBaseUnit, SDI.RequestedQuantityInBaseUnit,3 ) as opn_dlv_for_inv_net_amt)
    cast(division(abs(SDI.NetAmount) * cast( ( DDI.ActualDeliveredQtyInBaseUnit + DDI.CumulativeBatchQtyInBaseUnit ) as opn_shppd_dlv_for_inv_qty), SDI.RequestedQuantityInBaseUnit,3 ) as opn_dlv_for_inv_net_amt)   
    else cast(0 as opn_dlv_for_inv_net_amt )
    end
  end
  as OpnOutbDelivsForInvcNetAmt,           

--AT8.2.22: intro of enlarged successors  (->wertv10) 
  @VDM.lifecycle: { status: #DEPRECATED, successor: 'ShpdNotInvcdDelivsNetAmount_2' }     
  @DefaultAggregation: #SUM
  @Semantics.amount.currencyCode: 'TransactionCurrency'
  case when SDI.IsReturnsItem = '' and
           ( DDI.DeliveryRelatedBillingStatus = 'A' or 
             DDI.DeliveryRelatedBillingStatus = 'B' 
           ) and
           DDI.GoodsMovementStatus = 'C' and
           (  DDI.HigherLvlItmOfBatSpltItm is initial      or      --only NORMAL entries     --AT 21.09.2018 Incident 484039 Batch Handling   
              DDI_SUPER.DeliveryRelatedBillingStatus is initial     --only BATCH (SSUBordonated) entries with a SUPER entry that is not billing relevant
           )
  then
    case when SDI.RequestedQuantityInBaseUnit > 0
    then
    --AT 21.09.2018 Incident 484039 Batch Handling
    --cast(division(abs(SDI.NetAmount) *  DDI.ActualDeliveredQtyInBaseUnit , SDI.RequestedQuantityInBaseUnit,3 ) as opn_dlv_for_inv_net_amt)
     cast(division(abs(SDI.NetAmount) *  cast( ( DDI.ActualDeliveredQtyInBaseUnit + DDI.CumulativeBatchQtyInBaseUnit ) as opn_shppd_dlv_for_inv_qty) , SDI.RequestedQuantityInBaseUnit,3 ) as opn_shppd_dlv_for_inv_net_shor)  -- middle cast prevents type conflict  
    else cast(0 as opn_shppd_dlv_for_inv_net_shor )
    end
  end  --Wertv8
  as ShpdNotInvcdDelivsNetAmount,    --AT 25.4.2018: new for CE1808
  
  @DefaultAggregation: #SUM
  @Semantics.amount.currencyCode: 'TransactionCurrency'
  @Analytics.internalName: #LOCAL 
  case when SDI.IsReturnsItem = '' and
           ( DDI.DeliveryRelatedBillingStatus = 'A' or 
             DDI.DeliveryRelatedBillingStatus = 'B' 
           ) and
           DDI.GoodsMovementStatus = 'C' and
           (  DDI.HigherLvlItmOfBatSpltItm is initial      or       --only NORMAL entries     --AT 21.09.2018 Incident 484039 Batch Handling   
              DDI_SUPER.DeliveryRelatedBillingStatus is initial     --only BATCH (SSUBordonated) entries with a SUPER entry that is not billing relevant
           )
   then
    case when SDI.RequestedQuantityInBaseUnit > 0
    then
    --AT 21.09.2018 Incident 484039 Batch Handling
    --cast(division(abs(SDI.NetAmount) *  DDI.ActualDeliveredQtyInBaseUnit , SDI.RequestedQuantityInBaseUnit,3 ) as opn_dlv_for_inv_net_amt)
     cast(division(abs(SDI.NetAmount) *  cast( ( DDI.ActualDeliveredQtyInBaseUnit + DDI.CumulativeBatchQtyInBaseUnit ) as opn_shppd_dlv_for_inv_qty) , SDI.RequestedQuantityInBaseUnit,3 ) as opn_shppd_dlv_for_inv_net_amt)  -- middle cast prevents type conflict  
    else cast(0 as opn_shppd_dlv_for_inv_net_amt )
    end
  end  --Wertv10
  as ShpdNotInvcdDelivsNetAmount_2,    
  //  ----------------------------END--------------------

       
  @Semantics.currencyCode: true
  @ObjectModel.foreignKey.association: '_TransactionCurrency'
  SDI.TransactionCurrency,
   
  @Semantics.currencyCode: true
  @ObjectModel.foreignKey.association: '_StatisticsCurrency' 
  _DeliveryDocument._SalesOrganization.SalesOrganizationCurrency as StatisticsCurrency, --Note: take statistical currency from central tvko (versus document)
     
  @DefaultAggregation: #SUM
  @Semantics.quantity.unitOfMeasure: 'BaseUnit'
  case when  SDI.IsReturnsItem = '' and
             ( DDI.DeliveryRelatedBillingStatus = 'A' or 
               DDI.DeliveryRelatedBillingStatus = 'B' 
             ) and
             (  DDI.HigherLvlItmOfBatSpltItm is initial      or      --only NORMAL entries     --AT 21.09.2018 Incident 484039 Batch Handling   
                DDI_SUPER.DeliveryRelatedBillingStatus is initial     --only BATCH (SUBordonated) entries with a SUPER entry that is not billing relevant
             )
  then
    cast( ( DDI.ActualDeliveredQtyInBaseUnit + DDI.CumulativeBatchQtyInBaseUnit ) as opn_shppd_dlv_for_inv_qty)  --AT 21.09.2018 Incident 484039 Batch Handling
  end
  as OpnOutbDelivsForInvcQty,
  
  @DefaultAggregation: #SUM
  @Semantics.quantity.unitOfMeasure: 'BaseUnit'
  case when  SDI.IsReturnsItem = '' and
             ( DDI.DeliveryRelatedBillingStatus = 'A' or 
               DDI.DeliveryRelatedBillingStatus = 'B' 
             ) and
             DDI.GoodsMovementStatus = 'C' and
             (  DDI.HigherLvlItmOfBatSpltItm is initial      or      --only NORMAL entries     --AT 21.09.2018 Incident 484039 Batch Handling   
                DDI_SUPER.DeliveryRelatedBillingStatus is initial     --only BATCH (SUBordonated) entries with a SUPER entry that is not billing relevant
             )
             
  then
    cast( ( DDI.ActualDeliveredQtyInBaseUnit + DDI.CumulativeBatchQtyInBaseUnit ) as opn_shppd_dlv_for_inv_qty)  --AT 21.09.2018 Incident 484039 Batch Handling
  end
  as ShpdNotInvcdDelivsQuantity,     --AT 25.4.2018: new for CE1808
  
  @Semantics.unitOfMeasure: true
  @ObjectModel.foreignKey.association: '_BaseUnit'
  DDI.BaseUnit,

//Associations

  @ObjectModel.association.type: [#TO_COMPOSITION_PARENT, #TO_COMPOSITION_ROOT]      
  DDI._DeliveryDocument,
  DDI._Partner,
  DDI._SDDocumentCategory,
  DDI._ItemCategory,
  DDI._SalesDocumentItemType,
  DDI._CreatedByUser,
  DDI._DistributionChannel,
  DDI._Division,
  DDI._SalesGroup,
  DDI._SalesOffice,
  @VDM.lifecycle: { status: #DEPRECATED, successor: '_Product' }
  DDI._Material,
  DDI._Product,
  DDI._OriginallyRequestedMaterial,
  DDI._ProductHierarchyNode,
  @VDM.lifecycle: { status: #DEPRECATED, successor: '_ProductGroup' }  
  DDI._MaterialGroup,
  DDI._ProductGroup,
  DDI._MaterialFreightGroup,
  DDI._AdditionalMaterialGroup1,
  DDI._AdditionalMaterialGroup2,
  DDI._AdditionalMaterialGroup3,
  DDI._AdditionalMaterialGroup4,
  DDI._AdditionalMaterialGroup5,
  DDI._Plant,
  DDI._Warehouse,
  DDI._StorageLocation,
  DDI._InventorySpecialStockType,
  DDI._DeliveryQuantityUnit,
  DDI._BaseUnit,
  DDI._ItemWeightUnit,
  DDI._ItemVolumeUnit,
  DDI._BOMExplosion,
  DDI._WarehouseStagingArea,
  DDI._PickingControl,
  DDI._LoadingGroup,
  DDI._GoodsMovementType,
  DDI._TransportationGroup,
  DDI._ItemIsBillingRelevant,
  DDI._ItemBillingBlockReason,
  DDI._PaymentGuaranteeForm,
  DDI._BusinessArea,
  DDI._ControllingArea,
  DDI._ProfitCenter,
  DDI._InventoryValuationType,
  DDI._OrderID,
  DDI._CostCenter,
  DDI._ReferenceSDDocument,
  DDI._ReferenceSalesDocumentItem,
  DDI._ReferenceSDDocumentCategory,
  DDI._LogicalSystem,
  DDI._AdditionalCustomerGroup1,
  DDI._AdditionalCustomerGroup2,
  DDI._AdditionalCustomerGroup3,
  DDI._AdditionalCustomerGroup4,
  DDI._AdditionalCustomerGroup5,
  DDI._SDProcessStatus,
  DDI._PickingConfirmationStatus,
  DDI._PickingStatus,
  DDI._WarehouseActivityStatus,
  DDI._PackingStatus,
  DDI._GoodsMovementStatus,
  DDI._DeliveryRelatedBillingStatus,
  DDI._ProofOfDeliveryStatus,
  DDI._ItemGeneralIncompletionStatus,
  DDI._ItemDelivIncompletionSts,
  DDI._ItemPickingIncompletionStatus,
  DDI._ItemGdsMvtIncompletionSts,
  DDI._ItemPackingIncompletionStatus,
  DDI._ItemBillingIncompletionStatus,
// some further associations (historical reasons, don't use them !)

  DDI._DeliveryDocument._SalesOrganization,
  DDI._DeliveryDocument._CustomerGroup,  
  DDI._DeliveryDocument._SalesDistrict,
  DDI._DeliveryDocument._ShippingPoint,
  DDI._DeliveryDocument._SoldToParty,
  DDI._DeliveryDocument._SoldToParty._CustomerClassification,
  _StatisticsCurrency,
  SDI._TransactionCurrency
} 
where SDI.StatisticalValueControl = ''