P_SlsOrdProcFlow30

DDL: P_SLSORDPROCFLOW30 SQL: PSLSORDPROCF30 Type: view CONSUMPTION Package: ODATA_SD_SO_PROCESSFLOW

Sales Order Process Flow: Level +3 Sales & Distribution

P_SlsOrdProcFlow30 is a Consumption CDS View that provides data about "Sales Order Process Flow: Level +3 Sales & Distribution" in SAP S/4HANA. It reads from 2 data sources (P_SlsOrdProcFlow20, I_SDDocumentProcessFlow) and exposes 10 fields with key fields Level3Document, Level3DocumentItem, Level2Document, Level2DocumentItem, SalesOrder. Part of development package ODATA_SD_SO_PROCESSFLOW.

Data Sources (2)

SourceAliasJoin Type
P_SlsOrdProcFlow20 Level2 from
I_SDDocumentProcessFlow Level3 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 PSLSORDPROCF30 view
AbapCatalog.preserveKey true view

Fields (10)

KeyFieldSource TableSource FieldDescription
KEY Level3Document I_SDDocumentProcessFlow SubsequentDocument
KEY Level3DocumentItem I_SDDocumentProcessFlow SubsequentDocumentItem
KEY Level2Document Level2Document
KEY Level2DocumentItem Level2DocumentItem
KEY SalesOrder SalesOrder
SalesOrderType SalesOrderType
Level2DocumentCategory Level2DocumentCategory
SalesOrganization P_SlsOrdProcFlow20 SalesOrganization
DistributionChannel P_SlsOrdProcFlow20 DistributionChannel
OrganizationDivision P_SlsOrdProcFlow20 OrganizationDivision
@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: 'PSLSORDPROCF30'
@AbapCatalog.preserveKey:true 

define view P_SlsOrdProcFlow30
as select from P_SlsOrdProcFlow20          as Level2
   inner join  I_SDDocumentProcessFlow     as Level3
on 
     Level2.Level2Document = Level3.PrecedingDocument
and  Level2.Level2DocumentCategory = Level3.PrecedingDocumentCategory
and  Level2.Level2DocumentItem = Level3.PrecedingDocumentItem
and (
       Level3.SubsequentDocumentCategory = 'M' or   --> Invoice
       Level3.SubsequentDocumentCategory = 'U' or   --> Pro Forma Invoice       
       Level3.SubsequentDocumentCategory = 'O' or   --> Credit Memo
       Level3.SubsequentDocumentCategory = 'P' or   --> Debit Memo
       Level3.SubsequentDocumentCategory = 'I' or   --> Order w/o charge
       Level3.SubsequentDocumentCategory = 'K' or   --> Credit Memo Request  
       Level3.SubsequentDocumentCategory = 'L' or   --> Debit Memo Request  
       Level3.SubsequentDocumentCategory = '5' or   --> Intercompany Invoice
       Level3.SubsequentDocumentCategory = '6' or   --> Intercompany Credit Memo
       Level3.SubsequentDocumentCategory = 'H'      --> Customer Return
      )
   left outer to one join 
      I_SalesDocumentBasic as SalesDocument  
      on Level3.SubsequentDocument         = SalesDocument.SalesDocument            
{
   //Key

   key Level3.SubsequentDocument     as Level3Document,
   key Level3.SubsequentDocumentItem as Level3DocumentItem,
   key Level2Document,
   key Level2DocumentItem,
   
   //SalesOrder

   key SalesOrder,
   SalesOrderType,
   
    //Category 

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

   Level2.SalesOrganization     as SalesOrganization,
   Level2.DistributionChannel   as DistributionChannel,
   Level2.OrganizationDivision  as OrganizationDivision
          
 }
 where ( Level2DocumentCategory = 'M' or   --> Invoice
         Level2DocumentCategory = '5' or   --> Intercompany Invoice
         Level2DocumentCategory = 'O' or   --> Credit Memo
         Level2DocumentCategory = '6' or   --> Intercompany Credit Memo
         Level2DocumentCategory = 'P' or   --> Debit Memo
         Level2DocumentCategory = 'EBDR' )  --> Billing Document Request