P_OutbDelivProcFlowRelated

DDL: P_OUTBDELIVPROCFLOWRELATED SQL: PDELIVPROCFLOWR Type: view CONSUMPTION

Outbound Delivery Process Flow Predecessor and Successors

P_OutbDelivProcFlowRelated is a Consumption CDS View that provides data about "Outbound Delivery Process Flow Predecessor and Successors" in SAP S/4HANA. It reads from 3 data sources (P_DelivProcFlowLatestTransfOrd, P_DelivProcFlowLatestTransfOrd, P_DeliveryProcFlowTransfOrd) and exposes 77 fields with key fields DeliveryDocument, PrecedingDocument, SubsequentDocument, SubsequentDocumentCategory, PrecedingDocument. It has 1 association to related views.

Data Sources (3)

SourceAliasJoin Type
P_DelivProcFlowLatestTransfOrd LatestWMTransferOrder inner
P_DelivProcFlowLatestTransfOrd WMTransferOrder left_outer
P_DeliveryProcFlowTransfOrd WMTransferOrder inner

Associations (1)

CardinalityTargetAliasCondition
[1..1] I_DeliveryDocument _DeliveryDocument $projection.DeliveryDocument = _DeliveryDocument.DeliveryDocument

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PDELIVPROCFLOWR view
AbapCatalog.compiler.compareFilter true view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.authorizationCheck #CHECK view
EndUserText.label Outbound Delivery Process Flow Predecessor and Successors view
VDM.private true view
VDM.viewType #CONSUMPTION view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XL view

Fields (77)

KeyFieldSource TableSource FieldDescription
KEY DeliveryDocument DeliveryItem DeliveryDocument
KEY PrecedingDocument
KEY SubsequentDocument
KEY SubsequentDocumentCategory
SDDocumentCategory
WarehouseNumber
WrhsMgmtTransferOrder
MaterialDocument
MaterialDocumentYear
BillingDocument
FreightOrder
OutboundDeliveryasDeliveryDocument
KEY PrecedingDocument _DeliveryDocument DeliveryDocument
KEY PrecedingDocumentCategory _DeliveryDocument SDDocumentCategory
KEY SubsequentDocument FreightOrder FreightOrder
KEY SubsequentDocumentCategory
SDDocumentCategory _DeliveryDocument SDDocumentCategory
SalesDocument
PurchaseOrder
WarehouseNumber
WrhsMgmtTransferOrder
MaterialDocument
MaterialDocumentYear
BillingDocument
FreightOrder FreightOrder FreightOrder
DeliveryDocument
KEY PrecedingDocument P_DeliveryProcFlowTransfOrd PrecedingDocument
KEY PrecedingDocumentCategory P_DeliveryProcFlowTransfOrd PrecedingDocumentCategory
KEY SubsequentDocument P_DeliveryProcFlowTransfOrd SubsequentDocument
KEY SubsequentDocumentCategory
SDDocumentCategory P_DeliveryProcFlowTransfOrd PrecedingDocumentCategory
SalesDocument
PurchaseOrder
WarehouseNumber P_DeliveryProcFlowTransfOrd WarehouseNumber
WrhsMgmtTransferOrder P_DeliveryProcFlowTransfOrd WrhsMgmtTransferOrder
MaterialDocument
MaterialDocumentYear
BillingDocument
FreightOrder
KEY PrecedingDocument GoodsIssue PrecedingDocument
KEY PrecedingDocumentCategory GoodsIssue PrecedingDocumentCategory
KEY SubsequentDocument GoodsIssue SubsequentDocument
SDDocumentCategory GoodsIssue PrecedingDocumentCategory
SalesDocument
PurchaseOrder
WarehouseNumber
WrhsMgmtTransferOrder
MaterialDocument GoodsIssue MaterialDocument
MaterialDocumentYear GoodsIssue MaterialDocumentYear
BillingDocument
FreightOrder
KEY PrecedingDocument
KEY PrecedingDocumentCategory
KEY SubsequentDocument GoodsIssue SubsequentDocument
SDDocumentCategory GoodsIssue PrecedingDocumentCategory
SalesDocument
PurchaseOrder
WarehouseNumber
WrhsMgmtTransferOrder
MaterialDocument GoodsIssue MaterialDocument
MaterialDocumentYear GoodsIssue MaterialDocumentYear
BillingDocument
FreightOrder
KEY PrecedingDocument BillingDocument PrecedingDocument
KEY PrecedingDocumentCategory BillingDocument PrecedingDocumentCategory
KEY SubsequentDocument BillingDocument SubsequentDocument
KEY SubsequentDocumentCategory BillingDocument SubsequentDocumentCategory
SDDocumentCategory BillingDocument PrecedingDocumentCategory
SalesDocument
PurchaseOrder
WarehouseNumber
WrhsMgmtTransferOrder
MaterialDocument
MaterialDocumentYear
BillingDocument BillingDocument SubsequentDocument
FreightOrder
_DeliveryDocument _DeliveryDocument
@AbapCatalog.sqlViewName:'PDELIVPROCFLOWR'
@AbapCatalog.compiler.compareFilter: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Outbound Delivery Process Flow Predecessor and Successors'
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #XL

