P_CustRetProcFlowM1

DDL: P_CUSTRETPROCFLOWM1 SQL: PCUSTRETPROCFM1 Type: view CONSUMPTION Package: ODATA_SD_CRET_PROCESSFLOW

Customer Return Process Flow: Level -1 Sales & Distribution

P_CustRetProcFlowM1 is a Consumption CDS View that provides data about "Customer Return Process Flow: Level -1 Sales & Distribution" in SAP S/4HANA. It reads from 3 data sources (P_CustRetProcFlowMIHR, I_SDDocumentProcessFlow, P_CustRetProcFlowMIHR) and exposes 14 fields with key fields LevelM1Document, CustomerReturn, CustomerReturn. Part of development package ODATA_SD_CRET_PROCESSFLOW.

Data Sources (3)

SourceAliasJoin Type
P_CustRetProcFlowMIHR LevelM1 from
I_SDDocumentProcessFlow LevelM1 inner
P_CustRetProcFlowMIHR LevelM1 union_all

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

Fields (14)

KeyFieldSource TableSource FieldDescription
KEY LevelM1Document P_CustRetProcFlowMIHR PrecedingDocument
KEY CustomerReturn CustomerReturn
CustomerReturnType Level0 CustomerReturnType
SDDocumentCategory Level0 SDDocumentCategory
SalesOrganization Level0 SalesOrganization
DistributionChannel Level0 DistributionChannel
PrecedingDocumentasLevelM1Document
KEY CustomerReturn CustomerReturn
LevelM1DocumentCategory P_CustRetProcFlowMIHR PrecedingDocumentCategory
CustomerReturnType P_CustRetProcFlowMIHR CustomerReturnType
SDDocumentCategory P_CustRetProcFlowMIHR SDDocumentCategory
SalesOrganization P_CustRetProcFlowMIHR SalesOrganization
DistributionChannel P_CustRetProcFlowMIHR DistributionChannel
OrganizationDivision P_CustRetProcFlowMIHR 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: 'PCUSTRETPROCFM1'

define view P_CustRetProcFlowM1 as 
select distinct from P_CustRetProcFlow0   as Level0       --- focus process step, level 0

inner join I_SDDocumentProcessFlow        as LevelM1      --- preceding process step, level minus 1
 on  Level0.CustomerReturn = LevelM1.SubsequentDocument
 and ( LevelM1.PrecedingDocumentCategory = 'C'         --- Sales Order
    or LevelM1.PrecedingDocumentCategory = 'M'         --- Customer Invoice
    or LevelM1.PrecedingDocumentCategory = 'I' )       --- Sales Order free of Charge

{
    //Key

    key LevelM1.PrecedingDocument as LevelM1Document,
    //Customer Return,

    key CustomerReturn,
    
    //Category

    case
    when LevelM1.PrecedingDocumentCategory = 'M' 
      then 'MREF'   --> allow assignmet to 'Reference' lane
    when PrecedingDocumentCategory = 'I' 
      then 'IREF'   --> allow assignmet to 'Reference' lane     
    else 
      LevelM1.PrecedingDocumentCategory
    end                            as LevelM1DocumentCategory,
    
    Level0.CustomerReturnType,    
    Level0.SDDocumentCategory,
    
    //Organization

    Level0.SalesOrganization,
    Level0.DistributionChannel,
    Level0.OrganizationDivision
}  
union all
  select from P_CustRetProcFlowMIHR as LevelM1
{
    key LevelM1.PrecedingDocument as LevelM1Document,
    key CustomerReturn,
    
    LevelM1.PrecedingDocumentCategory as LevelM1DocumentCategory,
    
    LevelM1.CustomerReturnType,    
    LevelM1.SDDocumentCategory,
    
    //Organization

    LevelM1.SalesOrganization,
    LevelM1.DistributionChannel,
    LevelM1.OrganizationDivision
}