C_RSHWrkCtrUtilizationKPI is a Consumption CDS View that provides data about "Work Center Utilization Overview" in SAP S/4HANA. It reads from 6 data sources and exposes 4 fields with key field WorkCenter. Part of development package RSH_CDS_WC_UTILIZATION.
@AbapCatalog.sqlViewName: 'CRSHWCUTILKPI'
@AbapCatalog.compiler.compareFilter: true@EndUserText.label: 'Work Center Utilization Overview'
@AccessControl.authorizationCheck: #CHECK@VDM.viewType: #CONSUMPTION@ClientHandling.algorithm: #SESSION_VARIABLE@ObjectModel.usageType.dataClass: #MIXED@ObjectModel.usageType.serviceQuality: #X@ObjectModel.usageType.sizeCategory: #XL/*
CONTRACT**********************************************************************************************************************
Name: Work Center Utilization for current and next week
Specification: This is used to determine utilization in get_entityset of C_RSHOverloadedWC (CL_RSH_WC_UTILIZATION_DB)
Requires: Work Center Utilization for 2 weeks starting from current date
Ensures: Work Center Utilization for current and next week
Owners: AN
Contributors: PRP
Unit Test required Y/N: Yes
Additional comments None
END OF CONTRACT***************************************************************************************************************
*/defineview C_RSHWrkCtrUtilizationKPI
withparameters
P_StartDate : datum,
P_EndDate : datum
asselectfrom P_RSHWCUtilizationPerWeek( P_StartDate : $parameters.P_StartDate, P_EndDate : $parameters.P_EndDate) as Utilization
-- get one day of this week and one day of next week
innerjoin P_RSHThisWeekAndNextWeek as ThisCwNextCw on ThisCwNextCw.DateOfCurrentWeek = $session.user_date
-- Join Calendar Date twice to retrieve Calendar Week of current and next week
innerjoin I_CalendarDate as ThisWeek on ThisWeek.CalendarDate = ThisCwNextCw.DateOfCurrentWeek
innerjoin I_CalendarDate as NextWeek on NextWeek.CalendarDate = ThisCwNextCw.DateOfNextWeek
innerjoin I_CalendarDate as ThirdWeek on ThirdWeek.CalendarDate = ThisCwNextCw.DateofThirdWeek
innerjoin I_CalendarDate as FourthWeek on FourthWeek.CalendarDate = ThisCwNextCw.DateofFourthWeek
{
key Utilization.WorkCenter as WorkCenter,
Utilization.WorkCenterCategoryCode as WorkCenterCategoryCode,
Utilization.Plant as Plant,
-- get work center utilization of current year week
-- if the utilization value is greater than 9999%, default it to 9999%
max( casewhen Utilization.YearWeek = ThisWeek.YearWeek
thencasewhen WorkCenterUtilization > 9999
then
'9999%'
else
concat(cast ( cast( round ( WorkCenterUtilization, 0)asabap.dec( 4, 0 ) ) as val_text ), '%')
endend ) as WorkCenterUtilznIn1stWeekText,
-- get work center utilization of next year week
-- if the utilization value is greater than 9999%, default it to 9999%
max( casewhen Utilization.YearWeek = NextWeek.YearWeek
thencasewhen WorkCenterUtilization > 9999
then
'9999%'
else
concat(cast ( cast ( round ( WorkCenterUtilization, 0 )asabap.dec( 4, 0 ) ) as val_text ), '%')
endend ) as WorkCenterUtilznIn2ndWeekText,
'FUTURE' as PeriodType,
max( casewhen Utilization.YearWeek = ThirdWeek.YearWeek
thencasewhen WorkCenterUtilization > 9999
then
'9999%'
else
concat(cast ( cast ( round ( WorkCenterUtilization, 0 )asabap.dec( 4, 0 ) ) as val_text ), '%')
endend ) as WorkCenterUtilznIn3rdWeekText,
max( casewhen Utilization.YearWeek = FourthWeek.YearWeek
thencasewhen WorkCenterUtilization > 9999
then
'9999%'
else
concat(cast ( cast ( round ( WorkCenterUtilization, 0 )asabap.dec( 4, 0 ) ) as val_text ), '%')
endend ) as WorkCenterUtilznIn4thWeekText
// Utilization.WorkCenterInternalID,
// Utilization.WorkCenterTypeCode
}
groupby
Utilization.WorkCenter,
Utilization.WorkCenterCategoryCode,
Utilization.Plant
// Utilization.WorkCenterInternalID,
// Utilization.WorkCenterTypeCode