C_MaterialPriceVariance

DDL: C_MATERIALPRICEVARIANCE SQL: CMMMATLPRCVAR Type: view CONSUMPTION

Material Price Variance

C_MaterialPriceVariance is a Consumption CDS View that provides data about "Material Price Variance" in SAP S/4HANA. It reads from 4 data sources (I_CalendarDate, I_MatlPriceVarcDocCategoryText, P_MaterialPriceVariance, I_MatlPrcVarcPurgSourceTypeTxt) and exposes 1 field. It has 8 associations to related views.

Data Sources (4)

SourceAliasJoin Type
I_CalendarDate CalendarDate inner
I_MatlPriceVarcDocCategoryText DocumentType inner
P_MaterialPriceVariance P_MaterialPriceVariance from
I_MatlPrcVarcPurgSourceTypeTxt SourceType inner

Parameters (4)

NameTypeDefault
P_DisplayCurrency displaycurrency
P_Material matnr
P_StartDate vdm_validitystart
P_EndDate vdm_validityend

Associations (8)

CardinalityTargetAliasCondition
[1..1] I_Material _Material $projection.Material = _Material.Material
[1..1] I_MaterialGroup _MaterialGroup $projection.MaterialGroup = _MaterialGroup.MaterialGroup
[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_CompanyCode _CompanyCode $projection.CompanyCode = _CompanyCode.CompanyCode
[1..1] P_InFoRecordConsumptionTxt _InfoTxt $projection.BOMHasHeaderInfoRecord = _InfoTxt.DomainValue

Annotations (13)

NameValueLevelField
AbapCatalog.sqlViewName CMMMATLPRCVAR view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
EndUserText.label Material Price Variance view
UI.headerInfo.typeName Material Price Variance view
UI.headerInfo.typeNamePlural Material Price Variance view
UI.headerInfo.title.value NetPriceAmount view
UI.headerInfo.description.value NetPriceAmount view
VDM.viewType #CONSUMPTION view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #XL view
AccessControl.personalData.blocking #NOT_REQUIRED view

Fields (1)

KeyFieldSource TableSource FieldDescription
YearWeek_Material Creation Date From
@AbapCatalog.sqlViewName: 'CMMMATLPRCVAR'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Material Price Variance'
//@Analytics.dataCategory: #CUBE

//@Search: {

//  searchable: true

//}

@UI.chart: [{chartType: #LINE ,

dimensions:  [ 'CalendarMonth', 'CalendarYear','PurchasingSourceType' , 'PurchasingDocumentType'] ,
measures:  [  'NetPriceAmount' ],
title: 'By Material',
 dimensionAttributes:
    [
      { dimension: 'CalendarMonth',role: #CATEGORY },
      { dimension: 'CalendarYear', role: #CATEGORY  },
      { dimension: 'PurchasingSourceType',    role: #SERIES},
      { dimension: 'PurchasingDocumentType',    role: #SERIES}
    ],
        measureAttributes:[
      { measure: 'NetPriceAmount', role: #AXIS_1 }
    ] }
]

@UI.headerInfo:{
typeName: 'Material Price Variance',
typeNamePlural: 'Material Price Variance',
title:          {value: 'NetPriceAmount'},
  description:    {value: 'NetPriceAmount'}
}

@VDM.viewType: #CONSUMPTION
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality:  #X
@ObjectModel.usageType.sizeCategory: #XL
@AccessControl.personalData.blocking: #NOT_REQUIRED
define view C_MaterialPriceVariance

  with parameters

    @Consumption.defaultValue: 'EUR'
    @Consumption.valueHelpDefinition: [{
      entity: {
        name:'I_Currency',
        element:'Currency'
      }
    }]
    P_DisplayCurrency : displaycurrency,
    @Consumption.valueHelpDefinition: [{
      entity: {
        name:'C_MM_MaterialValueHelp',
        element:'Material'
      }
    }]

    P_Material        : matnr,

    @EndUserText.label: 'Creation Date From'
    P_StartDate       : vdm_validitystart,

    @EndUserText.label: 'Creation Date To'
    P_EndDate         : vdm_validityend


  as select from P_MaterialPriceVariance ( P_DisplayCurrency : $parameters.P_DisplayCurrency,
                                           P_Material : $parameters.P_Material, P_StartDate: $parameters.P_StartDate,
                                                      P_EndDate: $parameters.P_EndDate ) as PriceVariance
    inner join   I_MatlPriceVarcDocCategoryText                                          as DocumentType on  PriceVariance.PurchasingDocumentType = DocumentType.DocumentCategory
                                                                                                         and DocumentType.Language                = $session.system_language
    inner join   I_MatlPrcVarcPurgSourceTypeTxt                                          as SourceType   on  PriceVariance.PurchasingDocumentType = SourceType.PurchasingSourceType

                                                                                                         and SourceType.Language                  = $session.system_language

    inner join   I_CalendarDate                                                          as CalendarDate on PriceVariance.DocumentChangeDate = CalendarDate.CalendarDate

  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

  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_CompanyCode              as _CompanyCode            on $projection.CompanyCode = _CompanyCode.CompanyCode

  association [1..1] to P_InFoRecordConsumptionTxt as _InfoTxt                on $projection.BOMHasHeaderInfoRecord = _InfoTxt.DomainValue


{

  key  PurchasingDocument,

  key  PurchasingDocumentItem,
       @UI.lineItem.position: 90
       @UI.lineItem.importance: #HIGH
       @EndUserText.label: 'Document Number'
  key  ChangeDocument,

  key  MaterialDocumentYear,
  key  MaterialDocumentItem,

  key  PurchasingInfoRecordCategory,

       @UI.selectionField.position: 30
       @ObjectModel.text.element:  [ 'PurchasingGroupName' ]
       @Consumption.labelElement: 'PurchasingGroupName'
       @UI.lineItem.position: 100
       @UI.lineItem.importance: #HIGH
       @Consumption.valueHelpDefinition: [{ entity: { name : 'C_PurchasingGroupValueHelp', element : 'PurchasingGroup' } }]
  key  PurchasingGroup,
       @UI.lineItem.position: 190
       @UI.lineItem.importance: #HIGH

       cast( FormattedDocumentKey as formattedpurchasedocitem)                           as FormattedDocumentKey,

       @Consumption.semanticObject: 'PurchaseContract'
       @UI.selectionField.position: 40
       PurchaseContract,

       @Consumption.semanticObject: 'PurchaseOrder'
       @UI.selectionField.position: 50
       PurchaseOrder,

       //       @UI.selectionField.position: 60

       Invoice,

       @UI.selectionField.position: 70
       @Consumption.semanticObject: 'PurchasingInfoRecord'
       PurchasingInfoRecord,

       //@UI.selectionField.position: 80

       //       PurchaseContractItem,

       //       @Consumption.semanticObject: 'PurchaseOrderItem'

       //       PurchaseOrderItem,


       @Semantics.text: true
       cast ( _PurchasingGroup.PurchasingGroupName as mm_a_purg_grp_name )               as PurchasingGroupName,

       @EndUserText.label: 'Purchasing Source Type'
       @Consumption.filter.hidden: true

       cast( case when PurchasingDocumentType = '00' or PurchasingDocumentType = '03' or PurchasingDocumentType = '04'
              then SourceType.SourceTypeDesc
            else PurchasingDocument
       end as abap.char(40) )                                                            as PurchasingSourceType,

       @UI.lineItem.position: 200
       @UI.lineItem.importance: #HIGH
       @ObjectModel.text.element: ['PurchasingDocumentTypeName']
       @UI.selectionField.position: 90
       @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MatlPriceDocTypeVH', element : 'PurchasingDocumentType' } }]
       PurchasingDocumentType,

       @Semantics.text: true
       @UI.lineItem.position: 210
       @UI.lineItem.importance: #HIGH
       cast( DocumentType.PurchasingDocumentTypeName as mm_a_doctype_name )              as PurchasingDocumentTypeName,

       @UI.lineItem.position: 10
       @UI.lineItem.importance: #HIGH
       @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MM_MaterialValueHelp', element : 'Material' } }]
       @ObjectModel: { text.element:  [ 'MaterialName' ] }
       @Consumption.semanticObject: 'Material'
       Material,
       @Semantics.text: true
       _Material._Text[1: Language = $session.system_language].MaterialName,
       @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MM_MaterialGroupValueHelp', element : 'MaterialGroup' } }]
       @ObjectModel.text.element:  [ 'MaterialGroupName' ]
       MaterialGroup,
       @Semantics.text: true
       _MaterialGroup._Text[1: Language = $session.system_language].MaterialGroupName    as MaterialGroupName,

       @UI.lineItem.position: 20
       @UI.lineItem.importance: #HIGH
       @Consumption.semanticObject: 'Supplier'
       @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MM_SupplierValueHelp', element : 'Supplier' } }]
       @UI.selectionField: [{
         position: 20
       }]
       @ObjectModel.text.element:  [ 'SupplierName' ]
       Supplier,
       @Semantics.text: true
       cast ( _Supplier.SupplierName as suppliername )                                   as SupplierName,


       @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MM_CompanyCodeValueHelp', element : 'CompanyCode' } }]
       @ObjectModel: { text.element:  [ 'CompanyCodeName' ] }
       @UI.selectionField.position: 10
       @UI.lineItem.position: 30
       @UI.lineItem.importance: #HIGH
       CompanyCode,
       @Semantics.text: true
       _CompanyCode.CompanyCodeName,


       @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MM_PlantValueHelp', element : 'Plant' } }]
       @ObjectModel: { text.element:  [ 'PlantName' ] }
       @UI.selectionField.position: 20
       @UI.lineItem.position: 30
       @UI.lineItem.importance: #HIGH
       Plant,
       @Semantics.text: true
       _Plant.PlantName,


       @Semantics.amount.currencyCode: 'DisplayCurrency'
       @DefaultAggregation: #AVG
       @UI.lineItem.position: 40
       @UI.lineItem.importance: #HIGH
       @EndUserText.label: 'Price per order price unit'
       NetUnitPriceAmount                                                                as PricePerUnitAmount,

       @Semantics.amount.currencyCode: 'DisplayCurrency'
       //@DefaultAggregation: #AVG

       @UI.selectionField.position: 20
       @UI.lineItem.position: 50
       @UI.lineItem.importance: #HIGH
       @EndUserText.label: 'Net Price'
       NetPriceAmount,

       @UI.lineItem.position: 60
       @UI.lineItem.importance: #HIGH
       @EndUserText.label: 'Per'
       @Semantics.quantity.unitOfMeasure: 'OrderPriceUnit'
       NetPriceQuantity,

       @Semantics.unitOfMeasure: true
       @UI.lineItem.importance: #HIGH
       OrderPriceUnit,

       @UI.lineItem.position: 70
       @EndUserText.label: 'PO Quantity'
       @DefaultAggregation: #NONE
       @Semantics.quantity.unitOfMeasure: 'PurchaseOrderQuantityUnit'
       OrderQuantity,

       @Semantics.unitOfMeasure: true
       @UI.lineItem.importance: #HIGH
       @EndUserText.label: 'Purchase Order Quantity Unit'
       PurchaseOrderQuantityUnit,

       @UI.lineItem.position: 80
       @Semantics.amount.currencyCode: 'DisplayCurrency'
       @DefaultAggregation: #SUM
       PurOrdNetAmountInDisplayCrcy,

       @UI.lineItem.position: 90
       @UI.lineItem.importance: #HIGH
       @EndUserText.label: 'Invoice Quantity'
       @Semantics.quantity.unitOfMeasure: 'PurchaseOrderQuantityUnit'
       InvoiceQuantity,

       @UI.lineItem.position: 120
       @UI.lineItem.importance: #HIGH
       @EndUserText.label: 'Info Record Quantity'
       @Semantics.quantity.unitOfMeasure: 'PurchaseOrderQuantityUnit'
       QuantityInBaseUnit,

//       @UI.lineItem.position: 130

//       @EndUserText.label: 'Is Info Record Consumed'

//        @ObjectModel.text.element:  [ 'DomainText' ]

       @UI.hidden: true
       BOMHasHeaderInfoRecord,
       
       @UI.lineItem.position: 130
       @EndUserText.label: 'Is Info Record Consumed'
       _InfoTxt.DomainText as DomainText,

       @UI.lineItem.position: 100
       @Semantics.amount.currencyCode: 'DisplayCurrency'
       @DefaultAggregation: #SUM
       InvoiceAmtInDisplayCurrency,

       @DefaultAggregation: #NONE
       @Semantics.quantity.unitOfMeasure: 'OrderQuantityUnit'
       @UI.lineItem.position: 110
       @UI.lineItem.importance: #HIGH
       TargetQuantity,

       @UI.lineItem.position: 120
       @UI.lineItem.importance: #HIGH
       @Semantics.amount.currencyCode: 'DisplayCurrency'
       @DefaultAggregation: #NONE
       TargetAmount,

       @Consumption.valueHelpDefinition: [{ entity: { name : 'C_PurchasingOrgValueHelp', element : 'PurchasingOrganization' } }]
       @ObjectModel: { text.element:  [ 'PurchasingOrganizationName' ] }
       @UI.selectionField.position: 30
       @UI.lineItem.position: 110
       @UI.lineItem.importance: #HIGH
       @Consumption.labelElement: 'PurchasingOrganizationName'
       //@ObjectModel.foreignKey.association: '_PurchasingOrganization'

       cast( PurchasingOrganization as mm_a_purchasing_organization preserving type )    as PurchasingOrganization,

       @Semantics.text: true
       cast ( _PurchasingOrganization.PurchasingOrganizationName as mm_a_purg_org_name ) as PurchasingOrganizationName,

       @Semantics.text: true
       @Consumption.filter.hidden: true
       cast( DisplayCurrency as displaycurrency )                                        as DisplayCurrency,

       @Consumption.filter : {selectionType:#INTERVAL}
       cast( case when CreationDate is not null
             then CreationDate
            else '00000000'
       end as erdat )                                                                    as CreationDate,

       @DefaultAggregation: #SUM
       NumberOfPurchaseOrders,
       @DefaultAggregation: #SUM
       @EndUserText.label: 'Number of Changes'
       NumberOfContractChanges,
       @DefaultAggregation: #SUM
       @EndUserText.label: 'Number of Changes'
       NumberOfPriceChanges,


       @Semantics.unitOfMeasure: true
       @UI.lineItem.position: 120
       @UI.lineItem.importance: #HIGH
       @EndUserText.label: 'Target Quantity Order Unit'
       OrderQuantityUnit,




       @Semantics.amount.currencyCode: 'DisplayCurrency'
       @DefaultAggregation: #SUM
       ReleaseOrderItemNetAmount,





       /* Dates */
       //DocumentChangeDate,

       CalendarDate.CalendarYear,
       CalendarDate.CalendarQuarter,
       CalendarDate.CalendarMonth,
       @Semantics.calendar.week: true
       CalendarDate.CalendarWeek,
       @Semantics.calendar.quarter: true
       CalendarDate.YearQuarter,
       @Semantics.calendar.yearMonth: true
       CalendarDate.YearMonth,
       CalendarDate.YearWeek,

       _Material
}
where
  CreationDate between $parameters.P_StartDate and $parameters.P_EndDate
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CALENDARDATE",
"I_COMPANYCODE",
"I_MATERIAL",
"I_MATERIALGROUP",
"I_MATERIALGROUPTEXT",
"I_MATERIALTEXT",
"I_MATLPRCVARCPURGSOURCETYPETXT",
"I_MATLPRICEVARCDOCCATEGORYTEXT",
"I_PLANT",
"I_PURCHASINGGROUP",
"I_PURCHASINGORGANIZATION",
"I_SUPPLIER",
"P_INFORECORDCONSUMPTIONTXT",
"P_MATERIALPRICEVARIANCE"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_MATERIAL",
"I_MATERIALGROUP",
"I_PLANT",
"I_PURCHASINGGROUP",
"I_PURCHASINGORGANIZATION",
"I_SUPPLIER",
"P_INFORECORDCONSUMPTIONTXT"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/