P_InvoicePriceVariance
P_InvoicePriceVariance is a Consumption CDS View in SAP S/4HANA. It reads from 3 data sources (I_CalendarDate, P_InvoicePriceVariance2, I_PurchasingCategoryMatlGroup) and exposes 38 fields with key fields MaterialDocumentYear, Invoice, MaterialDocumentItem.
Data Sources (3)
| Source | Alias | Join Type |
|---|---|---|
| I_CalendarDate | Calendar | left_outer |
| P_InvoicePriceVariance2 | P_InvoicePriceVariance2 | from |
| I_PurchasingCategoryMatlGroup | PurchasingCategoryMatlGroup | left_outer |
Parameters (4)
| Name | Type | Default |
|---|---|---|
| P_DisplayCurrency | displaycurrency | |
| P_Material | matnr | |
| P_StartDate | vdm_validitystart | |
| P_EndDate | vdm_validityend |
Annotations (6)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PMMINVPRCVARC | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AccessControl.authorizationCheck | #CHECK | view | |
| VDM.viewType | #CONSUMPTION | view | |
| VDM.private | true | view | |
| AccessControl.personalData.blocking | #NOT_REQUIRED | view |
Fields (38)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | MaterialDocumentYear | MaterialDocumentYear | ||
| KEY | Invoice | |||
| KEY | MaterialDocumentItem | MaterialDocumentItem | ||
| InvoiceDate | ||||
| CalendarYear | I_CalendarDate | CalendarYear | ||
| CalendarMonth | I_CalendarDate | CalendarMonth | ||
| CalendarQuarter | I_CalendarDate | CalendarQuarter | ||
| CalendarWeek | I_CalendarDate | CalendarWeek | ||
| YearWeek | I_CalendarDate | YearWeek | ||
| YearMonth | I_CalendarDate | YearMonth | ||
| YearQuarter | I_CalendarDate | YearQuarter | ||
| PurchasingOrganization | PurchasingOrganization | |||
| PurchasingGroup | PurchasingGroup | |||
| CompanyCode | CompanyCode | |||
| Supplier | Supplier | |||
| Material | Material | |||
| MaterialGroup | PriceVariance | MaterialGroup | ||
| PurchasingCategory | ||||
| PurgCatName | ||||
| Plant | Plant | |||
| DocNumber | DocNumber | |||
| Currency | Currency | |||
| DisplayCurrency | DisplayCurrency | |||
| NetPriceAmount | ||||
| InvoiceAmtInDisplayCurrency | ||||
| QtyInPurchaseOrderPriceUnit | ||||
| NetPriceQuantity | NetPriceQuantity | |||
| OrderPriceUnit | OrderPriceUnit | |||
| _Material | _Material | |||
| Quantity | Quantity | |||
| _MaterialGroup | PriceVariance | _MaterialGroup | ||
| PurchaseOrderQuantityUnit | PurchaseOrderQuantityUnit | |||
| _Plant | _Plant | |||
| _Supplier | _Supplier | |||
| _PurchasingOrganization | _PurchasingOrganization | |||
| _PurchasingGroup | _PurchasingGroup | |||
| _CompanyCode | _CompanyCode | |||
| _DocText | _DocText |
@AbapCatalog.sqlViewName: 'PMMINVPRCVARC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType : #CONSUMPTION
@VDM.private: true
@AccessControl.personalData.blocking: #NOT_REQUIRED
@AbapCatalog.viewEnhancementCategory: [#PROJECTION_LIST,#GROUP_BY] // Added for extensibility
define view P_InvoicePriceVariance
with parameters
P_DisplayCurrency : displaycurrency,
P_Material : matnr,
P_StartDate : vdm_validitystart,
P_EndDate : vdm_validityend
as select from P_InvoicePriceVariance2 ( P_DisplayCurrency : $parameters.P_DisplayCurrency,
P_Material : $parameters.P_Material, P_StartDate: $parameters.P_StartDate,
P_EndDate: $parameters.P_EndDate ) as PriceVariance
left outer join I_PurchasingCategoryMatlGroup as PurchasingCategoryMatlGroup
on PriceVariance.MaterialGroup = PurchasingCategoryMatlGroup.MaterialGroup
left outer join I_CalendarDate as Calendar
on PriceVariance.PostingDate = Calendar.CalendarDate
{
// key PurchaseOrder,
// key PurchaseOrderItem,
key MaterialDocumentYear,
key cast( MaterialDocument as fikz_reginv_invoice ) as Invoice,
key MaterialDocumentItem,
/* Invoice Date*/
cast( PostingDate as invdt ) as InvoiceDate,
Calendar.CalendarYear,
Calendar.CalendarMonth,
Calendar.CalendarQuarter,
Calendar.CalendarWeek,
Calendar.YearWeek,
Calendar.YearMonth,
Calendar.YearQuarter,
/* Org Data */
PurchasingOrganization,
PurchasingGroup,
CompanyCode,
Supplier,
/* Item Data */
Material,
PriceVariance.MaterialGroup,
PurchasingCategoryMatlGroup._PurchasingCategory.PurchasingCategory as PurchasingCategory,
PurchasingCategoryMatlGroup._PurchasingCategory.PurgCatName,
Plant,
DocNumber,
// @ObjectModel.text.element: [ 'DocName' ]
// DocNumber,
// @Semantics.text: true
// cast( _DocText.DomainText as mm_a_doctype_name ) as DocName,
Currency,
DisplayCurrency,
sum (NetPriceAmount) as NetPriceAmount,
sum(InvoiceAmtInDisplayCurrency) as InvoiceAmtInDisplayCurrency,
sum(QtyInPurchaseOrderPriceUnit) as QtyInPurchaseOrderPriceUnit,
NetPriceQuantity,
OrderPriceUnit,
/*Associations*/
_Material,
Quantity,
PriceVariance._MaterialGroup,
@Semantics.unitOfMeasure: true
PurchaseOrderQuantityUnit,
_Plant,
_Supplier,
_PurchasingOrganization,
_PurchasingGroup,
_CompanyCode,
_DocText
}
where QtyInPurchaseOrderPriceUnit > 0
group by MaterialDocumentYear,
MaterialDocument,
MaterialDocumentItem,
PostingDate,
Calendar.CalendarYear,
Calendar.CalendarMonth,
Calendar.CalendarQuarter,
Calendar.CalendarWeek,
Calendar.YearWeek,
Calendar.YearMonth,
Calendar.YearQuarter,
PurchasingOrganization,
PurchasingGroup,
CompanyCode,
Supplier,
Material,
PriceVariance.MaterialGroup,
PurchasingCategoryMatlGroup._PurchasingCategory.PurchasingCategory,
PurchasingCategoryMatlGroup._PurchasingCategory.PurgCatName,
Plant,
DocNumber,
_DocText.DomainText,
Currency,
DisplayCurrency,
NetPriceQuantity,
OrderPriceUnit,
Quantity,
PurchaseOrderQuantityUnit
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BR_DOMAIN",
"I_CALENDARDATE",
"I_PURCHASINGCATEGORY",
"I_PURCHASINGCATEGORYMATLGROUP",
"P_INVOICEPRICEVARIANCE2"
],
"ASSOCIATED":
[
"I_BR_DOMAIN",
"I_COMPANYCODE",
"I_MATERIAL",
"I_MATERIALGROUP",
"I_PLANT",
"I_PURCHASINGGROUP",
"I_PURCHASINGORGANIZATION",
"I_SUPPLIER"
],
"BASE":
[
"P_INVOICEPRICEVARIANCE2"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- 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