P_RSHWCCapacityWithNights

DDL: P_RSHWCCAPACITYWITHNIGHTS SQL: PRSHWCCAPWNIGHT Type: view CONSUMPTION

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.

Data Sources (2)

SourceAliasJoin Type
P_RSHWCCapacityDefinition CapaDef from
P_RSHWCNightSplit NightSplit left_outer

Annotations (6)

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

Fields (15)

KeyFieldSource TableSource FieldDescription
KEY CapacityInternalID P_RSHWCCapacityDefinition CapacityInternalID Capacity ID
KEY WeekDayendasWeekDay
KEY AvailableCapacityShift P_RSHWCCapacityDefinition AvailableCapacityShift Capacity Shift
AvailableCapacityIntervalDurn P_RSHWCCapacityDefinition AvailableCapacityIntervalDurn
WorkDayRule P_RSHWCCapacityDefinition WorkDayRule Recurrence Weekdays
fltpendendasOperatingDurationInSeconds
fltpendendasCapacityBreakDuration
CapacityNumberOfCapacities P_RSHWCCapacityDefinition CapacityNumberOfCapacities
CapacityPlanUtilizationPercent P_RSHWCCapacityDefinition CapacityPlanUtilizationPercent
WorkCenterInternalID P_RSHWCCapacityDefinition WorkCenterInternalID Work Center
WorkCenter P_RSHWCCapacityDefinition WorkCenter Work Center
WorkCenterCategoryCode P_RSHWCCapacityDefinition WorkCenterCategoryCode
WorkCenterTypeCode P_RSHWCCapacityDefinition WorkCenterTypeCode Object Type
Plant P_RSHWCCapacityDefinition Plant Valuation Area
FactoryCalendar P_RSHWCCapacityDefinition FactoryCalendar Factory Calendar

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: PRSHWCCAPWNIGHT

CREATE VIEW P_RSHWCCapacityWithNights AS
SELECT
  CapaDef.CapacityInternalID AS CapacityInternalID,
  case when NightSplitDate = 2 and AvailableCapacityIntervalDurn = '07' then case 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' end else CapaDef.WeekDay end as WeekDay AS WeekDayendasWeekDay,
  CapaDef.AvailableCapacityShift AS AvailableCapacityShift,
  CapaDef.AvailableCapacityIntervalDurn AS AvailableCapacityIntervalDurn,
  CapaDef.WorkDayRule AS WorkDayRule,
  case when OperatingDurationInSeconds = 0 or NightSplitDate is null then OperatingDurationInSeconds else case when NightSplit.NightSplitDate = 1 then cast( 86400 - CapacityStartTime as abap.fltp) / ( cast ( 86400 - CapacityStartTime + CapacityEndTime as abap.fltp )) * cast(OperatingDurationInSeconds as abap.fltp) else cast(CapacityEndTime as abap.fltp) / ( cast ( 86400 - CapacityStartTime + CapacityEndTime as abap.fltp ) ) * cast(OperatingDurationInSeconds as abap.fltp) end end as OperatingDurationInSeconds AS fltpendendasOperatingDurationInSeconds,
  case when NightSplitDate is null or CapacityBreakDuration = 0 or OperatingDurationInSeconds = 0 then CapacityBreakDuration else case when NightSplitDate = 1 then cast( 86400 - CapacityStartTime as abap.fltp) / ( cast( ( 86400 - CapacityStartTime + CapacityEndTime ) as abap.fltp ) ) * cast(CapacityBreakDuration as abap.fltp) else cast(CapacityEndTime as abap.fltp) / ( cast ( ( 86400 - CapacityStartTime + CapacityEndTime ) as abap.fltp ) ) * cast(CapacityBreakDuration as abap.fltp) end end as 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
LEFT OUTER JOIN P_RSHWCNightSplit AS NightSplit ON /* join condition not captured in parsed metadata */
;