I_PPS_PurchasingHistory
History Per Purchasing Document
I_PPS_PurchasingHistory is a Basic CDS View that provides data about "History Per Purchasing Document" in SAP S/4HANA. It reads from 3 data sources (ekko, ekpo, ekbe) and exposes 24 fields. It has 4 associations to related views.
Data Sources (3)
Associations (4)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [1..1] | I_CompanyCode | _CompanyCode | PurchasingDocument.bukrs = _CompanyCode.CompanyCode |
| [0..1] | I_PPS_SupplierInvoice | _SupplierInvoice | _SupplierInvoice.PurchasingHistoryDocument = PurchasingHistory.belnr and _SupplierInvoice.FiscalYear = PurchasingHistory.gjahr and _SupplierInvoice.PurchasingHistoryDocumentItem = PurchasingHistory.buzei |
| [0..1] | I_PPS_MaterialDocument | _MaterialDocument | _MaterialDocument.PurchasingHistoryDocument = PurchasingHistory.belnr and _MaterialDocument.FiscalYear = PurchasingHistory.gjahr and _MaterialDocument.PurchasingHistoryDocumentItem = PurchasingHistory.buzei |
| [0..1] | I_AccountingDocument | _AccountingDocument | _AccountingDocument.AccountingDocument = PurchasingHistory.belnr and _AccountingDocument.CompanyCode = PurchasingDocument.bukrs and _AccountingDocument.FiscalYear = PurchasingHistory.gjahr |
Annotations (10)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | IPPSXPOEKPH | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| AccessControl.authorizationCheck | #MANDATORY | view | |
| EndUserText.label | History Per Purchasing Document | view | |
| ObjectModel.usageType.serviceQuality | #X | view | |
| ObjectModel.usageType.sizeCategory | #XXL | view | |
| ObjectModel.usageType.dataClass | #TRANSACTIONAL | view | |
| VDM.viewType | #BASIC | view |
Fields (24)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| PurchasingDocument | ekbe | ebeln | Source PurchDoc | |
| PurchasingDocumentItem | ekbe | ebelp | Item pur. doc. | |
| PPSPurgHistDocumentCategory | ekbe | vgabe | Transact. Type | |
| CompanyCode | ekko | bukrs | Value | |
| FiscalYear | ekbe | gjahr | Settlement Year | |
| PurchasingHistoryDocument | ekbe | belnr | SD Document | |
| PurchasingHistoryDocumentItem | ekbe | buzei | Posting View Item | |
| PurchasingDocumentType | ekko | bsart | Stnd purch.ord. | |
| PurchasingOrganization | ekko | ekorg | Purchasing Org. | |
| PurchasingGroup | ekko | ekgrp | Sub. purchasing grp | |
| xblnrendasPPSReferenceDocument | ||||
| bsartelseendasPPSReferenceDocumentType | ||||
| vgabeelseendasReferenceDocumentCategory | ||||
| bukrsendasReferenceCompanyCode | ||||
| gjahrendasReferenceDocumentFiscalYear | ||||
| PostingDate | ekbe | budat | Posting Date | |
| mengeendasQuantity | ||||
| UnitOfMeasure | ekpo | meins | Valuation Unit | |
| bpmngendasPurchaseOrderQty | ||||
| POUnitOfMeasure | ekpo | bprme | PO Price Unit | |
| dmbtrendasAmountInLocalCurrency | ||||
| LocalCurrency | _CompanyCode | Currency | Valuation Crcy | |
| wrbtrendasNetValueAmountInDocCurrency | ||||
| DocumentCurrency | ekbe | waers | Transaction Currency |
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 I_PPS_PurchasingHistory.
-- 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: IPPSXPOEKPH
CREATE VIEW I_PPS_PurchasingHistory AS
SELECT
PurchasingHistory.ebeln AS PurchasingDocument,
PurchasingHistory.ebelp AS PurchasingDocumentItem,
PurchasingHistory.vgabe AS PPSPurgHistDocumentCategory,
PurchasingDocument.bukrs AS CompanyCode,
PurchasingHistory.gjahr AS FiscalYear,
PurchasingHistory.belnr AS PurchasingHistoryDocument,
PurchasingHistory.buzei AS PurchasingHistoryDocumentItem,
PurchasingDocument.bsart AS PurchasingDocumentType,
PurchasingDocument.ekorg AS PurchasingOrganization,
PurchasingDocument.ekgrp AS PurchasingGroup,
case when PurchasingHistory.xblnr = ' ' then case when PurchasingHistory.vgabe = 'A' or PurchasingHistory.vgabe = 'C' or PurchasingHistory.vgabe = '5' or PurchasingHistory.vgabe = '4' or PurchasingHistory.vgabe = '1' or PurchasingHistory.vgabe = '2' or PurchasingHistory.vgabe = 'V' then PurchasingHistory.ebeln else ' ' end else PurchasingHistory.xblnr end as PPSReferenceDocument AS xblnrendasPPSReferenceDocument,
case when PurchasingHistory.vgabe = 'A' or PurchasingHistory.vgabe = 'C' or PurchasingHistory.vgabe = '5' or PurchasingHistory.vgabe = '4' or PurchasingHistory.vgabe = '1' or PurchasingHistory.vgabe = '2' or PurchasingHistory.vgabe = 'V' then PurchasingDocument.bsart else ' ' end as PPSReferenceDocumentType AS bsartelseendasPPSReferenceDocumentType,
case when PurchasingHistory.vgabe = 'A' or PurchasingHistory.vgabe = 'C' or PurchasingHistory.vgabe = '5' or PurchasingHistory.vgabe = '4' or PurchasingHistory.vgabe = '1' or PurchasingHistory.vgabe = '2' or PurchasingHistory.vgabe = 'V' then PurchasingHistory.vgabe else ' ' end as ReferenceDocumentCategory AS vgabeelseendasReferenceDocumentCategory,
case when PurchasingHistory.xblnr = ' ' then cast ( case when PurchasingHistory.vgabe = 'A' or PurchasingHistory.vgabe = 'C' or PurchasingHistory.vgabe = '5' or PurchasingHistory.vgabe = '4' or PurchasingHistory.vgabe = '1' or PurchasingHistory.vgabe = '2' or PurchasingHistory.vgabe = 'V' then ' ' else ' ' end as bukrs ) else PurchasingDocument.bukrs end as ReferenceCompanyCode AS bukrsendasReferenceCompanyCode,
case when PurchasingHistory.xblnr = ' ' then cast ( case when PurchasingHistory.vgabe = 'A' or PurchasingHistory.vgabe = 'C' or PurchasingHistory.vgabe = '5' or PurchasingHistory.vgabe = '4' or PurchasingHistory.vgabe = '1' or PurchasingHistory.vgabe = '2' or PurchasingHistory.vgabe = 'V' then ' ' else ' ' end as gjahr ) else PurchasingHistory.gjahr end as ReferenceDocumentFiscalYear AS gjahrendasReferenceDocumentFiscalYear,
PurchasingHistory.budat AS PostingDate,
case PurchasingHistory.shkzg when 'H' then sum ( PurchasingHistory.menge ) * -1 else sum ( PurchasingHistory.menge ) end as Quantity AS mengeendasQuantity,
PurchasingDocumentItem.meins AS UnitOfMeasure,
case PurchasingHistory.shkzg when 'H' then sum ( PurchasingHistory.bpmng ) * -1 else sum ( PurchasingHistory.bpmng ) end as PurchaseOrderQty AS bpmngendasPurchaseOrderQty,
PurchasingDocumentItem.bprme AS POUnitOfMeasure,
case PurchasingHistory.shkzg when 'H' then sum( PurchasingHistory.dmbtr ) * -1 else sum( PurchasingHistory.dmbtr ) end as AmountInLocalCurrency AS dmbtrendasAmountInLocalCurrency,
_CompanyCode.Currency AS LocalCurrency,
case PurchasingHistory.shkzg when 'H' then sum( PurchasingHistory.wrbtr ) * -1 else sum( PurchasingHistory.wrbtr ) end as NetValueAmountInDocCurrency AS wrbtrendasNetValueAmountInDocCurrency,
PurchasingHistory.waers AS DocumentCurrency
FROM ekbe AS PurchasingHistory
INNER JOIN ekko AS PurchasingDocument ON /* join condition not captured in parsed metadata */
INNER JOIN ekpo AS PurchasingDocumentItem ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_CompanyCode AS _CompanyCode ON PurchasingDocument.bukrs = _CompanyCode.CompanyCode -- association [1..1]
LEFT OUTER JOIN I_PPS_SupplierInvoice AS _SupplierInvoice ON _SupplierInvoice.PurchasingHistoryDocument = PurchasingHistory.belnr AND _SupplierInvoice.FiscalYear = PurchasingHistory.gjahr AND _SupplierInvoice.PurchasingHistoryDocumentItem = PurchasingHistory.buzei -- association [0..1]
LEFT OUTER JOIN I_PPS_MaterialDocument AS _MaterialDocument ON _MaterialDocument.PurchasingHistoryDocument = PurchasingHistory.belnr AND _MaterialDocument.FiscalYear = PurchasingHistory.gjahr AND _MaterialDocument.PurchasingHistoryDocumentItem = PurchasingHistory.buzei -- association [0..1]
LEFT OUTER JOIN I_AccountingDocument AS _AccountingDocument ON _AccountingDocument.AccountingDocument = PurchasingHistory.belnr AND _AccountingDocument.CompanyCode = PurchasingDocument.bukrs AND _AccountingDocument.FiscalYear = PurchasingHistory.gjahr -- association [0..1]
;
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