P_LogcDocPurchaseItem

DDL: P_LOGCDOCPURCHASEITEM Type: view_entity CONSUMPTION

P_LogcDocPurchaseItem is a Consumption CDS View 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.

Data Sources (1)

SourceAliasJoin Type
R_PurchasingDocumentItem R_PurchasingDocumentItem from

Associations (3)

CardinalityTargetAliasCondition
[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)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #CONSUMPTION view
Metadata.ignorePropagatedAnnotations true view

Fields (17)

KeyFieldSource TableSource FieldDescription
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'
  )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_PRODUCT",
"R_PURCHASINGDOCUMENT",
"R_PURCHASINGDOCUMENTITEM"
],
"ASSOCIATED":
[
"I_PRODUCTTEXT",
"I_UNITOFMEASURETEXT"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/