P_InboundDeliveryProcessFlow

DDL: P_INBOUNDDELIVERYPROCESSFLOW SQL: PIBDLVPROCFLOW Type: view COMPOSITE Package: ODATA_LE_PROCESSFLOW

Inbound Delivery Process Flow

P_InboundDeliveryProcessFlow is a Composite CDS View that provides data about "Inbound Delivery Process Flow" in SAP S/4HANA. It reads from 3 data sources (I_SDDocumentProcessFlow, I_InboundDelivery, I_InboundDelivery) and exposes 55 fields with key fields InboundDelivery, PrecedingDocument, PrecedingDocumentCategory, SubsequentDocument, SubsequentDocumentCategory. Part of development package ODATA_LE_PROCESSFLOW.

Data Sources (3)

SourceAliasJoin Type
I_SDDocumentProcessFlow FromOutboundDelivery inner
I_InboundDelivery InboundDelivery inner
I_InboundDelivery InboundDelivery inner

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName PIBDLVPROCFLOW view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.authorizationCheck #MANDATORY view
VDM.private true view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.compositionRoot true view

Fields (55)

KeyFieldSource TableSource FieldDescription
KEY InboundDelivery I_InboundDelivery InboundDelivery
KEY PrecedingDocument
KEY PrecedingDocumentCategory I_InboundDelivery SDDocumentCategory
KEY SubsequentDocument
KEY SubsequentDocumentCategory
SDDocumentCategory I_InboundDelivery SDDocumentCategory
ShippingPoint I_InboundDelivery ShippingPoint
PurchaseOrder
WarehouseNumber
WrhsMgmtTransferOrder
MaterialDocument
MaterialDocumentYear
SupplierInvoice
FiscalYear
InboundDelivery
KEY PrecedingDocument
KEY PrecedingDocumentCategory InboundDeliveryItem ReferenceSDDocumentCategory
KEY SubsequentDocument
KEY SubsequentDocumentCategory
SDDocumentCategory
ShippingPoint
PurchaseOrder InboundDeliveryItem ReferenceSDDocument
WarehouseNumber
WrhsMgmtTransferOrder
MaterialDocument
MaterialDocumentYear
SupplierInvoice
FiscalYear
InboundDelivery
KEY PrecedingDocument InboundDeliveryFlow PrecedingDocument
KEY PrecedingDocumentCategory InboundDeliveryFlow PrecedingDocumentCategory
KEY SubsequentDocument InboundDeliveryFlow SubsequentDocument
KEY SubsequentDocumentCategory InboundDeliveryFlow SubsequentDocumentCategory
SDDocumentCategory I_InboundDelivery SDDocumentCategory
ShippingPoint I_InboundDelivery ShippingPoint
PurchaseOrder InboundDeliveryFlow PurchaseOrder
WarehouseNumber InboundDeliveryFlow WarehouseNumber
WrhsMgmtTransferOrder InboundDeliveryFlow WrhsMgmtTransferOrder
MaterialDocument InboundDeliveryFlow MaterialDocument
MaterialDocumentYear InboundDeliveryFlow MaterialDocumentYear
SupplierInvoice InboundDeliveryFlow SupplierInvoice
FiscalYear InboundDeliveryFlow FiscalYear
KEY PrecedingDocument OutboundDeliveryFlow PrecedingDocument
KEY SubsequentDocument OutboundDeliveryFlow SubsequentDocument
KEY SubsequentDocumentCategory OutboundDeliveryFlow SubsequentDocumentCategory
SDDocumentCategory I_InboundDelivery SDDocumentCategory
ShippingPoint I_InboundDelivery ShippingPoint
PurchaseOrder OutboundDeliveryFlow PurchaseOrder
WarehouseNumber OutboundDeliveryFlow WarehouseNumber
WrhsMgmtTransferOrder OutboundDeliveryFlow WrhsMgmtTransferOrder
MaterialDocument OutboundDeliveryFlow MaterialDocument
MaterialDocumentYear OutboundDeliveryFlow MaterialDocumentYear
SupplierInvoice
FiscalYear
BillingDocument OutboundDeliveryFlow BillingDocument
@AbapCatalog.sqlViewName: 'PIBDLVPROCFLOW'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #MANDATORY
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.compositionRoot:true

