@AbapCatalog.sqlViewName: 'PRSHMUOPINSCDPWD'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@AbapCatalog.preserveKey: true
@EndUserText.label: 'Operation Capacity Per Work Day'
@ClientHandling.algorithm: #SESSION_VARIABLE
/*
CONTRACT**********************************************************************************************************************
Name: Multiday Operations Capacity Per Daily Shift
Specification: This view checks whether each day is working and returns capacity accordingly
Requires: NA
Ensures: At Start and End Date only the covered portion of capacity is returned as capacity in parallel.
Intermediate dates take full shift capacity.
Factory Calendar, Work Day Rule definition of capacity interval resp. shift is considered.
E.g. If a day is non working day as per factory calendar no capacity is considered for such day.
Owners: PRP
Contributors: AN
Unit Test required Y/N: Yes
Additional comments None
END OF CONTRACT***************************************************************************************************************
*/
define view P_RSHExMuDayOpsForSchedCapPrWD
with parameters
P_StartDate : datum,
P_EndDate : datum
as select from P_RSHExMuDayOpsForSchedCapPrDy(P_StartDate : $parameters.P_StartDate,
P_EndDate : $parameters.P_EndDate) as OperationCapacityPerShift
inner join P_RSHCALWORKDAYS( P_SAPClient : $session.client ) as isWorkDay on OperationCapacityPerShift.CapacityInternalID = isWorkDay.CapacityInternalID
and OperationCapacityPerShift.FactoryCalendarDate = isWorkDay.CalendarDate
{
key OperationCapacityPerShift.CapacityInternalID as CapacityInternalID,
key OperationCapacityPerShift.MaintenanceOrder as MaintenanceOrder,
key OperationCapacityPerShift.MaintenanceOrderOperation as MaintenanceOrderOperation,
key OperationCapacityPerShift.MaintenanceOrderSubOperation as MaintenanceOrderSubOperation,
key OperationCapacityPerShift.CapacityStartTime as CapacityStartTime,
key OperationCapacityPerShift.AvailableCapacityShift as AvailableCapacityShift,
key OperationCapacityPerShift.CalendarDate as CalendarDate,
// isStartDay,
// isEndDay,
OperationCapacityPerShift.ProcessingStatus as ProcessingStatus,
OperationCapacityPerShift.OrderType as OrderType,
OperationCapacityPerShift.MaintenanceActivityType as MaintenanceActivityType,
OperationCapacityPerShift.MaintPriority as MaintPriority,
OperationCapacityPerShift.MaintPriorityType as MaintPriorityType,
OperationCapacityPerShift.MaintPriorityColorCode as MaintPriorityColorCode,
OperationCapacityPerShift.OperationControlKey as OperationControlKey,
OperationCapacityPerShift.WorkCenter,
OperationCapacityPerShift.WorkCenterInternalID as WorkCenterInternalID,
OperationCapacityPerShift.WorkCenterCategoryCode as WorkCenterCategoryCode,
OperationCapacityPerShift.Plant as Plant,
OperationCapacityPerShift.WorkCenterTypeCode as WorkCenterTypeCode,
OperationCapacityPerShift.OperatingDurationInSeconds,
OperationCapacityPerShift.TotOperatingDurationInSeconds,
OperationCapacityPerShift.OperationPlannedWork as OperationPlannedWork,
OperationCapacityPerShift.OperationDayCount as OperationDayCount,
-- This view calculates the time in the capacity shift opening hours that is not covered by a multi-day operation on the operation start or end date
-- On days that are between the operation start and end, no such time can occur, since the operations covers the whole day
-- We call this uncovered time: Capacity Gap
-- On the start date the gap is the time between the start of the operation and the start of the capacity
-- On the end date the gap is the time between the end of the capacity and the end of the operation
case
when isWorkDay.WorkDays = 0 and OperationCapacityPerShift.WorkDayRule = '' or
OperationCapacityPerShift.WorkDayRule = '0' or
OperationCapacityPerShift.CapacityEndTime = OperationCapacityPerShift.CapacityStartTime or
OperationCapacityPerShift.TotOperatingDurationInSeconds = 0
then 0
else
OperationCapacityPerShift.CalCapacityInParallel
end as CalCapacityInParallel,
OperationCapacityPerShift.OperationPersonResponsible as OperationPersonResponsible
}