P_RSHWCHeaderCapacity_Cache is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (I_WorkCenter, I_Capacity) and exposes 16 fields with key field CapacityInternalID.
@AbapCatalog.sqlViewName: 'PRSHWCHDCAPCACHE'
@AbapCatalog.compiler.compareFilter: true@AccessControl.authorizationCheck: #NOT_REQUIRED@VDM.private: true@VDM.viewType: #CONSUMPTION@ClientHandling.algorithm: #SESSION_VARIABLE@AbapCatalog.preserveKey: true/*
CONTRACT**********************************************************************************************************************
Name: Work Center Header Capacity
Specification: The viewis to get Header capacity of the workcenter from capacity screen(header)
andnotfrom the Shifts and Intervals
Requires: NA
Ensures: Work Center Header Capacity is returned for assigned work centers.
Header validity is always 00.00.0000 to 31.12.9999.
Capacity and SingleCapacity are calculated considering the break duration, number of capacities and
planned utilization percentage.
Owners: CK
Contributors: AN
Unit Test required Y/N: Yes
Additional comments None
END OF CONTRACT***************************************************************************************************************
*/defineview P_RSHWCHeaderCapacity_Cache
asselectfrom I_Capacity as Capacity
innerjoin I_WorkCenter as _WorkCenter on _WorkCenter.CapacityInternalID = Capacity.CapacityInternalID
{
key Capacity.CapacityInternalID as CapacityInternalID,
_WorkCenter.WorkCenterInternalID as WorkCenterInternalID,
cast('00000000' as dats) as ValidityBeginDate,
cast('99991231' as dats) as ValidityEndDate,
Capacity.CapacityStartTime as CapacityStartTime,
Capacity.CapacityEndTime as CapacityEndTime,
Capacity.CapacityNumberOfCapacities as CapacityNumberOfCapacities,
Capacity.CapacityPlanUtilizationPercent as CapacityPlanUtilizationPercent,
Capacity.CapacityBreakDuration as CapacityBreakDuration,
// Pass maximum opening hours
casewhen CapacityEndTime > CapacityStartTime or CapacityStartTime = 0 // change here!!!!
// Normal shift, operating duration without break
then CapacityEndTime - CapacityStartTime
// Night shift, add 24 hours
else CapacityEndTime - CapacityStartTime + (24*3600)
endas OperatingDurationWithoutBreak,
_WorkCenter.WorkCenter as WorkCenter,
_WorkCenter.WorkCenterCategoryCode as WorkCenterCategoryCode,
_WorkCenter.WorkCenterTypeCode as WorkCenterTypeCode,
Capacity.Plant as Plant,
// Derive the factory calendar. Fall back to factory calandar of plant,
// if factory calendar at work center level isnot maintained
casewhen Capacity.FactoryCalendar = ''
then Capacity._Plant.FactoryCalendar
else Capacity.FactoryCalendar endas FactoryCalendar,
Capacity.ShiftGroup as ShiftGroup,
Capacity.CapacityActiveVersion as CapacityActiveVersion
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CAPACITY",
"I_PLANT",
"I_WORKCENTER"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/