P_CapacityWithNightShift

DDL: P_CAPACITYWITHNIGHTSHIFT Type: view_entity COMPOSITE Package: PPH_VDM_CAP_EVAL

Work Center Capacity With Night Shift

P_CapacityWithNightShift is a Composite CDS View that provides data about "Work Center Capacity With Night Shift" in SAP S/4HANA. It reads from 1 data source (P_CapacityDefinition) and exposes 20 fields with key fields CapacityInternalID, ValidityEndDateendasValidityEndDate, WeekDayendasWeekDay, AvailableCapacityShift, CapacityActiveVersion. Part of development package PPH_VDM_CAP_EVAL.

Data Sources (1)

SourceAliasJoin Type
P_CapacityDefinition CapaDef from

Annotations (3)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.viewType #COMPOSITE view
VDM.private true view

Fields (20)

KeyFieldSource TableSource FieldDescription
KEY CapacityInternalID P_CapacityDefinition CapacityInternalID Capacity ID
KEY ValidityEndDateendasValidityEndDate
KEY WeekDayendasWeekDay
KEY AvailableCapacityShift P_CapacityDefinition AvailableCapacityShift Capacity Shift
KEY CapacityActiveVersion P_CapacityDefinition CapacityActiveVersion
ShiftName P_CapacityDefinition ShiftName
Plant P_CapacityDefinition Plant Valuation Area
FactoryCalendar P_CapacityDefinition FactoryCalendar Factory Calendar
CapacityCategoryCode P_CapacityDefinition CapacityCategoryCode
CapacityCategoryName P_CapacityDefinition CapacityCategoryName
Capacity P_CapacityDefinition Capacity Engine Capacity
CapacityResponsiblePlanner P_CapacityDefinition CapacityResponsiblePlanner
CapacityStartTimeendasCapacityStartTime
ValidityBeginDateendasValidityBeginDate
NightSplitDateendasNightSplitDate
WorkDayRule P_CapacityDefinition WorkDayRule Recurrence Weekdays
CapacityEndTimeendasCapacityEndTime
CapacityBreakDuration P_CapacityDefinition CapacityBreakDuration
CapacityNumberOfCapacities P_CapacityDefinition CapacityNumberOfCapacities
CapacityPlanUtilizationPercent P_CapacityDefinition CapacityPlanUtilizationPercent

Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.

-- Derived SQL interpretation of CDS view P_CapacityWithNightShift.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.

CREATE VIEW P_CapacityWithNightShift AS
SELECT
  CapaDef.CapacityInternalID AS CapacityInternalID,
  case when NightSplit.NightSplitDate = 2 and CapaDef.ValidityEndDate < '99991231' then dats_add_days(CapaDef.ValidityEndDate, 1, 'FAIL') else CapaDef.ValidityEndDate end as ValidityEndDate AS ValidityEndDateendasValidityEndDate,
  case when NightSplit.NightSplitDate = 2 and CapaDef.AvailableCapacityIntervalDurn = '07' then case CapaDef.WeekDay when '7' then '1' when '6' then '7' when '5' then '6' when '4' then '5' when '3' then '4' when '2' then '3' when '1' then '2' else CapaDef.WeekDay end else CapaDef.WeekDay end as WeekDay AS WeekDayendasWeekDay,
  CapaDef.AvailableCapacityShift AS AvailableCapacityShift,
  CapaDef.CapacityActiveVersion AS CapacityActiveVersion,
  CapaDef.ShiftName AS ShiftName,
  CapaDef.Plant AS Plant,
  CapaDef.FactoryCalendar AS FactoryCalendar,
  CapaDef.CapacityCategoryCode AS CapacityCategoryCode,
  CapaDef.CapacityCategoryName AS CapacityCategoryName,
  CapaDef.Capacity AS Capacity,
  CapaDef.CapacityResponsiblePlanner AS CapacityResponsiblePlanner,
  case when NightSplit.NightSplitDate = 2 then 0 else CapaDef.CapacityStartTime end as CapacityStartTime AS CapacityStartTimeendasCapacityStartTime,
  case when NightSplit.NightSplitDate = 2 then dats_add_days(CapaDef.ValidityBeginDate, 1, 'FAIL') else CapaDef.ValidityBeginDate end as ValidityBeginDate AS ValidityBeginDateendasValidityBeginDate,
  case when NightSplit.NightSplitDate is null then 1 else NightSplit.NightSplitDate end as NightSplitDate AS NightSplitDateendasNightSplitDate,
  CapaDef.WorkDayRule AS WorkDayRule,
  case when NightSplit.NightSplitDate = 1 then 86400 AS CapacityEndTimeendasCapacityEndTime,
  CapaDef.CapacityBreakDuration AS CapacityBreakDuration,
  CapaDef.CapacityNumberOfCapacities AS CapacityNumberOfCapacities,
  CapaDef.CapacityPlanUtilizationPercent AS CapacityPlanUtilizationPercent
FROM P_CapacityDefinition AS CapaDef
;