// Outbound Delivery BPF: Predecessor and Successors of Outbound Delivery

define view P_OutbDelivProcFlowRelated

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

  as select distinct from I_DeliveryDocumentItem as DeliveryItem

  association [1..1] to I_DeliveryDocument as _DeliveryDocument on $projection.DeliveryDocument = _DeliveryDocument.DeliveryDocument

{
  key DeliveryItem.DeliveryDocument,
  key cast(DeliveryItem.ReferenceSDDocument as preced_doc ) as PrecedingDocument,
  key case when DeliveryItem.ReferenceSDDocumentCategory = 'V'
    then DeliveryItem.ReferenceSDDocumentCategory
    when DeliveryItem.ReferenceSDDocumentCategory = 'I'
    then DeliveryItem.ReferenceSDDocumentCategory
    when DeliveryItem.ReferenceSDDocumentCategory = 'E' or DeliveryItem.ReferenceSDDocumentCategory = 'F'
    then DeliveryItem.ReferenceSDDocumentCategory
    else cast('C' as preced_doc_cat)
  end                                                       as PrecedingDocumentCategory,
  key DeliveryItem._DeliveryDocument.DeliveryDocument       as SubsequentDocument,
  key DeliveryItem._DeliveryDocument.SDDocumentCategory     as SubsequentDocumentCategory,

      DeliveryItem._DeliveryDocument.SDDocumentCategory,

      case DeliveryItem.ReferenceSDDocumentCategory
        when 'V' then cast('' as vbeln_va)
        else cast(DeliveryItem.ReferenceSDDocument as vbeln_va)
      end                                                   as SalesDocument,

      case DeliveryItem.ReferenceSDDocumentCategory
        when 'V' then cast(DeliveryItem.ReferenceSDDocument as ebeln)
        else cast('' as ebeln)
      end                                                   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 vbeln)                                     as BillingDocument,

      cast('' as /scmtms/tor_id)                            as FreightOrder,

      _DeliveryDocument
}

union all select distinct from C_DelivProcFlowFreightOrd as FreightOrder

association [1..1] to I_DeliveryDocument as _DeliveryDocument on $projection.DeliveryDocument  = _DeliveryDocument.DeliveryDocument

{
  key FreightOrder.OutboundDelivery           as DeliveryDocument,
  key _DeliveryDocument.DeliveryDocument      as PrecedingDocument,
  key _DeliveryDocument.SDDocumentCategory    as PrecedingDocumentCategory,
  key FreightOrder.FreightOrder               as SubsequentDocument,
  key cast('F' as subsequ_doc_cat)            as SubsequentDocumentCategory,

      _DeliveryDocument.SDDocumentCategory    as SDDocumentCategory,

      cast('' as vbeln_va)                    as SalesDocument,
      cast('' as ebeln)                       as PurchaseOrder,

      // Warehouse Management Transfer Order

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

      // Material Document

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

      // Billing Document

      cast('' as vbeln)                       as BillingDocument,

      //Freight Order

      FreightOrder.FreightOrder               as FreightOrder,

      _DeliveryDocument
}


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

