P_PreviewCapacityDefinition
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)
| Source | Alias | Join Type |
|---|---|---|
| P_CapacityHeaderActiveVersion | Header | from |
Annotations (8)
| Name | Value | Level | Field |
|---|---|---|---|
| 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)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| 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
;
Learn More
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- CDS View Annotations — A Complete Guide
- What Is a CDS View in SAP S/4HANA?
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- 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
- BSEG to ACDOCA: The Universal Journal Migration
- Business Partner Migration: KNA1/LFA1 to BUT000
- Material Document Migration: MSEG/MKPF to MATDOC
- How to Find the Right CDS View for an SAP Table
- BW Extractor to CDS View Migration Guide
- S/4HANA CDS View Deprecation: What You Need to Know
- ABAP CDS View Tutorial — From Basics to Real-World Examples
- RAP and CDS Views — Building Transactional Apps in SAP S/4HANA
- Sales Document Status Migration: VBUP/VBUK Removal in S/4HANA
- CO Tables in S/4HANA: COEP, COBK, COSS, COSP to ACDOCA