P_PreviewCapacityDefinition

DDL: P_PREVIEWCAPACITYDEFINITION Type: view_entity COMPOSITE

Capacity def with intervals and shifts

P_PreviewCapacityDefinition is a Composite CDS View that provides data about "Capacity def with intervals and shifts" in SAP S/4HANA. It reads from 1 data source (P_CapacityHeaderActiveVersion) and exposes 20 fields with key fields CapacityInternalID, CapacityActiveVersion, ValidityEndDateendasValidityEndDate.

Data Sources (1)

SourceAliasJoin Type
P_CapacityHeaderActiveVersion Header from

Annotations (8)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
EndUserText.label Capacity def with intervals and shifts view
VDM.viewType #COMPOSITE view
VDM.private true view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.dataClass #MASTER view

Fields (20)

KeyFieldSource TableSource FieldDescription
KEY CapacityInternalID P_CapacityHeaderActiveVersion CapacityInternalID Capacity ID
KEY CapacityActiveVersion P_CapacityHeaderActiveVersion CapacityActiveVersion
KEY ValidityEndDateendasValidityEndDate
Plant P_CapacityHeaderActiveVersion Plant Valuation Area
FactoryCalendar P_CapacityHeaderActiveVersion FactoryCalendar Factory Calendar
ValidityBeginDateendasValidityBeginDate
ShiftDefinition shift_def ShiftDefinition
ShiftGrouping P_CapacityHeaderActiveVersion ShiftGroup Shift Grouping
ValidityBeginDateendasShiftStartDate
timsendasShiftStartTime
ValidityEndDateendasShiftEndDate
timsendasShiftEndTime
CapacityCategoryCode P_CapacityHeaderActiveVersion CapacityCategoryCode
CapacityCategoryName P_CapacityHeaderActiveVersion CapacityCategoryName
Capacity P_CapacityHeaderActiveVersion Capacity Engine Capacity
CapacityResponsiblePlanner P_CapacityHeaderActiveVersion CapacityResponsiblePlanner
CapacityStartTimeendasCapacityStartTime
CapacityEndTimeendasCapacityEndTime
fltpendasTotOperatingDurationInHours
fltpendasOperatingDurationInSeconds

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_PreviewCapacityDefinition.
-- 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_PreviewCapacityDefinition AS
SELECT
  Header.CapacityInternalID AS CapacityInternalID,
  Header.CapacityActiveVersion AS CapacityActiveVersion,
  case when (shift_def.ShiftDefinition is not null and shift_def.ShiftEndDate < interval.ValidityEndDate) then shift_def.ShiftEndDate when interval.ValidityEndDate is not null then interval.ValidityEndDate when Header.ValidityEndDate is not null then Header.ValidityEndDate end as ValidityEndDate AS ValidityEndDateendasValidityEndDate,
  Header.Plant AS Plant,
  Header.FactoryCalendar AS FactoryCalendar,
  case when (shift_def.ShiftDefinition is not null and shift_def.ShiftStartDate > interval.ValidityBeginDate) then shift_def.ShiftStartDate when interval.ValidityBeginDate is not null then interval.ValidityBeginDate when Header.ValidityBeginDate is not null then Header.ValidityBeginDate end as ValidityBeginDate AS ValidityBeginDateendasValidityBeginDate,
  shift_def.ShiftDefinition AS ShiftDefinition,
  Header.ShiftGroup AS ShiftGrouping,
  case when (shift_def.ShiftDefinition is not null) then shift_def.ShiftStartDate when interval.ValidityBeginDate is not null then interval.ValidityBeginDate when Header.ValidityBeginDate is not null then Header.ValidityBeginDate end as ShiftStartDate AS ValidityBeginDateendasShiftStartDate,
  case when (shift_def.ShiftDefinition is not null) then shift_def.ShiftStartTime when (shift_def.ShiftDefinition is null) then cast ( substring( cast ( tstmp_add_seconds( cast ('10010102000000' as abap.dec(15,0)), cast( case when shift.CapacityStartTimeID is not null then shift.CapacityStartTimeID when shift.CapacityStartTimeID is null then Header.CapacityStartTime end as abap.dec(15,0) ), 'FAIL') as abap.sstring(50)), 9,6) as abap.tims) end as ShiftStartTime AS timsendasShiftStartTime,
  case when (shift_def.ShiftDefinition is not null) then shift_def.ShiftEndDate when (interval.ValidityEndDate is not null) then interval.ValidityEndDate when (Header.ValidityEndDate is not null) then Header.ValidityEndDate end as ShiftEndDate AS ValidityEndDateendasShiftEndDate,
  case when (shift_def.ShiftDefinition is not null) then shift_def.ShiftEndTime when shift.CapacityEndTimeID = 86400 or (Header.CapacityEndTime = 86400 and shift.CapacityEndTimeID is null) then cast( '240000' as abap.tims ) else cast ( substring( cast ( tstmp_add_seconds( cast ('10010102000000' as abap.dec(15,0)), cast( case when shift.CapacityEndTimeID is not null then shift.CapacityEndTimeID when Header.CapacityEndTime is not null then Header.CapacityEndTime end as abap.dec(15,0) ), 'FAIL') as abap.sstring(50)), 9,6) as abap.tims) end as ShiftEndTime AS timsendasShiftEndTime,
  Header.CapacityCategoryCode AS CapacityCategoryCode,
  Header.CapacityCategoryName AS CapacityCategoryName,
  Header.Capacity AS Capacity,
  Header.CapacityResponsiblePlanner AS CapacityResponsiblePlanner,
  case when shift_def.CapacityStartTimeID is not null then shift_def.CapacityStartTimeID when shift.CapacityStartTimeID is not null then shift.CapacityStartTimeID when Header.CapacityStartTime is not null then Header.CapacityStartTime end as CapacityStartTime AS CapacityStartTimeendasCapacityStartTime,
  case when shift_def.CapacityEndTimeID is not null then shift_def.CapacityEndTimeID when shift.CapacityEndTimeID is not null then shift.CapacityEndTimeID when Header.CapacityEndTime is not null then Header.CapacityEndTime end as CapacityEndTime AS CapacityEndTimeendasCapacityEndTime,
  case when (shift_def.ShiftDefinition is not null) then cast(shift_def.OperatingDurationInSeconds as abap.fltp) * cast(shift.CapacityNumberOfCapacities as abap.fltp) * cast(shift.CapacityPlanUtilizationPercent as abap.fltp) / cast(100 as abap.fltp) / cast (3600 as abap.fltp) when (shift.TotOperatingDurationInSeconds is not null) then cast(shift.TotOperatingDurationInSeconds as abap.fltp) / cast (3600 as abap.fltp) when (Header.OverallCapacity is not null) then Header.OverallCapacity / cast (3600 as abap.fltp) end as TotOperatingDurationInHours AS fltpendasTotOperatingDurationInHours,
  case when (shift_def.ShiftDefinition is not null) then cast(shift_def.OperatingDurationInSeconds as abap.fltp) when (shift.CapacityPlanUtilizationPercent is not null and shift.CapacityPlanUtilizationPercent > '000') then (cast(shift.OperatingDurationInSeconds as abap.fltp) * cast(100 as abap.fltp) / cast(shift.CapacityPlanUtilizationPercent as abap.fltp) ) when (shift.CapacityPlanUtilizationPercent is not null and (shift.CapacityPlanUtilizationPercent = '000')) then 0 when (Header.SingleCapacity is not null) then cast(Header.SingleCapacity as abap.fltp) end as OperatingDurationInSeconds AS fltpendasOperatingDurationInSeconds
FROM P_CapacityHeaderActiveVersion AS Header
;