P_InternalOrderSystemStatus is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_InternalOrder, I_InternalOrderSystemStatus, I_SystemStatus) and exposes 7 fields with key fields InternalOrder, SystemStatus. It has 2 associations to related views.
@AccessControl.authorizationCheck: #NOT_REQUIRED@VDM: {
viewType: #COMPOSITE,
private: true
}defineviewentity P_InternalOrderSystemStatus
asselectfrom I_SystemStatus as _SystemStatus
crossjoin I_InternalOrderSystemStatus as _InternalOrderSystemStatus
innerjoin I_InternalOrder as _InternalOrder on _InternalOrder.ControllingObject = _InternalOrderSystemStatus.ControllingObject
association [0..1] to I_StatusObjectStatusChange as _StatusObjectStatusChange on _StatusObjectStatusChange.StatusObject = _InternalOrder.ControllingObject
and _StatusObjectStatusChange.StatusCode = _SystemStatus.SystemStatus
and _StatusObjectStatusChange.StatusObjectStatusChangeNumber = _InternalOrderSystemStatus.StatusObjectStatusChangeNumber
association [0..1] to I_UserContactCard as _LastChangedByUser on $projection.LastChangedByUser = _LastChangedByUser.ContactCardID
{
key _InternalOrder.InternalOrder,
key _SystemStatus.SystemStatus,
_SystemStatus._SystemStatusText[ 1: Language = $session.system_language ].SystemStatusShortName,
_SystemStatus._SystemStatusText[ 1: Language = $session.system_language ].SystemStatusName,
_InternalOrderSystemStatus.StatusIsInactive,
_InternalOrder.ControllingObject,
case _InternalOrder._SystemStatus.ControllingObjectStatus
when _SystemStatus.SystemStatus
thencast( '3' as fin_io_status_criticality preserving type )
elsecast( '0' as fin_io_status_criticality preserving type )
endas IntOrdSystemStatusCriticality,
case _SystemStatus.SystemStatus
when 'I0001'
thencast ( '00000000' as fin_io_status_planned_date )
when 'I0002'
thencast ( _InternalOrder.IntOrderPlannedReleaseDate as fin_io_status_planned_date )
when 'I0045'
thencast ( _InternalOrder.IntOrderPlannedCompletionDate as fin_io_status_planned_date )
when 'I0046'
thencast ( _InternalOrder.IntOrderPlannedClosingDate as fin_io_status_planned_date )
endas InternalOrderStatusPlannedDate,
case _SystemStatus.SystemStatus
when 'I0001'
thencast ( _InternalOrder.CreationDate as fin_io_status_reached_date )
when 'I0002'
thencast ( _InternalOrder.InternalOrderReleaseDate as fin_io_status_reached_date )
when 'I0045'
thencast ( _InternalOrder.InternalOrderCompletionDate as fin_io_status_reached_date )
when 'I0046'
thencast ( _InternalOrder.InternalOrderClosingDate as fin_io_status_reached_date )
endas InternalOrderStatusReachedDate,
casewhen _SystemStatus.SystemStatus = 'I0001' and _InternalOrder.CreationDate <> '00000000'
thencast (_StatusObjectStatusChange.LastChangedByUser as aufaenam preserving type )
when _SystemStatus.SystemStatus = 'I0002' and _InternalOrder.InternalOrderReleaseDate <> '00000000'
thencast (_StatusObjectStatusChange.LastChangedByUser as aufaenam preserving type )
when _SystemStatus.SystemStatus = 'I0045' and _InternalOrder.InternalOrderCompletionDate <> '00000000'
thencast (_StatusObjectStatusChange.LastChangedByUser as aufaenam preserving type )
when _SystemStatus.SystemStatus = 'I0046' and _InternalOrder.InternalOrderClosingDate <> '00000000'
thencast (_StatusObjectStatusChange.LastChangedByUser as aufaenam preserving type )
elsecast ( ' ' as aufaenam )
endas LastChangedByUser,
_LastChangedByUser
}
where
_SystemStatus.SystemStatus = 'I0001' //Status: Created
or _SystemStatus.SystemStatus = 'I0002' //Status: Released
or _SystemStatus.SystemStatus = 'I0045' //Status: Technically completed
or _SystemStatus.SystemStatus = 'I0046' //Status: Closed
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_INTERNALORDER",
"I_INTERNALORDERSYSTEMSTATUS",
"I_STATUSOBJECTSTATUSCHANGE",
"I_SYSTEMSTATUS",
"I_SYSTEMSTATUSTEXT"
],
"ASSOCIATED":
[
"I_USERCONTACTCARD"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/