P_LogcDocPurchaseItem
Log Doc - Purchase Order Item
P_LogcDocPurchaseItem is a Consumption CDS View that provides data about "Log Doc - Purchase Order Item" in SAP S/4HANA. It reads from 1 data source (R_PurchasingDocumentItem) and exposes 17 fields with key fields PurchasingDocument, PurchasingDocumentItem. It has 3 associations to related views. Part of development package EHDGM_CNS_MARKINGS_AND_LABELS.
Data Sources (1)
| Source | Alias | Join Type |
|---|---|---|
| R_PurchasingDocumentItem | R_PurchasingDocumentItem | from |
Associations (3)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [0..1] | I_Product | _Product | $projection.Product = _Product.Product |
| [0..*] | I_ProductText | _ProductText | $projection.Product = _ProductText.Product |
| [0..*] | I_UnitOfMeasureText | _QuantityUnitText | $projection.OrderQuantityUnit = _QuantityUnitText.UnitOfMeasure |
Annotations (4)
| Name | Value | Level | Field |
|---|---|---|---|
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.private | true | view | |
| VDM.viewType | #CONSUMPTION | view | |
| Metadata.ignorePropagatedAnnotations | true | view |
Fields (17)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | PurchasingDocument | PurchasingDocument | ||
| KEY | PurchasingDocumentItem | PurchasingDocumentItem | ||
| ProdCmplncLogsDocumentCategory | ||||
| Product | Material | |||
| OrderQuantity | OrderQuantity | |||
| OrderQuantityUnit | OrderQuantityUnit | |||
| ClassifiedAsDangerousGood | ||||
| ClassifiedAsDangerousGoodName | ||||
| _ProductText | _ProductText | |||
| _QuantityUnitText | _QuantityUnitText | |||
| PurchasingDocumentType | _PurchasingDocument | PurchasingDocumentType | ||
| PurchasingOrganization | _PurchasingDocument | PurchasingOrganization | ||
| PurchasingGroup | _PurchasingDocument | PurchasingGroup | ||
| IsEndOfPurposeBlocked | IsEndOfPurposeBlocked | |||
| PurchasingDocumentCategory | PurchasingDocumentCategory | |||
| PurchasingDocumentOrigin | _PurchasingDocument | PurchasingDocumentOrigin | ||
| Plant | Plant |
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM: {
private: true,
viewType: #CONSUMPTION
}
@Metadata.ignorePropagatedAnnotations: true
define view entity P_LogcDocPurchaseItem
// as select from I_PurchasingDocumentItem
// USE R_ VIEW AS WORKAROUND - SWITCH BACK TO I_ VIEW UNTIL THE PurgProdCmplncDngrsGoodsStatus IS CONTAINED
as select from R_PurchasingDocumentItem
association [0..1] to I_Product as _Product on $projection.Product = _Product.Product
association [0..*] to I_ProductText as _ProductText on $projection.Product = _ProductText.Product
// needed to redefine because of different cardinality between the union views
association [0..*] to I_UnitOfMeasureText as _QuantityUnitText on $projection.OrderQuantityUnit = _QuantityUnitText.UnitOfMeasure
{
key PurchasingDocument,
key PurchasingDocumentItem,
// USE THE SAME LOGIC AS IN P_LogcDocPurchase
cast ('PO' as ehfnd_log_doc_category) as ProdCmplncLogsDocumentCategory, // Purchase Order (EHFND_LOG_DOC_CATEGORY)
// cast (
// case
// when PurchasingDocumentCategory = 'F'
// then 'PO'
// end as ehfnd_log_doc_category) as ProdCmplncLogsDocumentCategory,
// use the material as the related product
@ObjectModel.text.association: '_ProductText'
Material as Product,
@Semantics.quantity.unitOfMeasure: 'OrderQuantityUnit'
OrderQuantity,
// @Semantics.unitOfMeasure: true
@ObjectModel.text.association: '_QuantityUnitText'
OrderQuantityUnit,
cast ('' as classifiedasdangerousgood) as ClassifiedAsDangerousGood,
cast( '' as val_text) as ClassifiedAsDangerousGoodName,
// needed to mark the blocked logistic document items
cast (
case
when PurgProdCmplncDngrsGoodsStatus = 'F' // Blocked – Dangerous Goods Transport Forbidden
then 'X'
when PurgProdCmplncDngrsGoodsStatus = 'H' // Partially Blocked – Dangerous Goods Transport Forbidden
then 'X'
end as boole_d) as IsBlocked,
// Associations
_ProductText,
_QuantityUnitText,
//Needed for Authorization check
@ObjectModel.readOnly: true
@Consumption.hidden: true
_PurchasingDocument.PurchasingDocumentType as PurchasingDocumentType,
@ObjectModel.readOnly: true
@Consumption.hidden: true
_PurchasingDocument.PurchasingOrganization as PurchasingOrganization,
@ObjectModel.readOnly: true
@Consumption.hidden: true
_PurchasingDocument.PurchasingGroup as PurchasingGroup,
@ObjectModel.readOnly: true
@Consumption.hidden: true
IsEndOfPurposeBlocked,
@ObjectModel.readOnly: true
@Consumption.hidden: true
PurchasingDocumentCategory,
@ObjectModel.readOnly: true
@Consumption.hidden: true
_PurchasingDocument.PurchasingDocumentOrigin as PurchasingDocumentOrigin,
@ObjectModel.readOnly: true
@Consumption.hidden: true
Plant
}
where
// use only items where the Chemical Complinace Relevant Flag is true
_Product.IsChemicalComplianceRelevant = 'Y'
and(
PurchasingDocumentCategory = 'F'
)
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