P_SLSORDPROCFLOW20

CDS View

Sales Order Process Flow: Level +2 Sales & Distribution

P_SLSORDPROCFLOW20 is a CDS View in S/4HANA. Sales Order Process Flow: Level +2 Sales & Distribution. It contains 3 fields. 1 CDS views read from this table.

CDS Views using this table (1)

ViewTypeJoinVDMDescription
P_SlsOrdProcFlow30 view from CONSUMPTION Sales Order Process Flow: Level +3 Sales & Distribution

Fields (3)

KeyField CDS FieldsUsed in Views
DistributionChannel DistributionChannel 1
OrganizationDivision OrganizationDivision 1
SalesOrganization SalesOrganization 1
@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: 'PSLSORDPROCF20'
@AbapCatalog.preserveKey:true 

define view P_SlsOrdProcFlow20
 as select from   P_SlsOrdProcFlow10      as Level1
 inner join       I_SDDocumentProcessFlow as Level2
on 
     Level1.Level1Document         = Level2.PrecedingDocument
and  Level1.Level1DocumentCategory = Level2.PrecedingDocumentCategory
and  Level1.Level1DocumentItem     = Level2.PrecedingDocumentItem
and ( Level2.SubsequentDocumentCategory = 'J' or   --> Delivery
      Level2.SubsequentDocumentCategory = 'T' or   --> Returns Delivery 
      Level2.SubsequentDocumentCategory = 'M' or   --> Invoice
      Level2.SubsequentDocumentCategory = 'U' or   --> Pro Forma Invoice      
      Level2.SubsequentDocumentCategory = 'O' or   --> Credit Memo
      Level2.SubsequentDocumentCategory = 'P' or   --> Debit Memo
      Level2.SubsequentDocumentCategory = 'C' or   --> Order
      Level2.SubsequentDocumentCategory = 'I' or   --> Order w/o charge
      Level2.SubsequentDocumentCategory = 'K' or   --> Credit Memo Request  
      Level2.SubsequentDocumentCategory = 'L' or   --> Debit Memo Request  
      Level2.SubsequentDocumentCategory = '5' or   --> Intercompany Invoice
      Level2.SubsequentDocumentCategory = '6' or   --> Intercompany Credit Memo
      Level2.SubsequentDocumentCategory = 'H' or   --> Customer Return 
      Level2.SubsequentDocumentCategory = 'EBDR' ) --> Billing Document Request
      
left outer to one join 
I_SalesDocumentBasic as SalesDocument
  on Level2.SubsequentDocument         = SalesDocument.SalesDocument     
left outer to one join 
I_BillingDocument as BillingDocument
  on Level2.SubsequentDocument         = BillingDocument.BillingDocument           
{
   //Key

   key Level2.SubsequentDocument     as Level2Document,
   key Level2.SubsequentDocumentItem as Level2DocumentItem,
   key Level1Document,
   key Level1DocumentItem,
       
   //SalesOrder

   key SalesOrder,
   SalesOrderType,   
      
   //Category 

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

   Level1.SalesOrganization     as SalesOrganization, 
   Level1.DistributionChannel   as DistributionChannel,
   Level1.OrganizationDivision  as OrganizationDivision
       
 }
where (( SalesOrderIsProjectBased  = ' '    and 
        (Level1DocumentCategory    = 'J' or   --> Delivery
         Level1DocumentCategory    = 'M' or   --> Invoice
         Level1DocumentCategory    = '5' or   --> Intercompany Invoice
         Level1DocumentCategory    = 'O' or   --> Credit Memo
         Level1DocumentCategory    = '6' or   --> Intercompany Credit Memo
         Level1DocumentCategory    = 'P' or   --> Debit Memo   
         Level1DocumentCategory   = 'PBRQ' )) --> Project Billing Request    
       or
       ( SalesOrderIsProjectBased = 'X' and 
       ( Level1DocumentCategory   = 'J' or    --> Delivery
         Level1DocumentCategory   = 'M' or    --> Invoice
         Level1DocumentCategory   = '5' or    --> Intercompany Invoice
         Level1DocumentCategory   = 'O' or    --> Credit Memo         
         Level1DocumentCategory   = '6' or    --> Intercompany Credit Memo
         Level1DocumentCategory   = 'P' or    --> Debit Memo         
         Level1DocumentCategory   = 'L' or    --> Debit Memo Request 
         Level1DocumentCategory   = 'PBRQ' )) --> Project Billing Request  
)