P_EBOC_MaxOrdKeyStatusByPeriod

DDL: P_EBOC_MAXORDKEYSTATUSBYPERIOD SQL: PEBOCMAXORDKYSTS Type: view COMPOSITE

P_EBOC_MaxOrdKeyStatusByPeriod is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_FiscalYearPeriodForLedger, I_StatusObjectStatusChange_2, I_SystemStatus) and exposes 2 fields with key field StatusCode.

Data Sources (3)

SourceAliasJoin Type
I_FiscalYearPeriodForLedger FiscalYearPeriodForLedger inner
I_StatusObjectStatusChange_2 StatusChange from
I_SystemStatus SystemStatus inner

Parameters (4)

NameTypeDefault
P_StatusObject j_objnr
P_Ledger fins_ledger
P_CompanyCode fis_bukrs
P_ToFiscalYearPeriod fins_fyearperiod

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName PEBOCMAXORDKYSTS view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.viewType #COMPOSITE view
VDM.private true view

Fields (2)

KeyFieldSource TableSource FieldDescription
KEY StatusCode I_StatusObjectStatusChange_2 StatusCode
MaxObjectStatusChangeNumber
@AbapCatalog.sqlViewName: 'PEBOCMAXORDKYSTS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE

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

define view P_EBOC_MaxOrdKeyStatusByPeriod
  with parameters
    P_StatusObject       : j_objnr,
    P_Ledger             : fins_ledger,
    P_CompanyCode        : fis_bukrs,
    @Semantics.fiscal.yearPeriod: true
    P_ToFiscalYearPeriod : fins_fyearperiod
  as select from I_StatusObjectStatusChange_2 as StatusChange
    inner join   I_SystemStatus               as SystemStatus              on SystemStatus.SystemStatus = StatusChange.StatusCode
    inner join   I_FiscalYearPeriodForLedger  as FiscalYearPeriodForLedger on  FiscalYearPeriodForLedger.FiscalYearPeriod = :P_ToFiscalYearPeriod
                                                                           and FiscalYearPeriodForLedger.CompanyCode      = :P_CompanyCode
                                                                           and FiscalYearPeriodForLedger.Ledger           = :P_Ledger
{
  key StatusChange.StatusCode,

      max(StatusChange.StatusObjectStatusChangeNumber) as MaxObjectStatusChangeNumber // Get the highest Change Number per Object and Code

}
where
       StatusChange.StatusObject   =  :P_StatusObject
  and  StatusChange.LastChangeDate <= FiscalYearPeriodForLedger.FiscalPeriodEndDate
  and  SystemStatus.StatusIsHidden =  '' // Exclude hidden statuses

  and(
       StatusChange.StatusCode     =  'I0042' // Partially Released

    or StatusChange.StatusCode     =  'I0002' // Released

    or StatusChange.StatusCode     =  'I0009' // Confirmed

    or StatusChange.StatusCode     =  'I0012' // Delivered

    or StatusChange.StatusCode     =  'I0045' // Technically Completed

    or StatusChange.StatusCode     =  'I0046' // Closed

    or StatusChange.StatusCode     =  'I0076' // Deletion Flag

  )
group by
  StatusChange.StatusCode
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_FISCALYEARPERIODFORLEDGER",
"I_STATUSOBJECTSTATUSCHANGE_2",
"I_SYSTEMSTATUS"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/