P_RSHOperationDurationInSecond

DDL: P_RSHOPERATIONDURATIONINSECOND SQL: PRSHOPDURINSEC Type: view CONSUMPTION

Maintenance Operations with Durations in Seconds

P_RSHOperationDurationInSecond is a Consumption CDS View that provides data about "Maintenance Operations with Durations in Seconds" in SAP S/4HANA. It reads from 3 data sources (I_LogisticsOrder, I_MaintOrderOperAndSubOper, I_MaintOrderOperPlanningValues) and exposes 19 fields with key fields MaintenanceOrder, MaintenanceOrderOperation, MaintenanceOrderSubOperation, MaintOrderRoutingNumber, MaintOrderOperationCounter. It has 2 associations to related views.

Data Sources (3)

SourceAliasJoin Type
I_LogisticsOrder _Order inner
I_MaintOrderOperAndSubOper Operations from
I_MaintOrderOperPlanningValues OperationValues inner

Associations (2)

CardinalityTargetAliasCondition
[0..1] I_WorkCenter _WorkCenter _WorkCenter.WorkCenterInternalID = Operations.OperationWorkCenterInternalID and _WorkCenter.WorkCenterTypeCode = Operations.OperationWorkCenterTypeCode
[0..1] I_SchedulingType _SchedulingType _Order.BasicSchedulingType = _SchedulingType.SchedulingType

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PRSHOPDURINSEC view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #CONSUMPTION view
ClientHandling.algorithm #SESSION_VARIABLE view
EndUserText.label Maintenance Operations with Durations in Seconds view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.usageType.serviceQuality #B view
ObjectModel.usageType.sizeCategory #XL view

Fields (19)

KeyFieldSource TableSource FieldDescription
KEY MaintenanceOrder I_MaintOrderOperAndSubOper MaintenanceOrder
KEY MaintenanceOrderOperation I_MaintOrderOperAndSubOper MaintenanceOrderOperation
KEY MaintenanceOrderSubOperation I_MaintOrderOperAndSubOper MaintenanceOrderSubOperation
KEY MaintOrderRoutingNumber I_MaintOrderOperAndSubOper MaintOrderRoutingNumber
KEY MaintOrderOperationCounter I_MaintOrderOperAndSubOper MaintOrderOperationCounter
WorkCenterInternalID I_MaintOrderOperAndSubOper OperationWorkCenterInternalID
NumberOfCapacities I_MaintOrderOperAndSubOper NumberOfCapacities
MaintOperationExecStageCode I_MaintOrderOperAndSubOper MaintOperationExecStageCode
MaintOrdOpProcessSubPhaseCode I_MaintOrderOperAndSubOper MaintOrdOpProcessSubPhaseCode
WorkCenter
BasicStartDate _MaintenanceOrder MaintOrdBasicStartDate
BasicEndDate _MaintenanceOrder MaintOrdBasicEndDate
LatestAcceptableCompletionDate _MaintenanceOrder LatestAcceptableCompletionDate
Priority _MaintenanceOrder MaintPriority
OrderType _MaintenanceOrder MaintenanceOrderType
dec240asOperationDuration
OperationDurationUnit
dec240asOperationPlannedWork
OperationPlannedWorkUnit
@AbapCatalog.sqlViewName: 'PRSHOPDURINSEC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'Maintenance Operations with Durations in Seconds'
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.usageType.serviceQuality: #B
@ObjectModel.usageType.sizeCategory: #XL

/*
CONTRACT**********************************************************************************************************************

Name:                       Read Maintenance Operations with duration and convert it to seconds
Specification:              This view reads the maintanance operations and converts its duration / work to seconds
Requires:                   NA
Ensures:                    Maintenance Operations are read and unit fields like duration and work are converted into seconds
Owners:                     TP
Contributors:               CF
Unit Test required Y/N:     Yes
Additional comments         Only relevant attributes for RSH Leveling are read

END OF CONTRACT***************************************************************************************************************
*/

