P_EBPC_MAXORDERSTATUSBYPERIOD

CDS View

Event-Based Max Order Status By Period

P_EBPC_MAXORDERSTATUSBYPERIOD is a CDS View in S/4HANA. Event-Based Max Order Status By Period. 1 CDS views read from this table.

CDS Views using this table (1)

ViewTypeJoinVDMDescription
P_EBPC_OrderStatusByPeriod view inner COMPOSITE Event-Based Order Status By Period
@AbapCatalog.sqlViewName: 'PEBPCMAXORDSTAT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE

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

define view P_EBPC_MaxOrderStatusByPeriod
  with parameters
    @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
{
  key FiscalYearPeriodForLedger.Ledger,
  key FiscalYearPeriodForLedger.CompanyCode,
  key StatusChange.StatusObject,
  key StatusChange.StatusCode,
      
      max(StatusChange.StatusObjectStatusChangeNumber) as MaxObjectStatusChangeNumber // Get the highest Change Number per Object and Code

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

group by
  FiscalYearPeriodForLedger.Ledger,
  FiscalYearPeriodForLedger.CompanyCode,
  StatusChange.StatusObject,
  StatusChange.StatusCode