C_PurOrderItemHistoryValues2

DDL: C_PURORDERITEMHISTORYVALUES2 SQL: CMMPUOITMHISV2 Type: view CONSUMPTION

Purchase Order Item History Values 2

C_PurOrderItemHistoryValues2 is a Consumption CDS View (Cube) that provides data about "Purchase Order Item History Values 2" in SAP S/4HANA. It reads from 3 data sources (I_CalendarDate, P_PurchaseOrderItemHistory1, I_PurchasingCategoryMatlGroup) and exposes 31 fields with key fields PurchaseOrder, PurchaseOrderItem. It has 7 associations to related views.

Data Sources (3)

SourceAliasJoin Type
I_CalendarDate Calendar left_outer
P_PurchaseOrderItemHistory1 P_PurchaseOrderItemHistory1 from
I_PurchasingCategoryMatlGroup PurchasingCategoryMatlGroup left_outer

Parameters (3)

NameTypeDefault
P_StartDate bedat
P_EndDate bedat
P_DisplayCurrency displaycurrency

Associations (7)

CardinalityTargetAliasCondition
[1..1] I_PurchasingOrganization _PurchasingOrganization $projection.PurchasingOrganization = _PurchasingOrganization.PurchasingOrganization
[1..1] I_PurchasingGroup _PurchasingGroup $projection.PurchasingGroup = _PurchasingGroup.PurchasingGroup
[1..1] I_Supplier _Supplier $projection.Supplier = _Supplier.Supplier
[1..1] I_Plant _Plant $projection.Plant = _Plant.Plant
[1..1] I_Country _Country $projection.SupplierCountry = _Country.Country
[1..1] I_Material _Material $projection.Material = _Material.Material
[1..1] I_MaterialGroup _MaterialGroup $projection.MaterialGroup = _MaterialGroup.MaterialGroup

Annotations (11)

NameValueLevelField
EndUserText.label Purchase Order Item History Values 2 view
AbapCatalog.sqlViewName CMMPUOITMHISV2 view
VDM.viewType #CONSUMPTION view
Analytics.dataCategory #CUBE view
Metadata.allowExtensions true view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #L view

Fields (31)

KeyFieldSource TableSource FieldDescription
KEY PurchaseOrder PurchaseOrder
KEY PurchaseOrderItem PurchaseOrderItem
Supplier Supplier
SupplierCountry _Supplier Country
PurchasingOrganization PurchasingOrganization
PurchasingGroup PurchasingGroup
CompanyCode CompanyCode
PurchasingCategory
PurgCatName
PurchaseOrderDate PurchaseOrderDate
CalendarYear I_CalendarDate CalendarYear
CalendarQuarter I_CalendarDate CalendarQuarter
CalendarMonth I_CalendarDate CalendarMonth
CalendarWeek I_CalendarDate CalendarWeek
Material Material
MaterialGroup P_PurchaseOrderItemHistory1 MaterialGroup
Plant Plant
DeliveryTime DeliveryTime
DisplayCurrency
PurchaseOrderQuantityUnit PurchaseOrderQuantityUnit
GoodsReceiptQty GoodsReceiptQty
DeliveryItem DeliveryItem
WeightedDeliveryTime
WeightedReceiptQuantity
_Material _Material
_MaterialGroup _MaterialGroup
_Supplier _Supplier
_Country _Country
_Plant _Plant
_PurchasingOrganization _PurchasingOrganization
_PurchasingGroup _PurchasingGroup
@EndUserText.label: 'Purchase Order Item History Values 2'
@AbapCatalog.sqlViewName: 'CMMPUOITMHISV2'
@VDM.viewType: #CONSUMPTION
@Analytics.dataCategory: #CUBE
@Metadata.allowExtensions:true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE //Inserted by VDM CDS Suite Plugin

