P_WorkCenterCapacityDefinition

DDL: P_WORKCENTERCAPACITYDEFINITION SQL: PWORKCTRCAPDEF Type: view COMPOSITE

P_WorkCenterCapacityDefinition is a Composite CDS View in SAP S/4HANA. It reads from 4 data sources (P_WorkCenterHeaderCapacity, I_WorkCenterCapacityInterval, I_AvailableCapacityShift, P_WorkCenterShiftDefinition) and exposes 34 fields with key fields WorkCenterInternalID, WorkCenterTypeCode, CapacityCategoryAllocation, CapacityInternalID, CapacityActiveVersion.

Data Sources (4)

SourceAliasJoin Type
P_WorkCenterHeaderCapacity Header from
I_WorkCenterCapacityInterval interval left_outer
I_AvailableCapacityShift shift left_outer
P_WorkCenterShiftDefinition shift_def left_outer

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PWORKCTRCAPDEF view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #COMPOSITE view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (34)

KeyFieldSource TableSource FieldDescription
KEY WorkCenterInternalID P_WorkCenterHeaderCapacity WorkCenterInternalID Work Center
KEY WorkCenterTypeCode P_WorkCenterHeaderCapacity WorkCenterTypeCode Object Type
KEY CapacityCategoryAllocation P_WorkCenterHeaderCapacity CapacityCategoryAllocation
KEY CapacityInternalID P_WorkCenterHeaderCapacity CapacityInternalID Capacity ID
KEY CapacityActiveVersion I_WorkCenterCapacityInterval AvailableCapacityType Version
KEY ValidityEndDateendasValidityEndDate
KEY WeekDay
KEY AvailableCapacityShift
WorkCenter P_WorkCenterHeaderCapacity WorkCenter Work Center
Plant P_WorkCenterHeaderCapacity Plant Valuation Area
FactoryCalendar P_WorkCenterHeaderCapacity FactoryCalendar Factory Calendar
ValidityBeginDateendasValidityBeginDate
ShiftName
ShiftDefinition P_WorkCenterShiftDefinition ShiftDefinition Shift Definition
ShiftGrouping P_WorkCenterHeaderCapacity ShiftGroup Shift Grouping
ValidityBeginDateendasShiftStartDate
timsendasShiftStartTime
ValidityEndDateendasShiftEndDate
timsendasShiftEndTime
WorkCenterResponsible P_WorkCenterHeaderCapacity WorkCenterResponsible
WorkCenterDesc P_WorkCenterHeaderCapacity WorkCenterDesc
WorkCenterCategoryCode P_WorkCenterHeaderCapacity WorkCenterCategoryCode
CapacityCategoryCode P_WorkCenterHeaderCapacity CapacityCategoryCode
CapacityCategoryName P_WorkCenterHeaderCapacity CapacityCategoryName
Capacity P_WorkCenterHeaderCapacity Capacity Engine Capacity
CapacityResponsiblePlanner P_WorkCenterHeaderCapacity CapacityResponsiblePlanner
CapacityStartTimeasCapacityStartTime
CapacityEndTimeasCapacityEndTime
AvailableCapacityIntervalDurn
WorkDayRule
fltpendasTotOperatingDurationInHours
fltpendasOperatingDurationInSeconds
CapacityNumberOfCapacities
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_WorkCenterCapacityDefinition.
-- 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.
-- SQL view name: PWORKCTRCAPDEF

