I_PPS_PurchasingHistory

DDL: I_PPS_PURCHASINGHISTORY SQL: IPPSXPOEKPH Type: view BASIC

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)

SourceAliasJoin Type
ekko PurchasingDocument inner
ekpo PurchasingDocumentItem inner
ekbe PurchasingHistory from

Associations (4)

CardinalityTargetAliasCondition
[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)

NameValueLevelField
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)

KeyFieldSource TableSource FieldDescription
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]
;