union all select distinct from P_DeliveryProcFlowTransfOrd as WMTransferOrder

association [1..1] to I_DeliveryDocument as _DeliveryDocument on $projection.DeliveryDocument = _DeliveryDocument.DeliveryDocument

{
  key WMTransferOrder.DeliveryDocument,
  key WMTransferOrder.PrecedingDocument,
  key WMTransferOrder.PrecedingDocumentCategory,
  key WMTransferOrder.SubsequentDocument,
  key cast('Q1' as subsequ_doc_cat)             as SubsequentDocumentCategory,

      WMTransferOrder.PrecedingDocumentCategory as SDDocumentCategory,

      cast('' as vbeln_va)                      as SalesDocument,
      cast('' as ebeln)                         as PurchaseOrder,

      WMTransferOrder.WarehouseNumber,
      WMTransferOrder.WrhsMgmtTransferOrder,

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

      cast('' as vbeln)                         as BillingDocument,

      cast('' as /scmtms/tor_id)                as FreightOrder,

      _DeliveryDocument
}

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

union all select distinct from I_LatestGIRelatedMatDoc        as GoodsIssue
  left outer join              P_DelivProcFlowLatestTransfOrd as WMTransferOrder on WMTransferOrder.DeliveryDocument = GoodsIssue.PrecedingDocument
association [1..1] to I_DeliveryDocument as _DeliveryDocument on $projection.DeliveryDocument = _DeliveryDocument.DeliveryDocument

{
  key cast(GoodsIssue.PrecedingDocument as vbeln_vl) as DeliveryDocument,
  key GoodsIssue.PrecedingDocument,
  key GoodsIssue.PrecedingDocumentCategory,
  key GoodsIssue.SubsequentDocument,
  key
      case GoodsIssue.SubsequentDocumentCategory
      when 'R'
        then
          case when GoodsIssue.CreationTime =  GoodsIssue.SubsequentDocumentItem
           then
            cast ('R3' as subsequ_doc_cat)
              else
            cast ('R1'  as  subsequ_doc_cat)
          end

        when 'h'
          then
           case when GoodsIssue.CreationTime =  GoodsIssue.SubsequentDocumentItem
             then
                cast ('h3' as subsequ_doc_cat)
              else
                cast ('h1'  as  subsequ_doc_cat)
              end
          end                                        as SubsequentDocumentCategory,


      GoodsIssue.PrecedingDocumentCategory           as SDDocumentCategory,

      cast('' as vbeln_va)                           as SalesDocument,
      cast('' as ebeln)                              as PurchaseOrder,

      // Warehouse Management Transfer Order

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

      // Material Document

      GoodsIssue.MaterialDocument,
      GoodsIssue.MaterialDocumentYear,

      // Billing Document

      cast('' as vbeln)                              as BillingDocument,

      //Freight Order

      cast('' as /scmtms/tor_id)                     as FreightOrder,

      _DeliveryDocument
}
where
  WMTransferOrder.WrhsMgmtTransferOrder is null

// Lane 4 (Goods Movement): WM Transfer Order > Latest Material Document Goods Issue/ Cancel Goods Issue

