@AbapCatalog.sqlViewName: 'PRSHPASTOPKPIDET'
@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 past 6 months order details.
Specification: This view will retrieve the operations and Maintenence Order from relevant work centers and timeframe.
Operations with all status are determined. The processing status is determined.
Requires: Work Center assignment in I_RSHAssignedWorkCenters.
Ensures: Operations and Maintenence Order from relevant work centers, based on past 6 months timeframe are returned
Owners: PP
Contributors: DJ
Abap Unit: Yes
END OF CONTRACT***************************************************************************************************************
*/
define view P_RSHPastOperForKPIDetails
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.OpErlstSchedldExecEndDte < $parameters.P_EndDate and
_MaintOrderOpPlanValue.OpErlstSchedldExecEndDte >= $parameters.P_StartDate and
_SchedulingType.SchedulingIsPerformedBackward = '' )
or
( _MaintOrderOpPlanValue.OpLtstSchedldExecEndDte < $parameters.P_EndDate and
_MaintOrderOpPlanValue.OpLtstSchedldExecEndDte >= $parameters.P_StartDate and
_SchedulingType.SchedulingIsPerformedBackward = 'X' ) )
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":""
}
}*/