P_ReturnsReferenceDocument
P_ReturnsReferenceDocument is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_BillingDocumentItemBasic, I_DeliveryDocument, I_DeliveryDocumentItem) and exposes 11 fields with key fields SDDocument, SalesDocumentItem, DeliveryDocument, DeliveryDocumentItem, SalesDocumentItem.
Data Sources (3)
| Source | Alias | Join Type |
|---|---|---|
| I_BillingDocumentItemBasic | BillingDocumentItem | union_all |
| I_DeliveryDocument | DeliveryDocument | inner |
| I_DeliveryDocumentItem | DeliveryDocumentItem | from |
Annotations (4)
| Name | Value | Level | Field |
|---|---|---|---|
| VDM.private | true | view | |
| VDM.viewType | #COMPOSITE | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| Metadata.ignorePropagatedAnnotations | true | view |
Fields (11)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | SDDocument | I_DeliveryDocumentItem | ReferenceSDDocument | |
| KEY | SalesDocumentItem | I_DeliveryDocumentItem | ReferenceSDDocumentItem | |
| KEY | DeliveryDocument | I_DeliveryDocumentItem | DeliveryDocument | |
| KEY | DeliveryDocumentItem | I_DeliveryDocumentItem | DeliveryDocumentItem | |
| SDDocumentCategory | I_DeliveryDocumentItem | ReferenceSDDocumentCategory | ||
| BillingDocumentasSDDocument | ||||
| KEY | SalesDocumentItem | I_BillingDocumentItemBasic | BillingDocumentItem | |
| KEY | DeliveryDocument | I_BillingDocumentItemBasic | ReferenceSDDocument | |
| KEY | DeliveryDocumentItem | I_BillingDocumentItemBasic | ReferenceSDDocumentItem | |
| SDDocumentCategory | I_BillingDocumentItemBasic | SDDocumentCategory | ||
| ShippingPoint | I_BillingDocumentItemBasic | ShippingPoint |
@VDM.private: true
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Metadata.ignorePropagatedAnnotations: true
define view entity P_ReturnsReferenceDocument
as select from I_DeliveryDocumentItem as DeliveryDocumentItem
inner join I_DeliveryDocument as DeliveryDocument on DeliveryDocumentItem.DeliveryDocument = DeliveryDocument.DeliveryDocument
{
key DeliveryDocumentItem.ReferenceSDDocument as SDDocument,
key DeliveryDocumentItem.ReferenceSDDocumentItem as SalesDocumentItem,
key DeliveryDocumentItem.DeliveryDocument as DeliveryDocument,
key DeliveryDocumentItem.DeliveryDocumentItem as DeliveryDocumentItem,
DeliveryDocumentItem.ReferenceSDDocumentCategory as SDDocumentCategory,
DeliveryDocument.ShippingPoint as ShippingPoint
}
where
DeliveryDocumentItem.ReferenceSDDocumentCategory = 'C'
or DeliveryDocumentItem.ReferenceSDDocumentCategory = 'I'
union all
select from I_BillingDocumentItemBasic as BillingDocumentItem
{
key BillingDocumentItem.BillingDocument as SDDocument,
key BillingDocumentItem.BillingDocumentItem as SalesDocumentItem,
key BillingDocumentItem.ReferenceSDDocument as DeliveryDocument,
key BillingDocumentItem.ReferenceSDDocumentItem as DeliveryDocumentItem,
BillingDocumentItem.SDDocumentCategory as SDDocumentCategory,
BillingDocumentItem.ShippingPoint as ShippingPoint
}
where
BillingDocumentItem.SDDocumentCategory = 'M'
and BillingDocumentItem.ReferenceSDDocumentCategory = 'J'
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- 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