P_DailyWeeklyMnthlyPIR

DDL: P_DAILYWEEKLYMNTHLYPIR SQL: PDAYWKMNTHPIR Type: view COMPOSITE

P_DailyWeeklyMnthlyPIR is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_ProdPlantPlndIndepRqmtBasic, I_PlndIndepRqmtItemBasic) and exposes 11 fields with key fields Product, Plant, MRPArea. It has 1 association to related views.

Data Sources (2)

SourceAliasJoin Type
I_ProdPlantPlndIndepRqmtBasic _PIRBasic inner
I_PlndIndepRqmtItemBasic _PlndIndReq from

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_CalendarDate _CalendarDate _PlndIndReq.WorkingDayDate = _CalendarDate.CalendarDate

Annotations (5)

NameValueLevelField
AbapCatalog.sqlViewName PDAYWKMNTHPIR view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.viewType #COMPOSITE view
VDM.private true view

Fields (11)

KeyFieldSource TableSource FieldDescription
KEY Product I_PlndIndepRqmtItemBasic Product Product Sold
KEY Plant I_PlndIndepRqmtItemBasic Plant Valuation Area
KEY MRPArea MRPArea MRP Area
PostingDate WorkingDayDate
PlndIndepRqmtType I_PlndIndepRqmtItemBasic PlndIndepRqmtType ReqType IndReq.
PeriodType I_PlndIndepRqmtItemBasic PeriodType PeriodIndicator
UnitOfMeasure I_PlndIndepRqmtItemBasic UnitOfMeasure Unit Protected Qty
PlndIndepRqmtIsActive I_PlndIndepRqmtItemBasic PlndIndepRqmtIsActive
FirstDayOfMonthDateendasStartDate
LastDayOfMonthDateendasEndDate
NumberOfDays3endasQuantityInBaseUnit

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_DailyWeeklyMnthlyPIR.
-- 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: PDAYWKMNTHPIR

CREATE VIEW P_DailyWeeklyMnthlyPIR AS
SELECT
  _PlndIndReq.Product AS Product,
  _PlndIndReq.Plant AS Plant,
  MRPArea,
  WorkingDayDate AS PostingDate,
  _PlndIndReq.PlndIndepRqmtType AS PlndIndepRqmtType,
  _PlndIndReq.PeriodType AS PeriodType,
  _PlndIndReq.UnitOfMeasure AS UnitOfMeasure,
  _PlndIndReq.PlndIndepRqmtIsActive AS PlndIndepRqmtIsActive,
  case _PlndIndReq.PeriodType when 'D' then WorkingDayDate when 'W' then _CalendarDate.FirstDayOfWeekDate when 'M' then _CalendarDate.FirstDayOfMonthDate end as StartDate AS FirstDayOfMonthDateendasStartDate,
  case _PlndIndReq.PeriodType when 'D' then WorkingDayDate when 'W' then dats_add_days(_CalendarDate.FirstDayOfWeekDate, 6, 'NULL') when 'M' then _CalendarDate._YearMonth.LastDayOfMonthDate end as EndDate AS LastDayOfMonthDateendasEndDate,
  case _PlndIndReq.PeriodType when 'D' then PlannedQuantity when 'W' then division( _PlndIndReq.PlannedQuantity, 7, 3 ) when 'M' then division( PlannedQuantity, _CalendarDate._YearMonth.NumberOfDays, 3) end as QuantityInBaseUnit AS NumberOfDays3endasQuantityInBaseUnit
FROM I_PlndIndepRqmtItemBasic AS _PlndIndReq
INNER JOIN I_ProdPlantPlndIndepRqmtBasic AS _PIRBasic ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_CalendarDate AS _CalendarDate ON _PlndIndReq.WorkingDayDate = _CalendarDate.CalendarDate  -- association [0..1]
;