define view P_InboundDeliveryProcessFlow
  // Lane 6 (Delivery Creation): Anchor Document

  as select distinct from I_InboundDelivery as InboundDelivery
{
  key InboundDelivery.InboundDelivery,
  key cast(InboundDelivery.InboundDelivery as preced_doc ) as PrecedingDocument,
  key InboundDelivery.SDDocumentCategory                   as PrecedingDocumentCategory,
  key cast('' as subsequ_doc)                              as SubsequentDocument,
  key cast('' as subsequ_doc_cat)                          as SubsequentDocumentCategory,

      InboundDelivery.SDDocumentCategory,

      InboundDelivery.ShippingPoint,
      cast( '' as vdm_purchaseorder)                       as PurchaseOrder,

      cast('' as lgnum)                                    as WarehouseNumber,
      cast('0000000000' as wm_transfer_order)              as WrhsMgmtTransferOrder,

      cast('' as mblnr )                                   as MaterialDocument,
      cast('0000' as mjahr)                                as MaterialDocumentYear,

      cast('' as re_belnr)                                 as SupplierInvoice,
      cast('0000' as gjahr)                                as FiscalYear,

      cast('' as vbeln)                                    as BillingDocument
}


// Lane 1 (Order Creation): Purchase Order -> Inbound Delivery

union all select distinct from I_InboundDeliveryItem   as InboundDeliveryItem
  left outer to many join      I_SDDocumentProcessFlow as FromOutboundDelivery on FromOutboundDelivery.SubsequentDocument = InboundDeliveryItem.InboundDelivery
{
  key InboundDeliveryItem.InboundDelivery,
  key cast(InboundDeliveryItem.ReferenceSDDocument as preced_doc )               as PrecedingDocument,
  key InboundDeliveryItem.ReferenceSDDocumentCategory                            as PrecedingDocumentCategory,
  key cast(InboundDeliveryItem._InboundDelivery.InboundDelivery as subsequ_doc ) as SubsequentDocument,
  key InboundDeliveryItem._InboundDelivery.SDDocumentCategory                    as SubsequentDocumentCategory,

      InboundDeliveryItem._InboundDelivery.SDDocumentCategory,

      InboundDeliveryItem._InboundDelivery.ShippingPoint,
      InboundDeliveryItem.ReferenceSDDocument                                    as PurchaseOrder,

      cast('' as lgnum)                                                          as WarehouseNumber,
      cast('0000000000' as wm_transfer_order)                                    as WrhsMgmtTransferOrder,

      cast('' as mblnr )                                                         as MaterialDocument,
      cast('0000' as mjahr)                                                      as MaterialDocumentYear,

      cast('' as re_belnr)                                                       as SupplierInvoice,
      cast('0000' as gjahr)                                                      as FiscalYear,

      cast('' as vbeln)                                                          as BillingDocument
}
where
  FromOutboundDelivery.SubsequentDocument is null


// Lane 7 (Putaway):        Inbound Delivery > WM Transfer Order

// Lane 8 (Goods Movement): Inbound Delivery > Goods Receipt

// Lane 8 (Goods Movement): Warehouse Transfer Order -> Goods Receipt

// Lane 9 (Invoicing):      Inbound Delivery > Supplier Invoice

