P_RSHDueOperForKPIDetails

DDL: P_RSHDUEOPERFORKPIDETAILS SQL: PRSHDUEOPKPIDET Type: view CONSUMPTION

Past Order Operation KPI Details

P_RSHDueOperForKPIDetails is a Consumption CDS View that provides data about "Past Order Operation KPI Details" in SAP S/4HANA. It reads from 7 data sources and exposes 9 fields with key fields MaintOrderRoutingNumber, OrderOperationInternalID.

Data Sources (7)

SourceAliasJoin Type
I_RSHAssignedWorkCenters _AssignedWorkCenter inner
I_MaintenanceOrder _MaintOrder from
I_MaintOrderOperPlanningValues _MaintOrderOpPlanValue inner
I_RSHOperationStatusObject _OperationStatusObj inner
I_OperationControlProfile _OperControlProfile inner
I_OrderOperationBasic _OrderOpBasic inner
I_SchedulingType _SchedulingType inner

Parameters (2)

NameTypeDefault
P_StartDate datum
P_EndDate datum

Annotations (8)

NameValueLevelField
AbapCatalog.sqlViewName PRSHDUEOPKPIDET view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #CONSUMPTION view
ClientHandling.algorithm #SESSION_VARIABLE view
EndUserText.label Past Order Operation KPI Details view

Fields (9)

KeyFieldSource TableSource FieldDescription
KEY MaintOrderRoutingNumber I_MaintenanceOrder MaintOrderRoutingNumber
KEY OrderOperationInternalID I_OrderOperationBasic OrderOperationInternalID
MaintenanceOrder I_MaintenanceOrder MaintenanceOrder
WorkCenterInternalID I_OrderOperationBasic WorkCenterInternalID
Plant I_OrderOperationBasic Plant
OperationControlProfile I_OrderOperationBasic OperationControlProfile
Equipment I_MaintenanceOrder Equipment
MaintObjectLocAcctAssgmtNmbr I_MaintenanceOrder MaintObjectLocAcctAssgmtNmbr
OperationPersonResponsible I_OrderOperationBasic OperationPersonResponsible
@AbapCatalog.sqlViewName: 'PRSHDUEOPKPIDET'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey:true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'Past Order Operation KPI Details'


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

Name:                       Operations and Maintenence order from relevant work center and timeframe for next 4 weeks.
Specification:              This view will retrieve the operations and Maintenence order from relevant work centers and timeframe.
                            Operations with all status are determined.
Requires:                   Work Center assignment in I_RSHAssignedWorkCenters.
Ensures:                    Operations and sub operations from relevant work centers are determined for next 4 weeks time frame.
Owners:                     PP
Contributors:               DJ
Abap Unit:                  Yes

END OF CONTRACT***************************************************************************************************************
*/
define view P_RSHDueOperForKPIDetails
  with parameters
    P_StartDate : datum,
    P_EndDate   : datum
  as select from I_MaintenanceOrder             as _MaintOrder
    inner join   I_OrderOperationBasic          as _OrderOpBasic          on _MaintOrder.MaintOrderRoutingNumber = _OrderOpBasic.OrderInternalID
    inner join   I_MaintOrderOperPlanningValues as _MaintOrderOpPlanValue on  _OrderOpBasic.OrderInternalID          = _MaintOrderOpPlanValue.MaintOrderRoutingNumber
                                                                          and _OrderOpBasic.OrderOperationInternalID = _MaintOrderOpPlanValue.MaintOrderOperationCounter
  // Work Center

    inner join   I_RSHAssignedWorkCenters       as _AssignedWorkCenter    on  _OrderOpBasic.WorkCenterInternalID = _AssignedWorkCenter.WorkCenterInternalID
                                                                          and _OrderOpBasic.WorkCenterTypeCode   = _AssignedWorkCenter.WorkCenterTypeCode
  // Operation Control Profile

    inner join   I_OperationControlProfile      as _OperControlProfile    on  _OrderOpBasic.OperationControlProfile    = _OperControlProfile.OperationControlProfile
                                                                          and _OperControlProfile.OperationIsScheduled = 'X'
  // Operation Status

    inner join   I_RSHOperationStatusObject     as _OperationStatusObj    on _OrderOpBasic.ObjectInternalID = _OperationStatusObj.StatusObject
  // Scheduling Type

    inner join   I_SchedulingType               as _SchedulingType        on _MaintOrder.BasicSchedulingType = _SchedulingType.SchedulingType
{

  key _MaintOrder.MaintOrderRoutingNumber      as MaintOrderRoutingNumber,
  key _OrderOpBasic.OrderOperationInternalID   as OrderOperationInternalID,
      _MaintOrder.MaintenanceOrder             as MaintenanceOrder,
      _OrderOpBasic.WorkCenterInternalID       as WorkCenterInternalID,
      _OrderOpBasic.Plant                      as Plant,
      _OrderOpBasic.OperationControlProfile    as OperationControlProfile,
      _MaintOrder.Equipment                    as Equipment,
      _MaintOrder.MaintObjectLocAcctAssgmtNmbr as MaintObjectLocAcctAssgmtNmbr,

      max( case _OperationStatusObj.StatusCode
               when 'I0010' then 40 --PART. CONFIRMED
               when 'I0117' then 30 --DISPATCHED
               when 'I0002' then 20 --RELEASED
               when 'I0001' then 20 --CREATED
               when 'I0045' then 50 --CONFIRMED
               when 'I0009' then 50 --CONFIRMED
               when 'I0046' then 50 --Business Closed
               when 'I0013' then 60 --Deleted
               when 'I0043' then 70 --Locked
           end )                               as ProcessingStatus,

      _OrderOpBasic.OperationPersonResponsible as OperationPersonResponsible
}

where
  (
    (
          _MaintOrderOpPlanValue.OpErlstSchedldExecStrtDte <= $parameters.P_EndDate
      and _MaintOrderOpPlanValue.OpErlstSchedldExecEndDte  >= $parameters.P_StartDate
      and _SchedulingType.SchedulingIsPerformedBackward    =  ''
    )
    or(
          _MaintOrderOpPlanValue.OpLtstSchedldExecStrtDte  <= $parameters.P_EndDate
      and _MaintOrderOpPlanValue.OpLtstSchedldExecEndDte   >= $parameters.P_StartDate
      and _SchedulingType.SchedulingIsPerformedBackward    =  'X'
    )
  )
  and     _MaintOrder.MaintOrderProcessingContext          <> 'B'

group by

  _MaintOrder.MaintenanceOrder,
  _MaintOrder.MaintOrderRoutingNumber,
  _OrderOpBasic.OrderOperationInternalID,
  _OrderOpBasic.WorkCenterInternalID,
  _OrderOpBasic.Plant,
  _OrderOpBasic.OperationControlProfile,
  _MaintOrder.Equipment,
  _MaintOrder.MaintObjectLocAcctAssgmtNmbr,
  _OrderOpBasic.OperationPersonResponsible
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_MAINTENANCEORDER",
"I_MAINTORDEROPERPLANNINGVALUES",
"I_OPERATIONCONTROLPROFILE",
"I_ORDEROPERATIONBASIC",
"I_RSHASSIGNEDWORKCENTERS",
"I_RSHOPERATIONSTATUSOBJECT",
"I_SCHEDULINGTYPE"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/