@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory:  #L
define view C_PurOrderItemHistoryValues2

  with parameters
    @Consumption.hidden : true
    @Environment.systemField : #SYSTEM_DATE
    P_StartDate       : bedat,
    P_EndDate         : bedat,
    P_DisplayCurrency : displaycurrency


  as select from    P_PurchaseOrderItemHistory1( P_StartDate: $parameters.P_StartDate, P_EndDate: $parameters.P_EndDate, P_DisplayCurrency : $parameters.P_DisplayCurrency)

    left outer join I_CalendarDate                as Calendar                    on P_PurchaseOrderItemHistory1.PurchaseOrderDate = Calendar.CalendarDate

    left outer join I_PurchasingCategoryMatlGroup as PurchasingCategoryMatlGroup on P_PurchaseOrderItemHistory1.MaterialGroup = PurchasingCategoryMatlGroup.MaterialGroup

  association [1..1] to I_PurchasingOrganization as _PurchasingOrganization on $projection.PurchasingOrganization = _PurchasingOrganization.PurchasingOrganization

  association [1..1] to I_PurchasingGroup        as _PurchasingGroup        on $projection.PurchasingGroup = _PurchasingGroup.PurchasingGroup

  association [1..1] to I_Supplier               as _Supplier               on $projection.Supplier = _Supplier.Supplier

  association [1..1] to I_Plant                  as _Plant                  on $projection.Plant = _Plant.Plant

  association [1..1] to I_Country                as _Country                on $projection.SupplierCountry = _Country.Country

  association [1..1] to I_Material               as _Material               on $projection.Material = _Material.Material
  
  association [1..1] to I_MaterialGroup          as _MaterialGroup          on $projection.MaterialGroup = _MaterialGroup.MaterialGroup


{
      /* Keys */
  key PurchaseOrder,
  key PurchaseOrderItem,
      //  key MaterialDocument,

      //  key MaterialDocumentItem,

      //  key MaterialDocumentYear,

      //  key AccountAssignmentNumber,



      /*Supplier*/
      @ObjectModel.foreignKey.association: '_Supplier'
      @Consumption.labelElement: 'SupplierName'
      Supplier,

      @ObjectModel.foreignKey.association: '_Country'
      @Consumption.labelElement: 'CountryName'
      _Supplier.Country as SupplierCountry,

      /* Org Data*/
      @ObjectModel.foreignKey.association: '_PurchasingOrganization'
      @Consumption.labelElement: 'PurchasingOrganizationName'
      PurchasingOrganization,

      @ObjectModel.foreignKey.association: '_PurchasingGroup'
      @Consumption.labelElement: 'PurchasingGroupName'
      PurchasingGroup,

      CompanyCode,

      /* Purchasing Category*/
      PurchasingCategoryMatlGroup._PurchasingCategory.PurchasingCategory                 as PurchasingCategory,
      PurchasingCategoryMatlGroup._PurchasingCategory.PurgCatName,

      /* Dates */
      PurchaseOrderDate,
      Calendar.CalendarYear,
      Calendar.CalendarQuarter,
      Calendar.CalendarMonth,
      Calendar.CalendarWeek,

      /* Item Data */
      @ObjectModel.foreignKey.association: '_Material'
      Material,
      @ObjectModel.foreignKey.association:'_MaterialGroup'
      P_PurchaseOrderItemHistory1.MaterialGroup,

      @ObjectModel.foreignKey.association: '_Plant'
      @Consumption.labelElement: 'PlantName'
      Plant,

      @DefaultAggregation: #SUM
      DeliveryTime,

      @Semantics.currencyCode: true
      cast( $parameters.P_DisplayCurrency as displaycurrency )                           as DisplayCurrency,

      @Semantics.unitOfMeasure: true
      PurchaseOrderQuantityUnit,

      @DefaultAggregation: #SUM
      @Semantics.quantity.unitOfMeasure: 'PurchaseOrderQuantityUnit'
      GoodsReceiptQty,

      @Semantics.amount.currencyCode: 'DisplayCurrency'
      @DefaultAggregation: #SUM
      case when NonDeductibleInputTaxAmount = 0
            then GoodsReceiptAmountInDspCrcy
           else EffectiveAmount
      end as GoodsReceiptAmountInDspCrcy,                   //3200657


      @DefaultAggregation: #SUM
      DeliveryItem,

      @DefaultAggregation: #SUM
      cast( DeliveryTime * GoodsReceiptQty as abap.dec(15,2))                            as WeightedDeliveryTime,
      
      @DefaultAggregation: #SUM
      division(GoodsReceiptQty, WeightedReceiptQuantity, 3 ) as WeightedReceiptQuantity, //Temporary Solution


      _Material,
      _MaterialGroup                                          as _MaterialGroup,
      _Supplier,
      _Country,
      _Plant,
      _PurchasingOrganization,
      _PurchasingGroup

}
where
  GoodsReceiptQty > 0
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CALENDARDATE",
"I_PURCHASINGCATEGORY",
"I_PURCHASINGCATEGORYMATLGROUP",
"I_SUPPLIER",
"P_PURCHASEORDERITEMHISTORY1"
],
"ASSOCIATED":
[
"I_COUNTRY",
"I_MATERIAL",
"I_MATERIALGROUP",
"I_PLANT",
"I_PURCHASINGGROUP",
"I_PURCHASINGORGANIZATION",
"I_SUPPLIER"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/