P_StkKPIAssignToSinglePeriod
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)
| Source | Alias | Join Type |
|---|---|---|
| P_StkComprnTimeFrameAndGrid | P_StkComprnTimeFrameAndGrid | from |
| P_StkKPITimeSeriesAllPeriods | P_StkKPITimeSeriesAllPeriods | inner |
Parameters (6)
| Name | Type | Default |
|---|---|---|
| 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)
| Name | Value | Level | Field |
|---|---|---|---|
| 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)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| 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 */
;
Learn More
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- CDS View Annotations — A Complete Guide
- What Is a CDS View in SAP S/4HANA?
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA
- BSEG to ACDOCA: The Universal Journal Migration
- Business Partner Migration: KNA1/LFA1 to BUT000
- Material Document Migration: MSEG/MKPF to MATDOC
- How to Find the Right CDS View for an SAP Table
- BW Extractor to CDS View Migration Guide
- S/4HANA CDS View Deprecation: What You Need to Know
- ABAP CDS View Tutorial — From Basics to Real-World Examples
- RAP and CDS Views — Building Transactional Apps in SAP S/4HANA
- Sales Document Status Migration: VBUP/VBUK Removal in S/4HANA
- CO Tables in S/4HANA: COEP, COBK, COSS, COSP to ACDOCA