CREATE VIEW P_WorkCenterCapacityDefinition AS
SELECT
  Header.WorkCenterInternalID AS WorkCenterInternalID,
  Header.WorkCenterTypeCode AS WorkCenterTypeCode,
  Header.CapacityCategoryAllocation AS CapacityCategoryAllocation,
  Header.CapacityInternalID AS CapacityInternalID,
  interval.AvailableCapacityType AS CapacityActiveVersion,
  case when (shift_def.ShiftDefinition is not null) then case when shift_def.ShiftEndDate < interval.ValidityEndDate then shift_def.ShiftEndDate else interval.ValidityEndDate end else coalesce( interval.ValidityEndDate, Header.ValidityEndDate ) end as ValidityEndDate AS ValidityEndDateendasValidityEndDate,
  coalesce( right( shift.WeekDay, 1), '1' ) AS WeekDay,
  coalesce( shift.AvailableCapacityShift, '' ) AS AvailableCapacityShift,
  Header.WorkCenter AS WorkCenter,
  Header.Plant AS Plant,
  Header.FactoryCalendar AS FactoryCalendar,
  case when (shift_def.ShiftDefinition is not null) then case when shift_def.ShiftStartDate > interval.ValidityBeginDate then shift_def.ShiftStartDate else interval.ValidityBeginDate end else coalesce( interval.ValidityBeginDate, Header.ValidityBeginDate ) end as ValidityBeginDate AS ValidityBeginDateendasValidityBeginDate,
  coalesce(shift_def.ShiftDefinition,'') AS ShiftName,
  shift_def.ShiftDefinition AS ShiftDefinition,
  Header.ShiftGroup AS ShiftGrouping,
  case when (shift_def.ShiftDefinition is not null) then shift_def.ShiftStartDate else coalesce( interval.ValidityBeginDate, Header.ValidityBeginDate ) end as ShiftStartDate AS ValidityBeginDateendasShiftStartDate,
  case when (shift_def.ShiftDefinition is not null) then shift_def.ShiftStartTime else cast ( substring( cast ( tstmp_add_seconds( cast ('10010102000000' as abap.dec(15,0)), cast( coalesce( shift.CapacityStartTimeID, Header.CapacityStartTime) 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 else coalesce( interval.ValidityEndDate, 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( coalesce( shift.CapacityEndTimeID, Header.CapacityEndTime) as abap.dec(15,0) ), 'FAIL') as abap.sstring(50)), 9,6) as abap.tims) end as ShiftEndTime AS timsendasShiftEndTime,
  Header.WorkCenterResponsible AS WorkCenterResponsible,
  Header.WorkCenterDesc AS WorkCenterDesc,
  Header.WorkCenterCategoryCode AS WorkCenterCategoryCode,
  Header.CapacityCategoryCode AS CapacityCategoryCode,
  Header.CapacityCategoryName AS CapacityCategoryName,
  Header.Capacity AS Capacity,
  Header.CapacityResponsiblePlanner AS CapacityResponsiblePlanner,
  coalesce( coalesce( shift_def.CapacityStartTimeID, shift.CapacityStartTimeID ), Header.CapacityStartTime ) as CapacityStartTime AS CapacityStartTimeasCapacityStartTime,
  coalesce( coalesce( shift_def.CapacityEndTimeID, shift.CapacityEndTimeID ), Header.CapacityEndTime) as CapacityEndTime AS CapacityEndTimeasCapacityEndTime,
  coalesce( interval.AvailableCapacityIntervalDurn, '01' ) AS AvailableCapacityIntervalDurn,
  coalesce( interval.WorkDayRule, '' ) AS WorkDayRule,
  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) else coalesce( shift.TotOperatingDurationInSeconds, 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 then case when shift.CapacityPlanUtilizationPercent > '000' then (cast(shift.OperatingDurationInSeconds as abap.fltp) * cast(100 as abap.fltp) / cast(shift.CapacityPlanUtilizationPercent as abap.fltp) ) else 0 end else cast(Header.SingleCapacity as abap.fltp) end as OperatingDurationInSeconds AS fltpendasOperatingDurationInSeconds,
  coalesce( shift.CapacityNumberOfCapacities, Header.CapacityNumberOfCapacities) AS CapacityNumberOfCapacities,
  coalesce( shift.CapacityPlanUtilizationPercent, Header.CapacityPlanUtilizationPercent) AS CapacityPlanUtilizationPercent
FROM P_WorkCenterHeaderCapacity AS Header
LEFT OUTER JOIN I_WorkCenterCapacityInterval AS interval ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_AvailableCapacityShift AS shift ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_WorkCenterShiftDefinition AS shift_def ON /* join condition not captured in parsed metadata */
;