@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":""
}
}*/
Depth:
1
2
3
4
5
All
Reload
P_EBOC_MaxOrdKeyStatusByPeriod view