P_RU_PurchaseOrderHistoryGR
P_RU_PurchaseOrderHistoryGR is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (I_MaterialDocumentRecord, I_PurchasingDocumentHistory) and exposes 21 fields.
Data Sources (2)
| Source | Alias | Join Type |
|---|---|---|
| I_MaterialDocumentRecord | MatDocItem | inner |
| I_PurchasingDocumentHistory | PurchDocItemHistGR | from |
Annotations (6)
| Name | Value | Level | Field |
|---|---|---|---|
| VDM.private | true | view | |
| VDM.viewType | #CONSUMPTION | view | |
| AbapCatalog.sqlViewName | PRUPURORDHGR | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view |
Fields (21)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| PurchaseOrder | I_PurchasingDocumentHistory | PurchasingDocument | Purchasing Document | |
| PurchaseOrderItem | I_PurchasingDocumentHistory | PurchasingDocumentItem | Purchasing Doc. Item | |
| Plant | I_PurchasingDocumentHistory | Plant | Valuation Area | |
| ReferenceDocumentFiscalYear | I_PurchasingDocumentHistory | ReferenceDocumentFiscalYear | Year Cur.Period | |
| ReferenceDocument | I_PurchasingDocumentHistory | ReferenceDocument | Reference Document | |
| ReferenceDocumentItem | I_PurchasingDocumentHistory | ReferenceDocumentItem | Reference item | |
| MaterialDocumentYear | I_PurchasingDocumentHistory | PurchasingHistoryDocumentYear | ||
| MaterialDocument | I_PurchasingDocumentHistory | PurchasingHistoryDocument | ||
| MaterialDocumentItem | I_PurchasingDocumentHistory | PurchasingHistoryDocumentItem | ||
| PostingDate | I_PurchasingDocumentHistory | PostingDate | Posting Date for GR | |
| DocumentDate | I_PurchasingDocumentHistory | DocumentDate | Journal Entry Date | |
| PurchaseOrderHistCategory | I_PurchasingDocumentHistory | PurchasingHistoryCategory | ||
| DebitCreditCode | I_PurchasingDocumentHistory | DebitCreditCode | Single-Character Flag | |
| QuantityendasQuantity | ||||
| CompanyCode | I_MaterialDocumentRecord | CompanyCode | Receiver Company Code | |
| ReversedMaterialDocumentYear | I_MaterialDocumentRecord | ReversedMaterialDocumentYear | Reversed Doc Year | |
| ReversedMaterialDocument | I_MaterialDocumentRecord | ReversedMaterialDocument | Reversed Mat Doc | |
| ReversedMaterialDocumentItem | I_MaterialDocumentRecord | ReversedMaterialDocumentItem | Reversed Doc Item | |
| IsReversalMovementType | I_MaterialDocumentRecord | IsReversalMovementType | ||
| GoodsMovementIsCancelled | I_MaterialDocumentRecord | GoodsMovementIsCancelled | Is Item Cancelled | |
| GoodsMovementCancellationType | I_MaterialDocumentRecord | GoodsMovementCancellationType |
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_RU_PurchaseOrderHistoryGR.
-- 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: PRUPURORDHGR
CREATE VIEW P_RU_PurchaseOrderHistoryGR AS
SELECT
PurchDocItemHistGR.PurchasingDocument AS PurchaseOrder,
PurchDocItemHistGR.PurchasingDocumentItem AS PurchaseOrderItem,
PurchDocItemHistGR.Plant AS Plant,
PurchDocItemHistGR.ReferenceDocumentFiscalYear AS ReferenceDocumentFiscalYear,
PurchDocItemHistGR.ReferenceDocument AS ReferenceDocument,
PurchDocItemHistGR.ReferenceDocumentItem AS ReferenceDocumentItem,
PurchDocItemHistGR.PurchasingHistoryDocumentYear AS MaterialDocumentYear,
PurchDocItemHistGR.PurchasingHistoryDocument AS MaterialDocument,
PurchDocItemHistGR.PurchasingHistoryDocumentItem AS MaterialDocumentItem,
PurchDocItemHistGR.PostingDate AS PostingDate,
PurchDocItemHistGR.DocumentDate AS DocumentDate,
PurchDocItemHistGR.PurchasingHistoryCategory AS PurchaseOrderHistCategory,
PurchDocItemHistGR.DebitCreditCode AS DebitCreditCode,
case when PurchDocItemHistGR.DebitCreditCode = 'H' then -PurchDocItemHistGR.Quantity else PurchDocItemHistGR.Quantity end as Quantity AS QuantityendasQuantity,
MatDocItem.CompanyCode AS CompanyCode,
MatDocItem.ReversedMaterialDocumentYear AS ReversedMaterialDocumentYear,
MatDocItem.ReversedMaterialDocument AS ReversedMaterialDocument,
MatDocItem.ReversedMaterialDocumentItem AS ReversedMaterialDocumentItem,
MatDocItem.IsReversalMovementType AS IsReversalMovementType,
MatDocItem.GoodsMovementIsCancelled AS GoodsMovementIsCancelled,
MatDocItem.GoodsMovementCancellationType AS GoodsMovementCancellationType
FROM I_PurchasingDocumentHistory AS PurchDocItemHistGR
INNER JOIN I_MaterialDocumentRecord AS MatDocItem ON /* join condition not captured in parsed metadata */
;
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