P_PriceVariance2

DDL: P_PRICEVARIANCE2 SQL: PMMPRICEVAR2 Type: view CONSUMPTION Package: ODATA_MM_ANALYTICS

Price Variance 2

P_PriceVariance2 is a Consumption CDS View that provides data about "Price Variance 2" in SAP S/4HANA. It reads from 1 data source (P_PriceVariance1) and exposes 25 fields with key fields PurchaseOrder, PurchaseOrderItem. It has 1 association to related views. Part of development package ODATA_MM_ANALYTICS.

Data Sources (1)

SourceAliasJoin Type
P_PriceVariance1 P_PriceVariance1 from

Parameters (3)

NameTypeDefault
P_DisplayCurrency displaycurrency
P_StartDate budat
P_EndDate budat

Associations (1)

CardinalityTargetAliasCondition
[1..1] I_PurchasingCategoryMatlGroup _PurchasingCategoryMatlGroup PriceVariance.MaterialGroup = _PurchasingCategoryMatlGroup.MaterialGroup

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PMMPRICEVAR2 view
EndUserText.label Price Variance 2 view
VDM.viewType #CONSUMPTION view
VDM.private true view
AccessControl.authorizationCheck #NOT_REQUIRED view
AccessControl.personalData.blocking #NOT_REQUIRED view

Fields (25)

KeyFieldSource TableSource FieldDescription
KEY PurchaseOrder PurchaseOrder Purchasing Document
KEY PurchaseOrderItem PurchaseOrderItem Purchasing Document Item
PurchasingOrganization PurchasingOrganization Purchasing Organization
Supplier Supplier Supplier
PurchasingGroup PurchasingGroup Purchasing Group
CompanyCode CompanyCode Receiver Company Code
Plant Plant Valuation Area
Material Material Vehicle Model
MaterialGroup PriceVariance MaterialGroup Product Group
PurchasingDocumentCategory PurchasingDocumentCategory Doc. Category
PurchasingCategory
PurgCatName
PurchaseOrderDate PurchaseOrderDate PO Date
Currency Currency Valuation Crcy
NetAmount NetAmount Stated Amount
PurchaseOrderQuantityUnit PurchaseOrderQuantityUnit Order Unit
DeliveredQuantity DeliveredQuantity Qty. in OPUn
OrderedQuantity OrderedQuantity Quantity
InvoiceAmountInDocCurrency InvoiceAmountInDocCurrency
NetPriceAmount NetPriceAmount Net Price
InvoiceAmountPerUnit
PriceVarianceAmount
PurchaseOrderNetPriceAmount
dec173endasAbsolutePriceVariance
OrderPriceUnit OrderPriceUnit Order Price Un.

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_PriceVariance2.
-- 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: PMMPRICEVAR2
-- Parameters: P_DisplayCurrency : displaycurrency, P_StartDate : budat, P_EndDate : budat

CREATE VIEW P_PriceVariance2 AS
SELECT
  PurchaseOrder,
  PurchaseOrderItem,
  PurchasingOrganization,
  Supplier,
  PurchasingGroup,
  CompanyCode,
  Plant,
  Material,
  PriceVariance.MaterialGroup AS MaterialGroup,
  PurchasingDocumentCategory,
  _PurchasingCategoryMatlGroup._PurchasingCategory.PurchasingCategory AS PurchasingCategory,
  _PurchasingCategoryMatlGroup._PurchasingCategory.PurgCatName AS PurgCatName,
  PurchaseOrderDate,
  Currency,
  NetAmount,
  PurchaseOrderQuantityUnit,
  DeliveredQuantity,
  OrderedQuantity,
  InvoiceAmountInDocCurrency,
  NetPriceAmount,
  DIVISION( InvoiceAmount , DeliveredQuantity, 3 ) AS InvoiceAmountPerUnit,
  DIVISION( InvoiceAmount , DeliveredQuantity, 3 )- DIVISION( NetPriceAmount, NetPriceQuantity , 3 ) AS PriceVarianceAmount,
  DIVISION( NetPriceAmount, NetPriceQuantity , 3 ) AS PurchaseOrderNetPriceAmount,
  case when NetPriceAmount = 0 or NetValueAmountInDocCurrency = 0 then 0 else cast(DIVISION( DIVISION( InvoiceAmountInDocCurrency , DeliveredQuantity, 3 ), NetValueAmountInDocCurrency, 3 ) as abap.dec(17,3) ) * cast( 100 as abap.dec(17,3)) end as AbsolutePriceVariance AS dec173endasAbsolutePriceVariance,
  OrderPriceUnit
FROM P_PriceVariance1
LEFT OUTER JOIN I_PurchasingCategoryMatlGroup AS _PurchasingCategoryMatlGroup ON PriceVariance.MaterialGroup = _PurchasingCategoryMatlGroup.MaterialGroup  -- association [1..1]
;