P_PurReqAddDelivery
P_PurReqAddDelivery is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (I_Purchaserequisitionitem) and exposes 12 fields with key fields PurchaseRequisition, PurchaseRequisitionItem. It has 3 associations to related views.
Data Sources (1)
| Source | Alias | Join Type |
|---|---|---|
| I_Purchaserequisitionitem | _PurReqnItem | from |
Associations (3)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [0..1] | I_StorageLocationAddress | _StorageLocationAddress | $projection.Plant = _StorageLocationAddress.Plant and $projection.StorageLocation = _StorageLocationAddress.StorageLocation and $projection.ItemDeliveryAddressID = _StorageLocationAddress.AddressID |
| [0..1] | I_Supplier | _Subcontractor | $projection.Subcontractor = _Subcontractor.Supplier |
| [0..1] | I_Customer | _Customer | $projection.PurReqnReceivingCustomer = _Customer.Customer |
Annotations (10)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PDELIVADD | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| VDM.private | true | view | |
| VDM.viewType | #COMPOSITE | view | |
| AbapCatalog.preserveKey | true | view | |
| ObjectModel.usageType.serviceQuality | #B | view | |
| ObjectModel.usageType.sizeCategory | #L | view | |
| ObjectModel.usageType.dataClass | #TRANSACTIONAL | view |
Fields (12)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | PurchaseRequisition | I_Purchaserequisitionitem | PurchaseRequisition | |
| KEY | PurchaseRequisitionItem | I_Purchaserequisitionitem | PurchaseRequisitionItem | |
| Plant | I_Purchaserequisitionitem | Plant | ||
| StorageLocation | I_Purchaserequisitionitem | StorageLocation | ||
| ManualDeliveryAddressID | I_Purchaserequisitionitem | ManualDeliveryAddressID | ||
| ItemDeliveryAddressID | I_Purchaserequisitionitem | ItemDeliveryAddressID | ||
| Subcontractor | I_Purchaserequisitionitem | Subcontractor | ||
| PurReqnReceivingCustomer | I_Purchaserequisitionitem | PurReqnReceivingCustomer | ||
| AddressIDelseendasDeliveryAddressID | ||||
| Customer | _Customer | Customer | ||
| _Subcontractor | _Subcontractor | |||
| _Customer | _Customer |
@AbapCatalog.sqlViewName: 'PDELIVADD'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private: true
@VDM.viewType: #COMPOSITE
@AbapCatalog.preserveKey:true
//@ObjectModel.semanticKey:['PurchaseRequisition', 'PurchaseRequisitionItem']
@ObjectModel.usageType.serviceQuality: #B
@ObjectModel.usageType.sizeCategory: #L
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
define view P_PurReqAddDelivery
as select from I_Purchaserequisitionitem as _PurReqnItem
association [0..1] to I_StorageLocationAddress as _StorageLocationAddress on $projection.Plant = _StorageLocationAddress.Plant
and $projection.StorageLocation = _StorageLocationAddress.StorageLocation
and $projection.ItemDeliveryAddressID = _StorageLocationAddress.AddressID
association [0..1] to I_Supplier as _Subcontractor on $projection.Subcontractor = _Subcontractor.Supplier
association [0..1] to I_Customer as _Customer on $projection.PurReqnReceivingCustomer = _Customer.Customer
{
key _PurReqnItem.PurchaseRequisition,
key _PurReqnItem.PurchaseRequisitionItem,
_PurReqnItem.Plant,
_PurReqnItem.StorageLocation,
_PurReqnItem.ManualDeliveryAddressID,
_PurReqnItem.ItemDeliveryAddressID,
_PurReqnItem.Subcontractor,
_PurReqnItem.PurReqnReceivingCustomer,
//Delivery Address ID
case
//manual deliv address
when _PurReqnItem.ManualDeliveryAddressID <> ''
then _PurReqnItem.ManualDeliveryAddressID
//referenced other address
when _PurReqnItem.ItemDeliveryAddressID <> ''
then _PurReqnItem.ItemDeliveryAddressID
//address from supplier
when _PurReqnItem.Subcontractor <> ''
//then _Supplier.AddressID
then _Subcontractor.AddressID
//address from customer
when _PurReqnItem.PurReqnReceivingCustomer <> ''
//then _PurReqnItem.AddressID
then _Customer.AddressID
//default address from Plant and item not thrid party
when _PurReqnItem.ManualDeliveryAddressID = '' and _PurReqnItem.ItemDeliveryAddressID = ''
and Subcontractor = '' and PurReqnReceivingCustomer = '' and PurchasingDocumentItemCategory <> '5'
then _Plant.AddressID
else
''
end as DeliveryAddressID,
//Address type
case
when _PurReqnItem.PurchasingDeliveryAddressType is not initial
then _PurReqnItem.PurchasingDeliveryAddressType
//manual deliv address
when ManualDeliveryAddressID <> ''
then cast ( 'U' as purreqnaddrtype preserving type)
//referenced other address
when ItemDeliveryAddressID <> ''
then
case
when ItemDeliveryAddressID = _StorageLocationAddress.AddressID
then cast ( 'L' as purreqnaddrtype preserving type)
else
cast( 'R' as purreqnaddrtype preserving type) //Reference Address
end
//address from supplier
when Subcontractor <> ''
then cast ( 'S' as purreqnaddrtype preserving type)
//address from customer
when PurReqnReceivingCustomer <> ''
then cast ( 'C' as purreqnaddrtype preserving type )
//default address from Plant and item not thrid party
when ManualDeliveryAddressID = '' and ItemDeliveryAddressID = ''
and Subcontractor = '' and PurReqnReceivingCustomer = ''
and PurchasingDocumentItemCategory <> '5'
and _PurReqnItem.DeliveryAddressID <> ''
then cast ( 'P' as purreqnaddrtype preserving type)
else
cast ( 'P' as purreqnaddrtype preserving type)
end as AddressType,
_Customer.Customer,
_Subcontractor,
_Customer
}
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