P_StandardPurchaseOrders
P_StandardPurchaseOrders is a Composite CDS View in SAP S/4HANA. It reads from 5 data sources (P_ChangeDocumentItems, I_DemandDrivenPurDocHeader, I_DemandDrivenPurDocItem, I_GoodsMovementDocument, P_DemandDrivenProdslHorizon) and exposes 13 fields with key fields Material, Plant, MRPArea. It has 1 association to related views.
Data Sources (5)
| Source | Alias | Join Type |
|---|---|---|
| P_ChangeDocumentItems | _changedoc | left_outer |
| I_DemandDrivenPurDocHeader | _ekko | inner |
| I_DemandDrivenPurDocItem | _ekpo | inner |
| I_GoodsMovementDocument | _matmovdoc | from |
| P_DemandDrivenProdslHorizon | P_DemandDrivenProdslHorizon | inner |
Parameters (2)
| Name | Type | Default |
|---|---|---|
| p_days | abap.int2 | |
| p_date | sydatum |
Associations (1)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [1..1] | I_DemandDrivenProduct1 | _ddprod | _ddprod.Material = _matmovdoc.Material and _ddprod.Plant = _matmovdoc.Plant and _ddprod.MRPArea = _ekpo.MRPArea |
Annotations (6)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PSTDPURORDS | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.viewType | #COMPOSITE | view | |
| VDM.private | true | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view |
Fields (13)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | Material | I_GoodsMovementDocument | Material | Vehicle Model |
| KEY | Plant | I_GoodsMovementDocument | Plant | Valuation Area |
| KEY | MRPArea | I_DemandDrivenPurDocItem | MRPArea | MRP Area |
| PurchasingDocument | I_DemandDrivenPurDocHeader | PurchasingDocument | Purchasing Document | |
| PurchasingDocumentItem | ||||
| PurchasingInfoRecord | I_DemandDrivenPurDocItem | PurchasingInfoRecord | Info Record | |
| PurchasingOrganization | I_DemandDrivenPurDocHeader | PurchasingOrganization | Purchasing Organization | |
| ReplenishmentType | ||||
| CreationDate | I_DemandDrivenPurDocHeader | CreationDate | Time Stamp | |
| ReleaseDate | P_ChangeDocumentItems | CreationDate | Time Stamp | |
| PurchasingDocumentCategory | I_DemandDrivenPurDocHeader | PurchasingDocumentCategory | Doc. Category | |
| datsasStartDate | ||||
| PostingDateendendasDifferenceInDays |
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_StandardPurchaseOrders.
-- 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: PSTDPURORDS
-- Parameters: p_days : abap.int2, p_date : sydatum
CREATE VIEW P_StandardPurchaseOrders AS
SELECT
_matmovdoc.Material AS Material,
_matmovdoc.Plant AS Plant,
_ekpo.MRPArea AS MRPArea,
_ekko.PurchasingDocument AS PurchasingDocument,
cast(_ekpo.PurchasingDocumentItem as abap.char( 5 )) AS PurchasingDocumentItem,
_ekpo.PurchasingInfoRecord AS PurchasingInfoRecord,
_ekko.PurchasingOrganization AS PurchasingOrganization,
cast('B' as abap.char( 1 ) ) AS ReplenishmentType,
_ekko.CreationDate AS CreationDate,
_changedoc.CreationDate AS ReleaseDate,
_ekko.PurchasingDocumentCategory AS PurchasingDocumentCategory,
cast( case when _ddprod.LeadTimeCalculationMethod = 'HCRE' then _ekko.CreationDate when _ddprod.LeadTimeCalculationMethod = 'HREL' then _changedoc.CreationDate when _ddprod.LeadTimeCalculationMethod is null then _ekko.CreationDate end as abap.dats ) as StartDate AS datsasStartDate,
case when _ddprod.LeadTimeCalculationMethod = 'HCRE' then case when _ekko.CreationDate = _matmovdoc.PostingDate then 1 else dats_days_between(_ekko.CreationDate,_matmovdoc.PostingDate) end when _ddprod.LeadTimeCalculationMethod = 'HREL' then case when _changedoc.CreationDate = _matmovdoc.PostingDate then 1 else dats_days_between(_changedoc.CreationDate,_matmovdoc.PostingDate) end when _ddprod.LeadTimeCalculationMethod is null then case when _ekko.CreationDate = _matmovdoc.PostingDate then 1 else dats_days_between(_ekko.CreationDate,_matmovdoc.PostingDate) end end as DifferenceInDays AS PostingDateendendasDifferenceInDays
FROM I_GoodsMovementDocument AS _matmovdoc
INNER JOIN I_DemandDrivenPurDocItem AS _ekpo ON /* join condition not captured in parsed metadata */
INNER JOIN I_DemandDrivenPurDocHeader AS _ekko ON /* join condition not captured in parsed metadata */
INNER JOIN P_DemandDrivenProdslHorizon ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_ChangeDocumentItems AS _changedoc ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_DemandDrivenProduct1 AS _ddprod ON _ddprod.Material = _matmovdoc.Material AND _ddprod.Plant = _matmovdoc.Plant AND _ddprod.MRPArea = _ekpo.MRPArea -- association [1..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