union all select distinct from P_InbDelivProcFlowChildren as InboundDeliveryFlow
  left outer to many join      I_SDDocumentProcessFlow    as FromOutboundDelivery on  FromOutboundDelivery.SubsequentDocument        = InboundDeliveryFlow.InboundDelivery
                                                                                  and FromOutboundDelivery.PrecedingDocumentCategory = 'J'
  inner join                   I_InboundDelivery          as InboundDelivery      on InboundDeliveryFlow.InboundDelivery = InboundDelivery.InboundDelivery
{
  key InboundDeliveryFlow.InboundDelivery,
  key InboundDeliveryFlow.PrecedingDocument,
  key InboundDeliveryFlow.PrecedingDocumentCategory,
  key InboundDeliveryFlow.SubsequentDocument as SubsequentDocument,
  key InboundDeliveryFlow.SubsequentDocumentCategory,

      InboundDelivery.SDDocumentCategory,

      InboundDelivery.ShippingPoint,
      InboundDeliveryFlow.PurchaseOrder,

      InboundDeliveryFlow.WarehouseNumber,
      InboundDeliveryFlow.WrhsMgmtTransferOrder,

      InboundDeliveryFlow.MaterialDocument,
      InboundDeliveryFlow.MaterialDocumentYear,

      InboundDeliveryFlow.SupplierInvoice,
      InboundDeliveryFlow.FiscalYear,

      cast('' as vbeln)                      as BillingDocument
}

// Outbound Delivery BPF in case of STO with Inbound Delivery

// Relatives of Outbound Delivery

// Lane 1 (Order Creation):     Purchase Order -> Outbound Delivery

// Lane 3 (Picking):            Outbound Delivery > Non-cancelled WM Transfer Orders

// Lane 4 (Goods Movement):     Outbound Delivery > Latest Material Document Goods Issue/ Cancel Goods Issue

// Lane 5 (Invoicing):          Outbound Delivery > Billing Document

// Lane 6 (Delivery Creation):  Goods Issue > Inbound Delivery (STO 2-step with Inbound Delivery)

// Lane 7 (Putaway): Inbound    Delivery > WM Transfer Order (STO 2-step with Inbound Delivery)

// Lane 8 (Goods Movement):     Inbound Delivery > Goods Receipt (STO 2-step with Inbound Delivery)

// Lane 9 (Invoicing):          Inbound Delivery > Supplier Invoice (STO 2-step with Inbound Delivery)

// Lane 8 (Goods Movement):     GoodsReceipt from Purchase Order (STO 2-step w/o Inbound Delivery)

// Lane 8 (Goods Movement):     GoodsIssue from Purchase Order (rSTO 2-step with Returns Delivery)

union all select distinct from P_DlvNodesForInbDelivProcFlow  as OutboundDeliveryFlow
  inner join                   I_SDDocumentProcessFlow        as FromOutboundDelivery on  FromOutboundDelivery.PrecedingDocument          = OutboundDeliveryFlow.DeliveryDocument
                                                                                 and FromOutboundDelivery.SubsequentDocumentCategory = '7'
  inner join                   I_InboundDelivery              as InboundDelivery      on FromOutboundDelivery.SubsequentDocument = InboundDelivery.InboundDelivery
{
  key  cast(FromOutboundDelivery.SubsequentDocument as vbeln_vl) as InboundDelivery,
  key  OutboundDeliveryFlow.PrecedingDocument,
  key  case OutboundDeliveryFlow.PrecedingDocumentCategory
         when 'R' then 'R1'
         when 'h' then 'h1'
         else OutboundDeliveryFlow.PrecedingDocumentCategory
       end                                                       as PrecedingDocumentCategory,

  key  OutboundDeliveryFlow.SubsequentDocument,
  key  OutboundDeliveryFlow.SubsequentDocumentCategory           as SubsequentDocumentCategory,

       InboundDelivery.SDDocumentCategory,

       InboundDelivery.ShippingPoint,
       OutboundDeliveryFlow.PurchaseOrder,

       OutboundDeliveryFlow.WarehouseNumber,
       OutboundDeliveryFlow.WrhsMgmtTransferOrder,

       OutboundDeliveryFlow.MaterialDocument,
       OutboundDeliveryFlow.MaterialDocumentYear,

       cast('' as re_belnr)                                      as SupplierInvoice,
       cast('0000' as gjahr)                                     as FiscalYear,

       OutboundDeliveryFlow.BillingDocument
}
// Filter for only relevant Preceding Doc. Categories

where
     OutboundDeliveryFlow.PrecedingDocumentCategory = 'J'
  or OutboundDeliveryFlow.PrecedingDocumentCategory = 'C'
  or OutboundDeliveryFlow.PrecedingDocumentCategory = 'V'