P_BillingDocProcFlowC10

DDL: P_BILLINGDOCPROCFLOWC10 SQL: PBILLGDOPROCFC10 Type: view CONSUMPTION Package: ODATA_SD_BIL_PROCESSFLOW

Billing Doc Process Flow:: Level +1 Cancellation Case SD

P_BillingDocProcFlowC10 is a Consumption CDS View that provides data about "Billing Doc Process Flow:: Level +1 Cancellation Case SD" in SAP S/4HANA. It reads from 2 data sources (P_BillingDocProcFlowC0, I_SDDocumentProcessFlow) and exposes 9 fields with key fields LevelC0Document, LevelC0DocumentItem, LevelC0DocumentCategory, Level1Document, Level1DocumentItem. Part of development package ODATA_SD_BIL_PROCESSFLOW.

Data Sources (2)

SourceAliasJoin Type
P_BillingDocProcFlowC0 Level0 from
I_SDDocumentProcessFlow Level1 inner

Annotations (9)

NameValueLevelField
AbapCatalog.preserveKey true view
AbapCatalog.sqlViewName PBILLGDOPROCFC10 view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XL view
VDM.private true view
VDM.viewType #CONSUMPTION view

Fields (9)

KeyFieldSource TableSource FieldDescription
KEY LevelC0Document P_BillingDocProcFlowC0 LevelC0Document
KEY LevelC0DocumentItem P_BillingDocProcFlowC0 LevelC0DocumentItem
KEY LevelC0DocumentCategory P_BillingDocProcFlowC0 LevelC0DocumentCategory
KEY Level1Document I_SDDocumentProcessFlow SubsequentDocument
KEY Level1DocumentItem I_SDDocumentProcessFlow SubsequentDocumentItem
KEY BillingDocument P_BillingDocProcFlowC0 BillingDocument
BillingDocumentType P_BillingDocProcFlowC0 BillingDocumentType
SDDocumentCategory P_BillingDocProcFlowC0 SDDocumentCategory
SalesOrganization P_BillingDocProcFlowC0 SalesOrganization
@AbapCatalog.preserveKey: true
@AbapCatalog.sqlViewName: 'PBILLGDOPROCFC10'

@AccessControl.authorizationCheck: #NOT_REQUIRED

@ClientHandling.algorithm: #SESSION_VARIABLE

@ObjectModel.usageType: { dataClass: #MIXED, serviceQuality: #C, sizeCategory: #XL }

@VDM.private: true
@VDM.viewType: #CONSUMPTION

define view P_BillingDocProcFlowC10
  as select from           P_BillingDocProcFlowC0  as Level0  -- > Level 0

    inner join             I_SDDocumentProcessFlow as Level1  -- > Level 1
      on  Level0.LevelC0Document         = Level1.PrecedingDocument
      and Level0.LevelC0DocumentItem     = Level1.PrecedingDocumentItem
      and Level0.LevelC0DocumentItem     = Level1.PrecedingDocumentItem
      and Level0.LevelC0DocumentCategory = Level1.PrecedingDocumentCategory
      and (Level1.SubsequentDocumentCategory = 'O' or   -- > Credit Memo
           Level1.SubsequentDocumentCategory = 'P' or   -- > Debit Memo
           Level1.SubsequentDocumentCategory = 'K' or   -- > Credit Memo Request  
           Level1.SubsequentDocumentCategory = 'L' or   -- > Debit Memo Request  
           Level1.SubsequentDocumentCategory = 'H' or   -- > Returns        
           Level1.SubsequentDocumentCategory = '6' or   -- > Intercompany Credit Memo
           Level1.SubsequentDocumentCategory = 'N' or   -- > Invoice Cancellatiom
           Level1.SubsequentDocumentCategory = 'S' or   -- > Credit Memo Cancellation     
           Level1.SubsequentDocumentCategory = 'DPCC'   -- > Down Payment Cancellation     
         )

    left outer to one join I_SalesDocumentBasic    as SalesDocument
      on Level1.SubsequentDocument = SalesDocument.SalesDocument

    left outer to one join I_BillingDocument       as BillingDocument
      on Level1.SubsequentDocument = BillingDocument.BillingDocument

{
      // Key

  key Level0.LevelC0Document         as LevelC0Document,
  key Level0.LevelC0DocumentItem     as LevelC0DocumentItem,
  key Level0.LevelC0DocumentCategory as LevelC0DocumentCategory,
  key Level1.SubsequentDocument      as Level1Document,
  key Level1.SubsequentDocumentItem  as Level1DocumentItem,

  key
   // Category 

      case when
           ((Level1.SubsequentDocumentCategory = 'K' or   -- > Credit Memo Request  
             Level1.SubsequentDocumentCategory = 'L') and   -- > Debit Memo Request
             SalesDocument.SDDocumentCategory is not null)   -- > not archived  
       then SalesDocument.SDDocumentCategory    -- > from header for mixed documents
       when
            ((Level1.SubsequentDocumentCategory = 'O' or   -- > Credit Memo  
              Level1.SubsequentDocumentCategory = 'P') and -- > Debit Memo 
              BillingDocument.SDDocumentCategory is not null)
        then BillingDocument.SDDocumentCategory    -- > from header for mixed documents                 
       else Level1.SubsequentDocumentCategory
      end                            as   Level1DocumentCategory,

  key Level0.BillingDocument,

      Level0.BillingDocumentType,
      Level0.SDDocumentCategory,

      // Organizatio

      Level0.SalesOrganization
}