P_InternalOrderSystemStatus

DDL: P_INTERNALORDERSYSTEMSTATUS Type: view_entity COMPOSITE

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.

Data Sources (3)

SourceAliasJoin Type
I_InternalOrder _InternalOrder inner
I_InternalOrderSystemStatus _InternalOrderSystemStatus cross
I_SystemStatus _SystemStatus from

Associations (2)

CardinalityTargetAliasCondition
[0..1] I_StatusObjectStatusChange _StatusObjectStatusChange _StatusObjectStatusChange.StatusObject = _InternalOrder.ControllingObject and _StatusObjectStatusChange.StatusCode = _SystemStatus.SystemStatus and _StatusObjectStatusChange.StatusObjectStatusChangeNumber = _InternalOrderSystemStatus.StatusObjectStatusChangeNumber
[0..1] I_UserContactCard _LastChangedByUser $projection.LastChangedByUser = _LastChangedByUser.ContactCardID

Annotations (3)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.viewType #COMPOSITE view
VDM.private true view

Fields (7)

KeyFieldSource TableSource FieldDescription
KEY InternalOrder I_InternalOrder InternalOrder
KEY SystemStatus I_SystemStatus SystemStatus
SystemStatusShortName
SystemStatusName
StatusIsInactive I_InternalOrderSystemStatus StatusIsInactive
ControllingObject I_InternalOrder ControllingObject
_LastChangedByUser _LastChangedByUser
@AccessControl.authorizationCheck: #NOT_REQUIRED

@VDM: {
  viewType: #COMPOSITE,
  private: true
}

define view entity P_InternalOrderSystemStatus
  as select from I_SystemStatus              as _SystemStatus
    cross join   I_InternalOrderSystemStatus as _InternalOrderSystemStatus
    inner join   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
        then cast( '3' as fin_io_status_criticality preserving type )
        else cast( '0' as fin_io_status_criticality preserving type )
      end as IntOrdSystemStatusCriticality,

      case _SystemStatus.SystemStatus
        when 'I0001'
          then cast ( '00000000' as fin_io_status_planned_date )
        when 'I0002'
          then cast ( _InternalOrder.IntOrderPlannedReleaseDate as fin_io_status_planned_date )
        when 'I0045'
          then cast ( _InternalOrder.IntOrderPlannedCompletionDate as fin_io_status_planned_date )
        when 'I0046'
          then cast ( _InternalOrder.IntOrderPlannedClosingDate as fin_io_status_planned_date )
      end as InternalOrderStatusPlannedDate,

      case _SystemStatus.SystemStatus
        when 'I0001'
          then cast ( _InternalOrder.CreationDate as fin_io_status_reached_date )
        when 'I0002'
          then cast ( _InternalOrder.InternalOrderReleaseDate as fin_io_status_reached_date )
        when 'I0045'
          then cast ( _InternalOrder.InternalOrderCompletionDate as fin_io_status_reached_date )
        when 'I0046'
          then cast ( _InternalOrder.InternalOrderClosingDate as fin_io_status_reached_date )
      end as InternalOrderStatusReachedDate,

      case
        when _SystemStatus.SystemStatus = 'I0001' and _InternalOrder.CreationDate  <> '00000000'
          then cast (_StatusObjectStatusChange.LastChangedByUser as aufaenam preserving type )
        when _SystemStatus.SystemStatus = 'I0002' and _InternalOrder.InternalOrderReleaseDate <> '00000000'
          then cast (_StatusObjectStatusChange.LastChangedByUser as aufaenam preserving type )
        when _SystemStatus.SystemStatus = 'I0045' and _InternalOrder.InternalOrderCompletionDate <> '00000000'
          then cast (_StatusObjectStatusChange.LastChangedByUser as aufaenam preserving type )
        when _SystemStatus.SystemStatus = 'I0046' and _InternalOrder.InternalOrderClosingDate <> '00000000'
          then cast (_StatusObjectStatusChange.LastChangedByUser as aufaenam preserving type )
        else cast ( ' ' as aufaenam )
      end as 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":""
}
}*/