define view P_RSHOperationDurationInSecond

  as select from I_MaintOrderOperAndSubOper     as Operations

    inner join   I_MaintOrderOperPlanningValues as OperationValues on  Operations.MaintOrderRoutingNumber    = OperationValues.MaintOrderRoutingNumber
                                                                   and Operations.MaintOrderOperationCounter = OperationValues.MaintOrderOperationCounter

    inner join   I_LogisticsOrder               as _Order          on _Order.OrderID = Operations.MaintenanceOrder

  association [0..1] to I_WorkCenter     as _WorkCenter     on  _WorkCenter.WorkCenterInternalID = Operations.OperationWorkCenterInternalID
                                                            and _WorkCenter.WorkCenterTypeCode   = Operations.OperationWorkCenterTypeCode

  association [0..1] to I_SchedulingType as _SchedulingType on  _Order.BasicSchedulingType = _SchedulingType.SchedulingType

{

  key     Operations.MaintenanceOrder,
  key     Operations.MaintenanceOrderOperation,
  key     Operations.MaintenanceOrderSubOperation,
  key     Operations.MaintOrderRoutingNumber,
  key     Operations.MaintOrderOperationCounter,
          Operations.OperationWorkCenterInternalID                                                                         as WorkCenterInternalID,

          Operations.NumberOfCapacities                                                                                    as NumberOfCapacities,
          
          Operations.MaintOperationExecStageCode                                                                           as MaintOperationExecStageCode,
          
          Operations.MaintOrdOpProcessSubPhaseCode                                                                         as MaintOrdOpProcessSubPhaseCode,                                            

          cast( _WorkCenter.WorkCenter as rsh_eam_work_center preserving type)                                             as WorkCenter,

          case when _SchedulingType.SchedulingIsPerformedBackward = ''
               then OperationValues.OpErlstSchedldExecStrtDte
               else OperationValues.OpLtstSchedldExecStrtDte end                                                           as PlannedStartDate,

          case when _SchedulingType.SchedulingIsPerformedBackward = ''
               then OperationValues.OpErlstSchedldExecStrtTme
               else OperationValues.OpLtstSchedldExecStrtTme end                                                           as PlannedStartTime,

          case when _SchedulingType.SchedulingIsPerformedBackward = ''
               then OperationValues.OpErlstSchedldExecEndDte
               else OperationValues.OpLtstSchedldExecEndDte end                                                            as PlannedEndDate,

          case when _SchedulingType.SchedulingIsPerformedBackward = ''
               then OperationValues.OpErlstSchedldExecEndTme
               else OperationValues.OpLtstSchedldExecEndTme end                                                            as PlannedEndTime,

          _MaintenanceOrder.MaintOrdBasicStartDate                                                                         as BasicStartDate,
          _MaintenanceOrder.MaintOrdBasicEndDate                                                                           as BasicEndDate,
          _MaintenanceOrder.LatestAcceptableCompletionDate                                                                 as LatestAcceptableCompletionDate,   
          
          _MaintenanceOrder.MaintPriority                                                                                  as Priority,
          _MaintenanceOrder.MaintenanceOrderType                                                                           as OrderType,

          cast( unit_conversion(
           QUANTITY =>  OperationValues.OperationDuration,
           SOURCE_UNIT =>  OperationValues.OperationDurationUnit,
           TARGET_UNIT => cast( 'S' as abap.unit(3) ),
           ERROR_HANDLING => 'SET_TO_NULL' ) as abap.dec(24,0) )                                                           as OperationDuration,

          'S'                                                                                                              as OperationDurationUnit,

          cast( unit_conversion(
            QUANTITY => OperationValues.OperationPlannedWork,
            SOURCE_UNIT =>  OperationValues.OperationPlannedWorkUnit,
            TARGET_UNIT => cast( 'S' as abap.unit(3) ),
            ERROR_HANDLING => 'SET_TO_NULL' ) as abap.dec(24,0) )                                                          as OperationPlannedWork,

          'S'                                                                                                              as OperationPlannedWorkUnit
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_LOGISTICSORDER",
"I_MAINTENANCEORDER",
"I_MAINTORDEROPERANDSUBOPER",
"I_MAINTORDEROPERPLANNINGVALUES",
"I_SCHEDULINGTYPE",
"I_WORKCENTER"
],
"ASSOCIATED":
[
"I_SCHEDULINGTYPE",
"I_WORKCENTER"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/