P_RSHWCHeaderCapacity_Cache
Private View for Header Capacity
P_RSHWCHeaderCapacity_Cache is a Consumption CDS View that provides data about "Private View for Header Capacity" in SAP S/4HANA. It reads from 2 data sources (I_WorkCenter, I_Capacity) and exposes 16 fields with key field CapacityInternalID. Part of development package RSH_CDS_WC_CAPACITY.
Data Sources (2)
| Source | Alias | Join Type |
|---|---|---|
| I_WorkCenter | _WorkCenter | inner |
| I_Capacity | Capacity | from |
Annotations (7)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PRSHWCHDCAPCACHE | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.private | true | view | |
| VDM.viewType | #CONSUMPTION | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| AbapCatalog.preserveKey | true | view |
Fields (16)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | CapacityInternalID | I_Capacity | CapacityInternalID | |
| WorkCenterInternalID | I_WorkCenter | WorkCenterInternalID | ||
| ValidityBeginDate | ||||
| ValidityEndDate | ||||
| CapacityStartTime | I_Capacity | CapacityStartTime | ||
| CapacityEndTime | I_Capacity | CapacityEndTime | ||
| CapacityNumberOfCapacities | I_Capacity | CapacityNumberOfCapacities | ||
| CapacityPlanUtilizationPercent | I_Capacity | CapacityPlanUtilizationPercent | ||
| CapacityBreakDuration | I_Capacity | CapacityBreakDuration | ||
| WorkCenter | I_WorkCenter | WorkCenter | ||
| WorkCenterCategoryCode | I_WorkCenter | WorkCenterCategoryCode | ||
| WorkCenterTypeCode | I_WorkCenter | WorkCenterTypeCode | ||
| Plant | I_Capacity | Plant | ||
| FactoryCalendarendasFactoryCalendar | ||||
| ShiftGroup | I_Capacity | ShiftGroup | ||
| CapacityActiveVersion | I_Capacity | CapacityActiveVersion |
@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 view is to get Header capacity of the workcenter from capacity screen(header)
and not from 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***************************************************************************************************************
*/
define view P_RSHWCHeaderCapacity_Cache
as select from I_Capacity as Capacity
inner join 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
case when 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)
end as 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 is not maintained
case when Capacity.FactoryCalendar = ''
then Capacity._Plant.FactoryCalendar
else Capacity.FactoryCalendar end as FactoryCalendar,
Capacity.ShiftGroup as ShiftGroup,
Capacity.CapacityActiveVersion as CapacityActiveVersion
}
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA