I_MaintOrderHasOpenMainWork is a Composite CDS View that provides data about "I_MaintOrderHasOpenMainWork" in SAP S/4HANA. It reads from 2 data sources (I_MaintenanceOrderOperation, I_MaintOperationExecStageCode) and exposes 2 fields with key field MaintenanceOrder.
@VDM.viewType: #COMPOSITE@AbapCatalog.sqlViewName: 'IPMORDERHASWORK'
@AbapCatalog.compiler.compareFilter: true@AbapCatalog.preserveKey: true@AccessControl.authorizationCheck: #NOT_REQUIRED@EndUserText.label: 'I_MaintOrderHasOpenMainWork'
@ClientHandling.algorithm: #SESSION_VARIABLE@ObjectModel.usageType.dataClass: #ORGANIZATIONAL@ObjectModel.usageType.serviceQuality: #X@ObjectModel.usageType.sizeCategory: #XLdefineview I_MaintOrderHasOpenMainWork
asselectfrom I_MaintenanceOrderOperation as _MaintenanceOrderOperation
innerjoin I_MaintOperationExecStageCode as _MaintOperationExecStageCode on _MaintenanceOrderOperation.MaintOperationExecStageCode = _MaintOperationExecStageCode.MaintOperationExecStageCode
and _MaintOperationExecStageCode.MaintOpExecStageGroupCode = 'MAIN'
leftouter to one join I_StatusObjectStatusBasic as _StatusObjectStatusBasic_del on _MaintenanceOrderOperation.MaintOrderOperationInternalID = _StatusObjectStatusBasic_del.StatusObject
and _StatusObjectStatusBasic_del.StatusCode = 'I0013' //Deleted
leftouter to one join I_StatusObjectStatusBasic as _StatusObjectStatusPCNF on _MaintenanceOrderOperation.MaintOrderOperationInternalID = _StatusObjectStatusPCNF.StatusObject
and _StatusObjectStatusPCNF.StatusCode = 'I0010' //Partially Confirmed
and _StatusObjectStatusPCNF.StatusIsInactive = ''
leftouter to one join I_StatusObjectStatusBasic as _StatusObjectStatusPWF on _MaintenanceOrderOperation.MaintOrderOperationInternalID = _StatusObjectStatusPWF.StatusObject
and _StatusObjectStatusPWF.StatusCode = 'IEAMP' //Planned work Finished
and _StatusObjectStatusPWF.StatusIsInactive = ''
leftouter to one join I_OperationControlProfile as _OperationControlProfile on _MaintenanceOrderOperation.OperationControlKey = _OperationControlProfile.OperationControlProfile
leftouter to one join I_MaintenanceOrderComponent_2 as _MaintenanceOrderComponent on _MaintenanceOrderComponent.MaintenanceOrder = _MaintenanceOrderOperation.MaintenanceOrder
and _MaintenanceOrderComponent.MaintenanceOrderOperation = _MaintenanceOrderOperation.MaintenanceOrderOperation
and _MaintenanceOrderComponent.ProductTypeCode = '2'
and _MaintenanceOrderComponent.IsDeleted = '' //lean service
{
key _MaintenanceOrderOperation.MaintenanceOrder,
max(
case//If confirmation is required and PWF is set -> NO ? YES
when ( _OperationControlProfile.ConfirmationIsRequired = 'X' and _StatusObjectStatusPWF.StatusIsInactive isnull) then 'X' //--
//If confirmation is optional and there is srv and PWF -> NO ? YES
when ( _OperationControlProfile.ConfirmationIsOptional = 'X' and _MaintenanceOrderComponent.MaintenanceOrderComponent isnotnulland _StatusObjectStatusPWF.StatusIsInactive isnull) then 'X' //--
//IF confirmation is optional and external processing = ‘+ ‘ and PWF -> NO ? YES
when ( _OperationControlProfile.ConfirmationIsOptional = 'X' and _OperationControlProfile.OperationExternalProcessing = '+' and _StatusObjectStatusPWF.StatusIsInactive isnull) then 'X' //--
//IF confirmation is optional there is no srv there is no external data and it IS PCNF -> YES ? NO
when ( _OperationControlProfile.ConfirmationIsOptional = 'X' and _MaintenanceOrderComponent.MaintenanceOrderComponent isnulland _OperationControlProfile.OperationExternalProcessing != '+' and _StatusObjectStatusPCNF.StatusIsInactive isnotnull) then 'X' //-- ???
//If confirmation isnot possible and there is srv and PWF -> NO ? YES
when ( _OperationControlProfile.ConfirmationIsNotPossible = 'X' and _MaintenanceOrderComponent.MaintenanceOrderComponent isnotnulland _StatusObjectStatusPWF.StatusIsInactive isnull) then 'X' //--
//If confirmation isnot possible and there is external data and PWF -> NO ? YES
when ( _OperationControlProfile.ConfirmationIsNotPossible = 'X'
and _StatusObjectStatusPWF.StatusIsInactive isnull) then '' //--
//IF confirmation isnot possible there is no srv there is no external data => NO
when ( _OperationControlProfile.ConfirmationIsNotPossible = 'X' and _MaintenanceOrderComponent.MaintenanceOrderComponent isnulland _OperationControlProfile.OperationExternalProcessing != '+' ) then '' //--
//Defaultwhen _StatusObjectStatusPWF.StatusIsInactive isnullthen ''
else ''
end
) as MaintOrdHasOpenMainWork,
_MaintenanceOrder
}
where
_StatusObjectStatusBasic_del.StatusIsInactive isnullgroupby
_MaintenanceOrderOperation.MaintenanceOrder