P_StkKPIAssignToSinglePeriod

DDL: P_STKKPIASSIGNTOSINGLEPERIOD Type: view_entity COMPOSITE Package: ODATA_MM_IM_KPITIMESERIES

Assign KPIs to reference period or previous period

P_StkKPIAssignToSinglePeriod is a Composite CDS View that provides data about "Assign KPIs to reference period or previous period" in SAP S/4HANA. It reads from 2 data sources (P_StkComprnTimeFrameAndGrid, P_StkKPITimeSeriesAllPeriods) and exposes 28 fields with key fields ComprnPeriodSequenceNumber, Material, Plant, StorageLocation, Batch. Part of development package ODATA_MM_IM_KPITIMESERIES.

Data Sources (2)

SourceAliasJoin Type
P_StkComprnTimeFrameAndGrid P_StkComprnTimeFrameAndGrid from
P_StkKPITimeSeriesAllPeriods P_StkKPITimeSeriesAllPeriods inner

Parameters (6)

NameTypeDefault
P_StartDateOfPreviousPeriod vdm_v_start_date
P_EndDateOfPreviousPeriod vdm_v_end_date
P_StartDateOfReferencePeriod vdm_v_start_date
P_EndDateOfReferencePeriod vdm_v_end_date
P_PeriodType nsdm_period_type
P_InventoryConsumptionGroup inventory_consumption_group

Annotations (6)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
VDM.viewType #COMPOSITE view
VDM.private true view

Fields (28)

KeyFieldSource TableSource FieldDescription
KEY ComprnPeriodSequenceNumber PeriodGrid InnerPeriod
KEY Material KPITimeSeries Material Vehicle Model
KEY Plant KPITimeSeries Plant Valuation Area
KEY StorageLocation KPITimeSeries StorageLocation StorageLocation
KEY Batch KPITimeSeries Batch Lot No.
KEY Supplier KPITimeSeries Supplier Supplier
KEY SDDocument KPITimeSeries SDDocument SD Document
KEY SDDocumentItem KPITimeSeries SDDocumentItem
KEY WBSElementInternalID KPITimeSeries WBSElementInternalID WBS Internal ID
KEY Customer KPITimeSeries Customer Sold-to Party
KEY InventoryStockType KPITimeSeries InventoryStockType Stock Type
KEY InventorySpecialStockType KPITimeSeries InventorySpecialStockType Special Stock Type
KEY MaterialBaseUnit KPITimeSeries MaterialBaseUnit Valuation Unit
KEY Currency KPITimeSeries Currency Valuation Crcy
CompanyCode KPITimeSeries CompanyCode Receiver Company Code
ComprnPeriodSequenceNumberRef PeriodGrid ComprnPeriodSequenceNumberRef
YearQuarter PeriodGrid YearQuarter Year Quarter
YearMonth PeriodGrid YearMonth Year Month
DayOfMonth PeriodGrid DayOfMonth
ComprnPeriodSequenceNumberPrev PeriodGrid ComprnPeriodSequenceNumberPrev
YearQuarterPrev PeriodGrid YearQuarterPrev Year Quarter
YearMonthPrev PeriodGrid YearMonthPrev Year Month
DayOfMonthPrev PeriodGrid DayOfMonthPrev
quan173endasMatlWrhsStkQtyPeriodPrev
quan173endasMatlWrhsStkQtyPeriodRef
curr172endasStockValueInCCCrcyPeriodPrev
curr172endasStockValueInCCCrcyPeriodRef
curr172endasCnsmpnValueInCCCrcyPeriodRef

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_StkKPIAssignToSinglePeriod.
-- 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.
-- Parameters: P_StartDateOfPreviousPeriod : vdm_v_start_date, P_EndDateOfPreviousPeriod : vdm_v_end_date, P_StartDateOfReferencePeriod : vdm_v_start_date, P_EndDateOfReferencePeriod : vdm_v_end_date, P_PeriodType : nsdm_period_type, P_InventoryConsumptionGroup : inventory_consumption_group

CREATE VIEW P_StkKPIAssignToSinglePeriod AS
SELECT
  PeriodGrid.InnerPeriod AS ComprnPeriodSequenceNumber,
  KPITimeSeries.Material AS Material,
  KPITimeSeries.Plant AS Plant,
  KPITimeSeries.StorageLocation AS StorageLocation,
  KPITimeSeries.Batch AS Batch,
  KPITimeSeries.Supplier AS Supplier,
  KPITimeSeries.SDDocument AS SDDocument,
  KPITimeSeries.SDDocumentItem AS SDDocumentItem,
  KPITimeSeries.WBSElementInternalID AS WBSElementInternalID,
  KPITimeSeries.Customer AS Customer,
  KPITimeSeries.InventoryStockType AS InventoryStockType,
  KPITimeSeries.InventorySpecialStockType AS InventorySpecialStockType,
  KPITimeSeries.MaterialBaseUnit AS MaterialBaseUnit,
  KPITimeSeries.Currency AS Currency,
  KPITimeSeries.CompanyCode AS CompanyCode,
  PeriodGrid.ComprnPeriodSequenceNumberRef AS ComprnPeriodSequenceNumberRef,
  PeriodGrid.YearQuarter AS YearQuarter,
  PeriodGrid.YearMonth AS YearMonth,
  PeriodGrid.DayOfMonth AS DayOfMonth,
  PeriodGrid.ComprnPeriodSequenceNumberPrev AS ComprnPeriodSequenceNumberPrev,
  PeriodGrid.YearQuarterPrev AS YearQuarterPrev,
  PeriodGrid.YearMonthPrev AS YearMonthPrev,
  PeriodGrid.DayOfMonthPrev AS DayOfMonthPrev,
  case when ( PeriodGrid.OuterPeriod = 0 ) then ( KPITimeSeries.MatlWrhsStkQtyInMatlBaseUnit )else ( cast( 0 as abap.quan(17,3) ) )end as MatlWrhsStkQtyPeriodPrev AS quan173endasMatlWrhsStkQtyPeriodPrev,
  case when ( PeriodGrid.OuterPeriod = 1 ) then ( KPITimeSeries.MatlWrhsStkQtyInMatlBaseUnit )else ( cast( 0 as abap.quan(17,3) ) )end as MatlWrhsStkQtyPeriodRef AS quan173endasMatlWrhsStkQtyPeriodRef,
  case when ( PeriodGrid.OuterPeriod = 0 ) then ( KPITimeSeries.StockValueInCCCrcy )else ( cast( 0 as abap.curr(17,2) ) )end as StockValueInCCCrcyPeriodPrev AS curr172endasStockValueInCCCrcyPeriodPrev,
  case when ( PeriodGrid.OuterPeriod = 1 ) then ( KPITimeSeries.StockValueInCCCrcy )else ( cast( 0 as abap.curr(17,2) ) )end as StockValueInCCCrcyPeriodRef AS curr172endasStockValueInCCCrcyPeriodRef,
  case when ( PeriodGrid.OuterPeriod = 1 ) then ( KPITimeSeries.CnsmpnValueInCCCrcy )else ( cast( 0 as abap.curr(17,2) ) )end as CnsmpnValueInCCCrcyPeriodRef AS curr172endasCnsmpnValueInCCCrcyPeriodRef
FROM P_StkComprnTimeFrameAndGrid
INNER JOIN P_StkKPITimeSeriesAllPeriods ON /* join condition not captured in parsed metadata */
;