P_BillingDocProcFlowM3

DDL: P_BILLINGDOCPROCFLOWM3 SQL: PBILLGDOCPROCFM3 Type: view CONSUMPTION

P_BillingDocProcFlowM3 is a Consumption CDS View in SAP S/4HANA. It reads from 1 data source (I_SDDocumentProcessFlow) and exposes 8 fields with key fields LevelM3Document, LevelM3DocumentItem, LevelM2Document, LevelM2DocumentItem, LevelM2DocumentCategory.

Data Sources (1)

SourceAliasJoin Type
I_SDDocumentProcessFlow LevelM3 inner

Annotations (9)

NameValueLevelField
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
AccessControl.authorizationCheck #NOT_REQUIRED view
AbapCatalog.sqlViewName PBILLGDOCPROCFM3 view
AbapCatalog.preserveKey true view

Fields (8)

KeyFieldSource TableSource FieldDescription
KEY LevelM3Document PrecedingDocument
KEY LevelM3DocumentItem PrecedingDocumentItem
KEY LevelM2Document LevelM2Document
KEY LevelM2DocumentItem LevelM2DocumentItem
KEY LevelM2DocumentCategory LevelM2DocumentCategory
KEY BillingDocument BillingDocument
BillingDocumentType BillingDocumentType
SalesOrganization LevelM2 SalesOrganization
@ClientHandling.algorithm: #SESSION_VARIABLE 
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #XL

@VDM.private: true
@VDM.viewType: #CONSUMPTION
@AccessControl.authorizationCheck: #NOT_REQUIRED
@AbapCatalog.sqlViewName: 'PBILLGDOCPROCFM3'
@AbapCatalog.preserveKey:true 

define view P_BillingDocProcFlowM3
  as select distinct from P_BillingDocProcFlowM2 as LevelM2  --> Level -2
    inner join   I_SDDocumentProcessFlow    as LevelM3 --> Level Minus3
    on    LevelM3.SubsequentDocument       = LevelM2.LevelM2Document
    and   LevelM3.SubsequentDocumentItem   = LevelM2.LevelM2DocumentItem        
    and(  LevelM3.PrecedingDocumentCategory = 'C'  --> Order
    or    LevelM3.PrecedingDocumentCategory = 'M'  --> Invoice  
    )
left outer to one join 
  I_SalesDocumentBasic as SalesDocument
  on LevelM3.PrecedingDocument   = SalesDocument.SalesDocument       
{ 
           
      //Key

  key PrecedingDocument         as LevelM3Document,
  key PrecedingDocumentItem     as LevelM3DocumentItem,
  
  key case 
    when PrecedingDocumentCategory = 'M'
        then 'MREF'   --> allow assignmet to 'Reference' lane
    else 
      PrecedingDocumentCategory
    end as LevelM3DocumentCategory,    

  key LevelM2Document,
  key LevelM2DocumentItem,   
  key LevelM2DocumentCategory,

      //Billing Document

  key BillingDocument,
      
      BillingDocumentType,
      
//Order relevant for Project e.g Professional Service

   case when
    (
     SalesDocument._SalesDocumentType.OrderTypeForBillingRequest != ' ' or
     SalesDocument._SalesDocumentType.SalesDocumentProcessingType = 'P'   --> Professional Service
      )
    then
    'X'
    else
    ''
    end as SalesOrderIsProjectBased,          

    //Organization

    LevelM2.SalesOrganization
      
}
where LevelM2DocumentCategory = 'H'   --> Returns
or    LevelM2DocumentCategory = 'J'   --> Delivery
or    LevelM2DocumentCategory = 'K'   ---> Credit Memo Request
or    LevelM2DocumentCategory = 'L'   ---> Debit Memo Request