P_CustRetProcFlow20

DDL: P_CUSTRETPROCFLOW20 SQL: PCUSTRETPROCF20 Type: view CONSUMPTION Package: ODATA_SD_CRET_PROCESSFLOW

Customer Return Process Flow: Level +2 Sales & Distribution

P_CustRetProcFlow20 is a Consumption CDS View that provides data about "Customer Return Process Flow: Level +2 Sales & Distribution" in SAP S/4HANA. It reads from 2 data sources (P_CustRetProcFlow10, I_SDDocumentProcessFlow) and exposes 11 fields with key fields Level2Document, Level2DocumentItem, Level1Document, Level1DocumentItem. Part of development package ODATA_SD_CRET_PROCESSFLOW.

Data Sources (2)

SourceAliasJoin Type
P_CustRetProcFlow10 Level1 from
I_SDDocumentProcessFlow Level2 inner

Annotations (8)

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 PCUSTRETPROCF20 view

Fields (11)

KeyFieldSource TableSource FieldDescription
KEY Level2Document
KEY Level2DocumentItem I_SDDocumentProcessFlow SubsequentDocumentItem
KEY Level1Document P_CustRetProcFlow10 Level1Document
KEY Level1DocumentItem P_CustRetProcFlow10 Level1DocumentItem
CustomerReturn P_CustRetProcFlow10 CustomerReturn
CustomerReturnType P_CustRetProcFlow10 CustomerReturnType
Level2DocumentCategory I_SDDocumentProcessFlow SubsequentDocumentCategory
Level1DocumentCategory P_CustRetProcFlow10 Level1DocumentCategory
SalesOrganization P_CustRetProcFlow10 SalesOrganization
DistributionChannel P_CustRetProcFlow10 DistributionChannel
OrganizationDivision P_CustRetProcFlow10 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: 'PCUSTRETPROCF20'

define view P_CustRetProcFlow20
as select from P_CustRetProcFlow10     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 = 'O'   --> Credit Memo 
  or Level2.SubsequentDocumentCategory = 'J'   --> Outbound Delivery    
  or Level2.SubsequentDocumentCategory = 'M'   --> Customer Invoice
  or Level2.SubsequentDocumentCategory = 'U'   --> Pro Forma Invoice
     )     

left outer to one join I_DeliveryDocument as DeliveryDoc
  on Level2.SubsequentDocument         = DeliveryDoc.DeliveryDocument
 and Level2.SubsequentDocumentCategory = DeliveryDoc.SDDocumentCategory

{
    //Key

    key cast(Level2.SubsequentDocument          as preced_doc)   as Level2Document,
    key Level2.SubsequentDocumentItem                            as Level2DocumentItem,
    key Level1.Level1Document,
    key Level1.Level1DocumentItem,
    
    //Customer Return

    Level1.CustomerReturn,
   
    //Category

    Level1.CustomerReturnType,
    
    Level2.SubsequentDocumentCategory as Level2DocumentCategory,
    Level1.Level1DocumentCategory,
   
    //Organization

    Level1.SalesOrganization,
    Level1.DistributionChannel,
    Level1.OrganizationDivision,
    
    //Relevance for planned subsequent processing

    case 
    when( DeliveryDoc.OverallDelivReltdBillgStatus = 'A' or
          DeliveryDoc.OverallDelivReltdBillgStatus = 'B'  )
    then
      'X'
    else
      ''
    end                               as BillingDocumentIsRequired        
 }   
 where Level1.Level1DocumentCategory = 'K'   --> Credit Memo Request 
    or Level1.Level1DocumentCategory = 'I'   --> Order w/o charge as Replacement Order
    or Level1.Level1DocumentCategory = 'J'   --> Outbound Delivery
    or Level1.Level1DocumentCategory = 'T'   --> Returns Delivery
    
/* union all select from    P_CustRetProcFlow10     as Level1
 inner join P_CustRetProcFlow05 as InspectionDoc
    on InspectionDoc.CustomerReturn = Level1.CustomerReturn
    and InspectionDoc.Level1DocumentItem = Level1.PrecedingDocumentItem
    and InspectionDoc.ProductIsInspectedAtCustSite = ''
 {
    //Key

    key cast(InspectionDoc.Level1Document as preced_doc)     as Level2Document,
    key InspectionDoc.Level1DocumentItem                     as Level2DocumentItem,
    key Level1.Level1Document,
    key Level1.Level1DocumentItem,
    
    //Customer Return

    Level1.CustomerReturn,
   
    //Category

    Level1.CustomerReturnType,
    
    InspectionDoc.Level1DocumentCategory as Level2DocumentCategory,
    Level1.Level1DocumentCategory,
   
    //Organization

    Level1.SalesOrganization,
    Level1.DistributionChannel,
    Level1.OrganizationDivision,
    
    //Relevance for planned subsequent processing

    '' as BillingDocumentIsRequired        
 } 
 where Level1.Level1DocumentCategory = 'T' */