P_RSHWorkCenterCapacityChange
Work Center Capacity Change
P_RSHWorkCenterCapacityChange is a Consumption CDS View that provides data about "Work Center Capacity Change" in SAP S/4HANA. It reads from 5 data sources (P_RSHWCCapacityDefinition, I_CalendarDate, I_Capacity, I_WorkCenterCapacity, P_RSHCALWORKDAYS) and exposes 28 fields with key fields CapacityInternalID, CalendarDate, WorkCenterInternalID, WorkCenter, CapacityActiveVersion. Part of development package RSH_CDS_WC_CAPACITY.
Data Sources (5)
| Source | Alias | Join Type |
|---|---|---|
| P_RSHWCCapacityDefinition | CapaDef | from |
| I_CalendarDate | date_series | inner |
| I_Capacity | I_Capacity | inner |
| I_WorkCenterCapacity | I_WorkCenterCapacity | left_outer |
| P_RSHCALWORKDAYS | P_RSHCALWORKDAYS | inner |
Annotations (8)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PRSHWCCAPCHG | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.private | true | view | |
| VDM.viewType | #CONSUMPTION | view | |
| EndUserText.label | Work Center Capacity Change | view | |
| AbapCatalog.preserveKey | true | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view |
Fields (28)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | CapacityInternalID | P_RSHWCCapacityDefinition | CapacityInternalID | |
| KEY | CalendarDate | I_CalendarDate | CalendarDate | |
| KEY | WorkCenterInternalID | P_RSHWCCapacityDefinition | WorkCenterInternalID | |
| KEY | WorkCenter | P_RSHWCCapacityDefinition | WorkCenter | |
| KEY | CapacityActiveVersion | P_RSHWCCapacityDefinition | CapacityActiveVersion | |
| KEY | CapacityStartTime | P_RSHWCCapacityDefinition | CapacityStartTime | |
| WorkCenterCategoryCode | P_RSHWCCapacityDefinition | WorkCenterCategoryCode | ||
| WorkCenterTypeCode | P_RSHWCCapacityDefinition | WorkCenterTypeCode | ||
| Plant | P_RSHWCCapacityDefinition | Plant | ||
| WeekDay | I_CalendarDate | WeekDay | ||
| CalendarWeek | I_CalendarDate | CalendarWeek | ||
| AvailableCapacityShift | AvailableCapacityShift | |||
| AvailableCapacityIntervalDurn | AvailableCapacityIntervalDurn | |||
| WorkDayRule | WorkDayRule | |||
| CapacityEndTime | P_RSHWCCapacityDefinition | CapacityEndTime | ||
| ShiftDefinition | P_RSHWCCapacityDefinition | ShiftDefinition | ||
| ShiftDefinitionName | P_RSHWCCapacityDefinition | ShiftDefinitionName | ||
| CapacityNumberOfCapacities | P_RSHWCCapacityDefinition | CapacityNumberOfCapacities | ||
| CapacityPlanUtilizationPercent | P_RSHWCCapacityDefinition | CapacityPlanUtilizationPercent | ||
| FactoryCalendar | P_RSHWCCapacityDefinition | FactoryCalendar | ||
| YearWeek | YearWeek | |||
| timsasShiftStartTime | ||||
| timsasShiftEndTime | ||||
| CapacityBreakDuration | P_RSHWCCapacityDefinition | CapacityBreakDuration | ||
| CapacityCategoryAllocation | I_WorkCenterCapacity | CapacityCategoryAllocation | ||
| ReferencedCapacityInternalID | I_Capacity | ReferencedCapacityInternalID | ||
| CapacityIsPooled | I_Capacity | CapacityIsPooled | ||
| WorkDayRule0thenelseXendasIsEditable |
@AbapCatalog.sqlViewName: 'PRSHWCCAPCHG'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@EndUserText.label: 'Work Center Capacity Change'
@AbapCatalog.preserveKey:true
@ClientHandling.algorithm: #SESSION_VARIABLE
/*
CONTRACT*************************************************************************************************************************
Name: Change capacity of assigned work centers
Specification: This view daywise capacity of the work center per shift basis
Requires: NA
Ensures: Daywise capacity of the work center is returned
Owners: AN, PRP
Contributors:
Unit Test required Y/N: Yes
Additional comments None
END OF CONTRACT******************************************************************************************************************
*/
define view P_RSHWorkCenterCapacityChange
as select from P_RSHWCCapacityDefinition as CapaDef
inner join I_CalendarDate as date_series on date_series.CalendarDate <= ValidityEndDate
and date_series.CalendarDate >= ValidityBeginDate
and (
(
AvailableCapacityIntervalDurn = '01'
) // 1 day shift interval duration
or(
AvailableCapacityIntervalDurn = '07'
and // 7 day shift interval duration
date_series.WeekDay = CapaDef.WeekDay
)
)
inner join P_RSHCALWORKDAYS(P_SAPClient : $session.client) as WorkDays on WorkDays.CapacityInternalID = CapaDef.CapacityInternalID
and WorkDays.CalendarDate = date_series.CalendarDate
left outer join I_WorkCenterCapacity on I_WorkCenterCapacity.WorkCenterInternalID = CapaDef.WorkCenterInternalID
and I_WorkCenterCapacity.WorkCenterTypeCode = CapaDef.WorkCenterTypeCode
and I_WorkCenterCapacity.CapacityInternalID = CapaDef.CapacityInternalID
inner join I_Capacity on I_Capacity.CapacityInternalID = CapaDef.CapacityInternalID
{
key CapaDef.CapacityInternalID,
key date_series.CalendarDate,
key CapaDef.WorkCenterInternalID,
key CapaDef.WorkCenter,
key CapaDef.CapacityActiveVersion,
key CapaDef.CapacityStartTime,
CapaDef.WorkCenterCategoryCode,
CapaDef.WorkCenterTypeCode,
CapaDef.Plant,
date_series.WeekDay,
date_series.CalendarWeek,
AvailableCapacityShift,
AvailableCapacityIntervalDurn,
WorkDayRule,
CapaDef.CapacityEndTime,
CapaDef.ShiftDefinition,
CapaDef.ShiftDefinitionName,
case
when WorkDays.WorkDays = 0 and CapaDef.WorkDayRule = '' or
CapaDef.WorkDayRule = '0' or
CapaDef.OperatingDurationInSeconds = 0
then 0
else
CapaDef.OperatingDurationInSeconds
end as OperatingDurationInSeconds,
case when WorkDays.WorkDays = 0 and CapaDef.WorkDayRule = '' or
CapaDef.WorkDayRule = '0' or
CapaDef.OperatingDurationInSeconds = 0
then 0
else
CapaDef.TotOperatingDurationInSeconds
end as TotOperatingDurationInSeconds,
// cast ( CapaDef.CapacityNumberOfCapacities as rsh_eam_number_of_capa_str ) as CapacityNumberOfCapacities,
CapaDef.CapacityNumberOfCapacities,
CapaDef.CapacityPlanUtilizationPercent,
CapaDef.FactoryCalendar,
YearWeek,
cast ( substring( cast (
tstmp_add_seconds(
cast ('10010102000000' as abap.dec(15,0)),
cast( CapaDef.CapacityStartTime as abap.dec(15,0) ),
'FAIL') as abap.sstring(50)),
9,6) as abap.tims) as ShiftStartTime,
cast ( substring( cast (
tstmp_add_seconds(
cast ('10010102000000' as abap.dec(15,0)),
cast( CapaDef.CapacityEndTime as abap.dec(15,0) ),
'FAIL') as abap.sstring(50)),
9,6) as abap.tims) as ShiftEndTime,
CapaDef.CapacityBreakDuration,
I_WorkCenterCapacity.CapacityCategoryAllocation,
I_Capacity.ReferencedCapacityInternalID,
I_Capacity.CapacityIsPooled,
// Referenced capacity and pooled capaciyty is non editable
// Editing is not allowed if capacity version is not maintained in the capacity header
case when CapaDef.CapacityActiveVersion = '00' or ReferencedCapacityInternalID is not initial or CapacityIsPooled is not initial
or I_WorkCenterCapacity.CapacityCategoryAllocation is null
or ( WorkDays.WorkDays = 0 and CapaDef.WorkDayRule = '' ) or CapaDef.WorkDayRule = '0'
then ''
else
'X' end as IsEditable
}
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