P_PackedDeliveryForStore_F4674

DDL: P_PACKEDDELIVERYFORSTORE_F4674 SQL: PPCKDDELVSTF4674 Type: view COMPOSITE

P_PackedDeliveryForStore_F4674 is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_DeliveryDocumentItem, I_DeliveryDocumentItem) and exposes 15 fields with key fields Store, DeliveryDocument, DeliveryDocument.

Data Sources (2)

SourceAliasJoin Type
I_DeliveryDocumentItem Item inner
I_DeliveryDocumentItem Item inner

Annotations (8)

NameValueLevelField
AbapCatalog.sqlViewName PPCKDDELVSTF4674 view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #PRIVILEGED_ONLY view
AccessControl.personalData.blocking #BLOCKED_DATA_EXCLUDED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.viewType #COMPOSITE view
VDM.private true view

Fields (15)

KeyFieldSource TableSource FieldDescription
KEY Store Delivery ReceivingPlant
KEY DeliveryDocument Delivery DeliveryDocument
DeliveryDate Delivery DeliveryDate
OverallGoodsMovementStatus Delivery OverallGoodsMovementStatus
SupplyingSite I_DeliveryDocumentItem Plant
Supplier
PurchaseOrder
PlantasStore
KEY DeliveryDocument Delivery DeliveryDocument
DeliveryDate Delivery DeliveryDate
OverallGoodsMovementStatus Delivery OverallGoodsMovementStatus
SupplyingSite
Supplier Delivery Supplier
PurchaseOrder
HandlingUnitPackingObjectType
@AbapCatalog.sqlViewName: 'PPCKDDELVSTF4674'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #PRIVILEGED_ONLY
@AccessControl.personalData.blocking: #BLOCKED_DATA_EXCLUDED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.viewType: #COMPOSITE
@VDM.private: true
define view P_PackedDeliveryForStore_F4674
  as

  // Outbound Delivery

  select distinct from I_DeliveryDocument     as Delivery
    inner join         I_DeliveryDocumentItem as Item on Item.DeliveryDocument = Delivery.DeliveryDocument
{
  key Delivery.ReceivingPlant                                 as Store,
  key Delivery.DeliveryDocument,

      Delivery.DeliveryDate,
      Delivery.OverallGoodsMovementStatus,
      Item.Plant                                              as SupplyingSite,
      cast('' as md_supplier)                                 as Supplier,
      cast(Item.ReferenceSDDocument as ebeln preserving type) as PurchaseOrder,
      cast('01' as vpobj)                                     as HandlingUnitPackingObjectType
}
where
       Delivery.SDDocumentCategory         = 'J' // Outbound Delivery

  and  Delivery.OverallGoodsMovementStatus = 'C' // Completely processed (i.e. goods issue is posted)

  and  Item.ReferenceSDDocumentCategory    = 'V' // Purchase Order

  and(
       Item.PackingStatus                  = 'B' // Partially processed

    or Item.PackingStatus                  = 'C' // Completely processed

  )

union

// Inbound Delivery

select distinct from I_DeliveryDocument     as Delivery
  inner join         I_DeliveryDocumentItem as Item on Item.DeliveryDocument = Delivery.DeliveryDocument
{
  key Item.Plant                                              as Store,
  key Delivery.DeliveryDocument,

      Delivery.DeliveryDate,
      Delivery.OverallGoodsMovementStatus,
      cast('' as werks_d)                                     as SupplyingSite,
      Delivery.Supplier                                       as Supplier,
      cast(Item.ReferenceSDDocument as ebeln preserving type) as PurchaseOrder,
      cast('03' as vpobj)                                     as HandlingUnitPackingObjectType
}
where
       Delivery.SDDocumentCategory      = '7' // Inbound Delivery

  and  Item.ReferenceSDDocumentCategory = 'V'    // Purchase Order

  and(
       Item.PackingStatus               = 'B'    // Partially processed

    or Item.PackingStatus               = 'C'    // Completely processed

  )