union all select distinct from I_LatestGIRelatedMatDoc        as GoodsIssue
  inner join                   P_DelivProcFlowLatestTransfOrd as LatestWMTransferOrder on LatestWMTransferOrder.DeliveryDocument = GoodsIssue.PrecedingDocument
  inner join                   P_DeliveryProcFlowTransfOrd    as WMTransferOrder       on  WMTransferOrder.DeliveryDocument           = LatestWMTransferOrder.DeliveryDocument
                                                                                       and WMTransferOrder.PrecedingDocument          = LatestWMTransferOrder.DeliveryDocument
                                                                                       and WMTransferOrder.PrecedingDocumentCategory  = GoodsIssue.PrecedingDocumentCategory
                                                                                       and WMTransferOrder.SubsequentDocument         = LatestWMTransferOrder.WrhsMgmtTransferOrder
                                                                                       and WMTransferOrder.SubsequentDocumentCategory = 'Q'

association [1..1] to I_DeliveryDocument as _DeliveryDocument on $projection.DeliveryDocument = _DeliveryDocument.DeliveryDocument

{
  key cast(GoodsIssue.PrecedingDocument as vbeln_vl)         as DeliveryDocument,
  key cast(WMTransferOrder.SubsequentDocument as preced_doc) as PrecedingDocument,
  key cast('Q1' as preced_doc_cat)                           as PrecedingDocumentCategory,
  key GoodsIssue.SubsequentDocument,
  key

      case GoodsIssue.SubsequentDocumentCategory
      when 'R'
        then
          case when GoodsIssue.CreationTime =  GoodsIssue.SubsequentDocumentItem
           then
            cast ('R3' as subsequ_doc_cat)
              else
            cast ('R1'  as  subsequ_doc_cat)
          end

         when 'h'
          then
           case when GoodsIssue.CreationTime =  GoodsIssue.SubsequentDocumentItem
             then
                cast ('h3' as subsequ_doc_cat)
              else
                cast ('h1'  as  subsequ_doc_cat)
              end
          end                                                as SubsequentDocumentCategory,


      GoodsIssue.PrecedingDocumentCategory                   as SDDocumentCategory,

      cast('' as vbeln_va)                                   as SalesDocument,
      cast('' as ebeln)                                      as PurchaseOrder,

      // Warehouse Management Transfer Order

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

      // Material Document

      GoodsIssue.MaterialDocument,
      GoodsIssue.MaterialDocumentYear,

      // Billing Document

      cast('' as vbeln)                                      as BillingDocument,

      //Freight Order

      cast('' as /scmtms/tor_id)                             as FreightOrder,

      _DeliveryDocument
}

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

union all select distinct from I_SDDocumentProcessFlow as BillingDocument

association [1..1] to I_DeliveryDocument as _DeliveryDocument on $projection.DeliveryDocument = _DeliveryDocument.DeliveryDocument

{
  key cast(BillingDocument.PrecedingDocument as vbeln_vl) as DeliveryDocument,
  key BillingDocument.PrecedingDocument,
  key BillingDocument.PrecedingDocumentCategory,
  key BillingDocument.SubsequentDocument,
  key BillingDocument.SubsequentDocumentCategory,

      BillingDocument.PrecedingDocumentCategory           as SDDocumentCategory,

      cast('' as vbeln_va)                                as SalesDocument,
      cast('' as ebeln)                                   as PurchaseOrder,

      // Warehouse Management Transfer Order

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

      // Material Document

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

      // Billing Document

      BillingDocument.SubsequentDocument                  as BillingDocument,

      //Freight Order

      cast('' as /scmtms/tor_id)                          as FreightOrder,

      _DeliveryDocument
}
where
     BillingDocument.SubsequentDocumentCategory = 'M'
  or BillingDocument.SubsequentDocumentCategory = 'O'
  or BillingDocument.SubsequentDocumentCategory = 'P'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"C_DELIVPROCFLOWFREIGHTORD",
"I_DELIVERYDOCUMENT",
"I_DELIVERYDOCUMENTITEM",
"I_LATESTGIRELATEDMATDOC",
"I_SDDOCUMENTPROCESSFLOW",
"P_DELIVERYPROCFLOWTRANSFORD",
"P_DELIVPROCFLOWLATESTTRANSFORD"
],
"ASSOCIATED":
[
"I_DELIVERYDOCUMENT"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/