P_LogcDocDeliveryItem is a Consumption CDS View in SAP S/4HANA. It reads from 1 data source (I_DeliveryDocumentItem) and exposes 11 fields with key fields DeliveryDocument, DeliveryDocumentItem. It has 2 associations to related views.
@AccessControl.authorizationCheck: #NOT_REQUIRED@VDM: {
private: true,
viewType: #CONSUMPTION
}@Metadata.ignorePropagatedAnnotations: truedefineviewentity P_LogcDocDeliveryItem
asselectfrom I_DeliveryDocumentItem
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 DeliveryDocument,
key DeliveryDocumentItem,
//SDDocumentCategory,
// USE THE SAME LOGIC ASIN P_LogcDocDelivery
cast ('LF' as ehfnd_log_doc_category) as ProdCmplncLogsDocumentCategory,
// cast (
// case// when PurchasingDocumentCategory = 'J'
// then 'LF' // Outbound Delivery (EHFND_LOG_DOC_CATEGORY)
// endas ehfnd_log_doc_category) as ProdCmplncLogsDocumentCategory
@ObjectModel.text.association: '_ProductText'
Product,
// the actual quantity is the real quantity used for the delivery
@Semantics.quantity.unitOfMeasure: 'OrderQuantityUnit'
ActualDeliveryQuantity as OrderQuantity,
// OriginalDeliveryQuantity,
// @Semantics.unitOfMeasure: true@ObjectModel.text.association: '_QuantityUnitText'
DeliveryQuantityUnit as OrderQuantityUnit,
cast ('' as classifiedasdangerousgood) as ClassifiedAsDangerousGood,
cast( '' as val_text) as ClassifiedAsDangerousGoodName,
// needed to mark the blocked logistic document items
cast (
casewhen DangerousGoodsStatus = 'F' // DOM_DGSTA_LE - Blocked – Transport Forbidden
then 'X'
when DangerousGoodsStatus = 'G' // DOM_DGSTA_LE - Blocked – Decision Pending
then 'X'
endas boole_d) as IsBlocked,
// Associations
_ProductText,
_QuantityUnitText,
//Needed for Authorization check
@ObjectModel.readOnly:true@Consumption.hidden: true
_DeliveryDocument.ShippingPoint as ShippingPoint
}
where// use only items where the Chemical Complinace Relevant Flag istrue
_Product.IsChemicalComplianceRelevant = 'Y'
and(
SDDocumentCategory = 'J'
)
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_DELIVERYDOCUMENT",
"I_DELIVERYDOCUMENTITEM",
"I_PRODUCT"
],
"ASSOCIATED":
[
"I_PRODUCTTEXT",
"I_UNITOFMEASURETEXT"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/