P_ChmlCmplncReqMigration

DDL: P_CHMLCMPLNCREQMIGRATION SQL: PCCMPLCNREQMIG Type: view COMPOSITE

P_ChmlCmplncReqMigration is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_ChmlCmplncReq, I_ChmlCmplncReq) and exposes 14 fields with key field ChmlCmplncRequestUUID.

Data Sources (2)

SourceAliasJoin Type
I_ChmlCmplncReq _ChmlCmplncReqSell inner
I_ChmlCmplncReq ChmlCmplncReqProduce from

Annotations (9)

NameValueLevelField
AbapCatalog.sqlViewName PCCMPLCNREQMIG view
AbapCatalog.compiler.compareFilter true view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.authorizationCheck #NOT_ALLOWED view
ObjectModel.usageType.dataClass #MASTER view
ObjectModel.usageType.sizeCategory #M view
ObjectModel.usageType.serviceQuality #B view
VDM.viewType #COMPOSITE view
VDM.private true view

Fields (14)

KeyFieldSource TableSource FieldDescription
KEY ChmlCmplncRequestUUID I_ChmlCmplncReq ChmlCmplncRequestUUID
ChmlCmplncReqCmplncProc I_ChmlCmplncReq ChmlCmplncReqCmplncProc
ChmlCmplncRequestOriginType I_ChmlCmplncReq ChmlCmplncRequestOriginType
ChmlCmplncReqOriginProc I_ChmlCmplncReq ChmlCmplncReqOriginProc
ChmlCmplncRequestPrgrsStatus I_ChmlCmplncReq ChmlCmplncRequestPrgrsStatus
ChmlCmplncBusinessProcess I_ChmlCmplncReq ChmlCmplncBusinessProcess
Material I_ChmlCmplncReq Material
ChmlCmplncInfoType
ChmlCmplncInfoUUID I_ChmlCmplncReq ChmlCmplncInfoUUID
ChmlCmplncProdUUID I_ChmlCmplncReq ChmlCmplncProdUUID
CreationUTCDateTime I_ChmlCmplncReq CreationUTCDateTime
CreatedByUser I_ChmlCmplncReq CreatedByUser
LastChangeUTCDateTime I_ChmlCmplncReq LastChangeUTCDateTime
LastChangedByUser I_ChmlCmplncReq LastChangedByUser
@AbapCatalog.sqlViewName: 'PCCMPLCNREQMIG'
@AbapCatalog.compiler.compareFilter: true

@ClientHandling.algorithm: #SESSION_VARIABLE

@AccessControl.authorizationCheck: #NOT_ALLOWED

@ObjectModel:
{
  usageType:
  {
    dataClass: #MASTER,
    sizeCategory: #M,
    serviceQuality: #B
  }
}

@VDM.viewType: #COMPOSITE
@VDM.private: true

-------------------------------------------------------------
-- IMPORTANT: View may not be changed after initial delivery!
-------------------------------------------------------------

define view P_ChmlCmplncReqMigration

  as select from I_ChmlCmplncReq as ChmlCmplncReqProduce

    inner join   I_ChmlCmplncReq as _ChmlCmplncReqSell on  _ChmlCmplncReqSell.Material                     = ChmlCmplncReqProduce.Material
                                                       and _ChmlCmplncReqSell.ChmlCmplncReqCmplncProc      = ChmlCmplncReqProduce.ChmlCmplncReqCmplncProc
                                                       and _ChmlCmplncReqSell.ChmlCmplncRequestOriginType  = ChmlCmplncReqProduce.ChmlCmplncRequestOriginType
                                                       and _ChmlCmplncReqSell.ChmlCmplncBusinessProcess    = 'SELL'
    -- if corresponding "sell in" request is closed, close corresponding "produce in" request must be closed
                                                       and _ChmlCmplncReqSell.ChmlCmplncRequestPrgrsStatus = 'CLOSED'

{
  key ChmlCmplncReqProduce.ChmlCmplncRequestUUID,

      ChmlCmplncReqProduce.ChmlCmplncReqCmplncProc,
      ChmlCmplncReqProduce.ChmlCmplncRequestOriginType,
      ChmlCmplncReqProduce.ChmlCmplncReqOriginProc,
      ChmlCmplncReqProduce.ChmlCmplncRequestPrgrsStatus,
      ChmlCmplncReqProduce.ChmlCmplncBusinessProcess,
      ChmlCmplncReqProduce.Material,

      ChmlCmplncReqProduce._ChmlCmplncInfo.ChmlCmplncInfoType,

      case
        when ChmlCmplncReqProduce._ChmlCmplncInfo.ChmlCmplncInfoType = 'PP'
            and ( ChmlCmplncReqProduce.ChmlCmplncRequestPrgrsStatus = 'NEW' or ChmlCmplncReqProduce.ChmlCmplncRequestPrgrsStatus = 'INPROG'  )
          then '00' -- not yet executed
        else '01' -- Migration not needed/ already done
      end as StatusField,

      ChmlCmplncReqProduce.ChmlCmplncInfoUUID,
      ChmlCmplncReqProduce.ChmlCmplncProdUUID,

      ChmlCmplncReqProduce.CreationUTCDateTime,
      ChmlCmplncReqProduce.CreatedByUser,
      ChmlCmplncReqProduce.LastChangeUTCDateTime,
      ChmlCmplncReqProduce.LastChangedByUser
}
where
    ChmlCmplncReqProduce._ChmlCmplncInfo.ChmlCmplncInfoType = 'PP'
  and ChmlCmplncReqProduce.ChmlCmplncReqCmplncProc     = 'PMA'
  and ChmlCmplncReqProduce.ChmlCmplncRequestOriginType = 'MM'
  and ChmlCmplncReqProduce.ChmlCmplncBusinessProcess   = 'PRODUCE'