C_GRIRPurchaseOrderHistory
GR/IR Purchase Order History
C_GRIRPurchaseOrderHistory is a Consumption CDS View that provides data about "GR/IR Purchase Order History" in SAP S/4HANA. It reads from 1 data source (P_GRIRPurchaseOrderHistory1) and exposes 54 fields with key fields PurchasingDocument, PurchasingDocumentItem, AccountAssignmentNumber, ConditionStep, ConditionCount. It has 9 associations to related views.
Data Sources (1)
| Source | Alias | Join Type |
|---|---|---|
| P_GRIRPurchaseOrderHistory1 | P_GRIRPurchaseOrderHistory1 | from |
Associations (9)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [0..1] | I_Supplier | _SupplierText | $projection.Supplier = _SupplierText.Supplier |
| [0..1] | I_CompanyCode | _CompanyCode | $projection.CompanyCode = _CompanyCode.CompanyCode |
| [0..1] | I_PurchasingDocument | _PurchasingDocument | $projection.PurchasingDocument = _PurchasingDocument.PurchasingDocument |
| [1..1] | I_PurchaseOrderHistCategory | _PurchaseOrderHistCategory | $projection.PurchasingHistoryCategory = _PurchaseOrderHistCategory.PurchaseOrderHistCategory |
| [0..*] | I_PurOrderHistoryCategoryText | _PurchaseOrderHistCategName | $projection.PurchasingHistoryCategory = _PurchaseOrderHistCategName.PurchaseOrderHistCategory |
| [1..1] | I_PurchasingDocumentItem | _PurchasingDocumentItem | $projection.PurchasingDocument = _PurchasingDocumentItem.PurchasingDocument and $projection.PurchasingDocumentItem = _PurchasingDocumentItem.PurchasingDocumentItem |
| [0..1] | C_GRIRSupplierInvoiceItem | _GRIRSupplierInvoiceItem | $projection.SupplierInvoice = _GRIRSupplierInvoiceItem.SupplierInvoice and $projection.SupplierInvoiceItem = _GRIRSupplierInvoiceItem.SupplierInvoiceItem and $projection.PurchasingHistoryDocumentYear = _GRIRSupplierInvoiceItem.FiscalYear and ( $projection.PurchasingHistoryCategory = 'G' or $projection.PurchasingHistoryCategory = 'I' or $projection.PurchasingHistoryCategory = 'K' or $projection.PurchasingHistoryCategory = 'M' or $projection.PurchasingHistoryCategory = 'N' or $projection.PurchasingHistoryCategory = 'P' or $projection.PurchasingHistoryCategory = 'Q' or $projection.PurchasingHistoryCategory = 'R' or $projection.PurchasingHistoryCategory = 'S' or $projection.PurchasingHistoryCategory = 'T' or $projection.PurchasingHistoryCategory = 'W' or $projection.PurchasingHistoryCategory = 'X' ) |
| [0..1] | C_GRIRMaterialDocumentItem | _GRIRMaterialDocumentItem | $projection.PurchasingHistoryDocument = _GRIRMaterialDocumentItem.MaterialDocument and $projection.PurchasingHistoryDocumentItem = _GRIRMaterialDocumentItem.MaterialDocumentItem and $projection.PurchasingHistoryDocumentYear = _GRIRMaterialDocumentItem.MaterialDocumentYear and ( $projection.PurchasingHistoryCategory = 'E' or $projection.PurchasingHistoryCategory = 'F' ) |
| [0..1] | I_GRIRProcess | _GRIRProcess | $projection.CompanyCode = _GRIRProcess.CompanyCode and $projection.PurchasingDocument = _GRIRProcess.PurchasingDocument and $projection.PurchasingDocumentItem = _GRIRProcess.PurchasingDocumentItem |
Annotations (11)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.preserveKey | true | view | |
| AbapCatalog.sqlViewName | CFIGRIRPURORDHIS | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AccessControl.authorizationCheck | #CHECK | view | |
| EndUserText.label | GR/IR Purchase Order History | view | |
| VDM.viewType | #CONSUMPTION | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| ObjectModel.usageType.sizeCategory | #L | view | |
| ObjectModel.usageType.dataClass | #MIXED | view | |
| ObjectModel.usageType.serviceQuality | #C | view | |
| UI.textArrangement | #TEXT_LAST | view |
Fields (54)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | PurchasingDocument | |||
| KEY | PurchasingDocumentItem | |||
| KEY | AccountAssignmentNumber | P_GRIRPurchaseOrderHistory1 | AccountAssignmentNumber | Account Assgmt No. |
| KEY | ConditionStep | |||
| KEY | ConditionCount | P_GRIRPurchaseOrderHistory1 | ConditionCount | |
| KEY | PurchasingHistoryDocumentType | |||
| KEY | PurchasingHistoryDocumentYear | |||
| KEY | PurchasingHistoryDocument | |||
| KEY | PurchasingHistoryDocumentItem | |||
| SupplierInvoice | ||||
| SupplierInvoiceItem | ||||
| CompanyCode | _PurchasingDocumentItem | CompanyCode | Receiver Company Code | |
| PurchasingHistoryCategory | P_GRIRPurchaseOrderHistory1 | PurchasingHistoryCategory | ||
| GoodsMovementType | P_GRIRPurchaseOrderHistory1 | GoodsMovementType | Movement Type | |
| PostingDate | P_GRIRPurchaseOrderHistory1 | PostingDate | Posting Date for GR | |
| CompanyCodeCurrency | ||||
| TransactionCurrency | ||||
| DebitCreditCode | P_GRIRPurchaseOrderHistory1 | DebitCreditCode | Single-Character Flag | |
| IsCompletelyDelivered | P_GRIRPurchaseOrderHistory1 | IsCompletelyDelivered | Is completely delivered | |
| ReferenceDocument | P_GRIRPurchaseOrderHistory1 | ReferenceDocument | Reference Document | |
| ReferenceDocumentFiscalYear | P_GRIRPurchaseOrderHistory1 | ReferenceDocumentFiscalYear | Year Cur.Period | |
| ReferenceDocumentItem | P_GRIRPurchaseOrderHistory1 | ReferenceDocumentItem | Reference item | |
| Material | P_GRIRPurchaseOrderHistory1 | Material | Vehicle Model | |
| Plant | _PurchasingDocumentItem | Plant | Valuation Area | |
| DocumentDate | P_GRIRPurchaseOrderHistory1 | DocumentDate | Journal Entry Date | |
| DocumentReferenceID | P_GRIRPurchaseOrderHistory1 | DocumentReferenceID | Reference | |
| OrderQuantityUnit | ||||
| Supplier | _PurchasingDocument | Supplier | Supplier | |
| PurchasingGroup | ||||
| PurchasingOrganization | ||||
| OrderPriceUnit | _PurchasingDocumentItem | OrderPriceUnit | Order Price Un. | |
| BaseUnit | _PurchasingDocumentItem | BaseUnit | Unit of Measure | |
| MaterialGroup | _PurchasingDocumentItem | MaterialGroup | Product Group | |
| PurgDocTransactionCurrency | ||||
| PurchasingDocumentCategory | _PurchasingDocumentItem | PurchasingDocumentCategory | Doc. Category | |
| PurchasingDocumentType | _PurchasingDocument | PurchasingDocumentType | RFQ Type | |
| AccountingDocumentCreationDate | P_GRIRPurchaseOrderHistory1 | AccountingDocumentCreationDate | Journal Entry Date | |
| PurgHistDocumentCreationTime | P_GRIRPurchaseOrderHistory1 | PurgHistDocumentCreationTime | ||
| _PurchasingDocumentItem | _PurchasingDocumentItem | |||
| _OrderQuantityUnit | _PurchasingDocumentItem | _OrderQuantityUnit | ||
| _MaterialGroup | _PurchasingDocumentItem | _MaterialGroup | ||
| _OrderPriceUnit | _PurchasingDocumentItem | _OrderPriceUnit | ||
| _Plant | _PurchasingDocumentItem | _Plant | ||
| _PurgDocumentCategory | _PurchasingDocumentItem | _PurgDocumentCategory | ||
| _DocumentCurrency | _PurchasingDocument | _DocumentCurrency | ||
| _Supplier | _PurchasingDocument | _Supplier | ||
| _PurchasingDocument | _PurchasingDocument | |||
| _PurchaseOrderHistCategory | _PurchaseOrderHistCategory | |||
| _CompanyCode | _CompanyCode | |||
| _GRIRSupplierInvoiceItem | _GRIRSupplierInvoiceItem | |||
| _GRIRMaterialDocumentItem | _GRIRMaterialDocumentItem | |||
| _GRIRProcess | _GRIRProcess | |||
| _PurchaseOrderHistCategName | _PurchaseOrderHistCategName | |||
| _SupplierText | _SupplierText |
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 C_GRIRPurchaseOrderHistory.
-- 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: CFIGRIRPURORDHIS
CREATE VIEW C_GRIRPurchaseOrderHistory AS
SELECT
cast( P_GRIRPurchaseOrderHistory1.PurchasingDocument as fis_ebeln preserving type) AS PurchasingDocument,
cast( P_GRIRPurchaseOrderHistory1.PurchasingDocumentItem as fis_ebelp preserving type) AS PurchasingDocumentItem,
P_GRIRPurchaseOrderHistory1.AccountAssignmentNumber AS AccountAssignmentNumber,
cast(P_GRIRPurchaseOrderHistory1.ConditionStep as fis_stunr preserving type) AS ConditionStep,
P_GRIRPurchaseOrderHistory1.ConditionCount AS ConditionCount,
cast(P_GRIRPurchaseOrderHistory1.PurchasingHistoryDocumentType as fis_grir_po_his_doctype preserving type) AS PurchasingHistoryDocumentType,
cast(P_GRIRPurchaseOrderHistory1.PurchasingHistoryDocumentYear as fis_grir_po_his_docyear preserving type) AS PurchasingHistoryDocumentYear,
cast(P_GRIRPurchaseOrderHistory1.PurchasingHistoryDocument as fis_grir_po_his_docnr preserving type) AS PurchasingHistoryDocument,
cast(P_GRIRPurchaseOrderHistory1.PurchasingHistoryDocumentItem as fis_grir_po_his_docln preserving type) AS PurchasingHistoryDocumentItem,
cast( P_GRIRPurchaseOrderHistory1.PurchasingHistoryDocument as belnr_d ) AS SupplierInvoice,
cast( cast( concat('00', P_GRIRPurchaseOrderHistory1.PurchasingHistoryDocumentItem) as abap.numc(6) ) as rblgp ) AS SupplierInvoiceItem,
_PurchasingDocumentItem.CompanyCode AS CompanyCode,
P_GRIRPurchaseOrderHistory1.PurchasingHistoryCategory AS PurchasingHistoryCategory,
P_GRIRPurchaseOrderHistory1.GoodsMovementType AS GoodsMovementType,
P_GRIRPurchaseOrderHistory1.PostingDate AS PostingDate,
cast( P_GRIRPurchaseOrderHistory1.CompanyCodeCurrency as fis_hwaer preserving type ) AS CompanyCodeCurrency,
cast( P_GRIRPurchaseOrderHistory1.Currency as fis_rwcur preserving type) AS TransactionCurrency,
P_GRIRPurchaseOrderHistory1.DebitCreditCode AS DebitCreditCode,
P_GRIRPurchaseOrderHistory1.IsCompletelyDelivered AS IsCompletelyDelivered,
P_GRIRPurchaseOrderHistory1.ReferenceDocument AS ReferenceDocument,
P_GRIRPurchaseOrderHistory1.ReferenceDocumentFiscalYear AS ReferenceDocumentFiscalYear,
P_GRIRPurchaseOrderHistory1.ReferenceDocumentItem AS ReferenceDocumentItem,
P_GRIRPurchaseOrderHistory1.Material AS Material,
_PurchasingDocumentItem.Plant AS Plant,
P_GRIRPurchaseOrderHistory1.DocumentDate AS DocumentDate,
P_GRIRPurchaseOrderHistory1.DocumentReferenceID AS DocumentReferenceID,
cast( _PurchasingDocumentItem.OrderQuantityUnit as fis_bstme preserving type) AS OrderQuantityUnit,
_PurchasingDocument.Supplier AS Supplier,
cast(_PurchasingDocument.PurchasingGroup as fis_grir_ekgrp preserving type ) AS PurchasingGroup,
cast(_PurchasingDocument.PurchasingOrganization as fis_grir_ekorg preserving type ) AS PurchasingOrganization,
_PurchasingDocumentItem.OrderPriceUnit AS OrderPriceUnit,
_PurchasingDocumentItem.BaseUnit AS BaseUnit,
_PurchasingDocumentItem.MaterialGroup AS MaterialGroup,
cast( _PurchasingDocument.DocumentCurrency as fis_ebeln_waers preserving type) AS PurgDocTransactionCurrency,
_PurchasingDocumentItem.PurchasingDocumentCategory AS PurchasingDocumentCategory,
_PurchasingDocument.PurchasingDocumentType AS PurchasingDocumentType,
P_GRIRPurchaseOrderHistory1.AccountingDocumentCreationDate AS AccountingDocumentCreationDate,
P_GRIRPurchaseOrderHistory1.PurgHistDocumentCreationTime AS PurgHistDocumentCreationTime,
_PurchasingDocumentItem._OrderQuantityUnit AS _OrderQuantityUnit,
_PurchasingDocumentItem._MaterialGroup AS _MaterialGroup,
_PurchasingDocumentItem._OrderPriceUnit AS _OrderPriceUnit,
_PurchasingDocumentItem._Plant AS _Plant,
_PurchasingDocumentItem._PurgDocumentCategory AS _PurgDocumentCategory,
_PurchasingDocument._DocumentCurrency AS _DocumentCurrency,
_PurchasingDocument._Supplier AS _Supplier
FROM P_GRIRPurchaseOrderHistory1
LEFT OUTER JOIN I_Supplier AS _SupplierText ON Supplier = _SupplierText.Supplier -- association [0..1]
LEFT OUTER JOIN I_CompanyCode AS _CompanyCode ON CompanyCode = _CompanyCode.CompanyCode -- association [0..1]
LEFT OUTER JOIN I_PurchasingDocument AS _PurchasingDocument ON PurchasingDocument = _PurchasingDocument.PurchasingDocument -- association [0..1]
LEFT OUTER JOIN I_PurchaseOrderHistCategory AS _PurchaseOrderHistCategory ON PurchasingHistoryCategory = _PurchaseOrderHistCategory.PurchaseOrderHistCategory -- association [1..1]
LEFT OUTER JOIN I_PurOrderHistoryCategoryText AS _PurchaseOrderHistCategName ON PurchasingHistoryCategory = _PurchaseOrderHistCategName.PurchaseOrderHistCategory -- association [0..*]
LEFT OUTER JOIN I_PurchasingDocumentItem AS _PurchasingDocumentItem ON PurchasingDocument = _PurchasingDocumentItem.PurchasingDocument AND PurchasingDocumentItem = _PurchasingDocumentItem.PurchasingDocumentItem -- association [1..1]
LEFT OUTER JOIN C_GRIRSupplierInvoiceItem AS _GRIRSupplierInvoiceItem ON SupplierInvoice = _GRIRSupplierInvoiceItem.SupplierInvoice AND SupplierInvoiceItem = _GRIRSupplierInvoiceItem.SupplierInvoiceItem AND PurchasingHistoryDocumentYear = _GRIRSupplierInvoiceItem.FiscalYear AND ( PurchasingHistoryCategory = 'G' OR PurchasingHistoryCategory = 'I' OR PurchasingHistoryCategory = 'K' OR PurchasingHistoryCategory = 'M' OR PurchasingHistoryCategory = 'N' OR PurchasingHistoryCategory = 'P' OR PurchasingHistoryCategory = 'Q' OR PurchasingHistoryCategory = 'R' OR PurchasingHistoryCategory = 'S' OR PurchasingHistoryCategory = 'T' OR PurchasingHistoryCategory = 'W' OR PurchasingHistoryCategory = 'X' ) -- association [0..1]
LEFT OUTER JOIN C_GRIRMaterialDocumentItem AS _GRIRMaterialDocumentItem ON PurchasingHistoryDocument = _GRIRMaterialDocumentItem.MaterialDocument AND PurchasingHistoryDocumentItem = _GRIRMaterialDocumentItem.MaterialDocumentItem AND PurchasingHistoryDocumentYear = _GRIRMaterialDocumentItem.MaterialDocumentYear AND ( PurchasingHistoryCategory = 'E' OR PurchasingHistoryCategory = 'F' ) -- association [0..1]
LEFT OUTER JOIN I_GRIRProcess AS _GRIRProcess ON CompanyCode = _GRIRProcess.CompanyCode AND PurchasingDocument = _GRIRProcess.PurchasingDocument AND PurchasingDocumentItem = _GRIRProcess.PurchasingDocumentItem -- 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