P_RSHWCCapacityWithNights is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (P_RSHWCCapacityDefinition, P_RSHWCNightSplit) and exposes 15 fields with key fields CapacityInternalID, WeekDayendasWeekDay, AvailableCapacityShift.
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_RSHWCCapacityWithNights.-- 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: PRSHWCCAPWNIGHTCREATE VIEW P_RSHWCCapacityWithNights ASSELECT
CapaDef.CapacityInternalID AS CapacityInternalID,
casewhen NightSplitDate = 2 and AvailableCapacityIntervalDurn = '07' thencase CapaDef.WeekDay when '1' then '2' when '2' then '3' when '3' then '4' when '4' then '5' when '5' then '6' when '6' then '7' when '7' then '1' endelse CapaDef.WeekDay endas WeekDay AS WeekDayendasWeekDay,
CapaDef.AvailableCapacityShift AS AvailableCapacityShift,
CapaDef.AvailableCapacityIntervalDurn AS AvailableCapacityIntervalDurn,
CapaDef.WorkDayRule AS WorkDayRule,
casewhen OperatingDurationInSeconds = 0 or NightSplitDate isnullthen OperatingDurationInSeconds elsecasewhen NightSplit.NightSplitDate = 1 thencast( 86400 - CapacityStartTime as abap.fltp) / ( cast ( 86400 - CapacityStartTime + CapacityEndTime as abap.fltp )) * cast(OperatingDurationInSeconds as abap.fltp) elsecast(CapacityEndTime as abap.fltp) / ( cast ( 86400 - CapacityStartTime + CapacityEndTime as abap.fltp ) ) * cast(OperatingDurationInSeconds as abap.fltp) endendas OperatingDurationInSeconds AS fltpendendasOperatingDurationInSeconds,
casewhen NightSplitDate isnullor CapacityBreakDuration = 0 or OperatingDurationInSeconds = 0 then CapacityBreakDuration elsecasewhen NightSplitDate = 1 thencast( 86400 - CapacityStartTime as abap.fltp) / ( cast( ( 86400 - CapacityStartTime + CapacityEndTime ) as abap.fltp ) ) * cast(CapacityBreakDuration as abap.fltp) elsecast(CapacityEndTime as abap.fltp) / ( cast ( ( 86400 - CapacityStartTime + CapacityEndTime ) as abap.fltp ) ) * cast(CapacityBreakDuration as abap.fltp) endendas CapacityBreakDuration AS fltpendendasCapacityBreakDuration,
CapaDef.CapacityNumberOfCapacities AS CapacityNumberOfCapacities,
CapaDef.CapacityPlanUtilizationPercent AS CapacityPlanUtilizationPercent,
CapaDef.WorkCenterInternalID AS WorkCenterInternalID,
CapaDef.WorkCenter AS WorkCenter,
CapaDef.WorkCenterCategoryCode AS WorkCenterCategoryCode,
CapaDef.WorkCenterTypeCode AS WorkCenterTypeCode,
CapaDef.Plant AS Plant,
CapaDef.FactoryCalendar AS FactoryCalendar
FROM P_RSHWCCapacityDefinition AS CapaDef
LEFTOUTERJOIN P_RSHWCNightSplit AS NightSplit ON /* join condition not captured in parsed metadata */
;