C_QuantityVariance

DDL: C_QUANTITYVARIANCE SQL: CMMQUANTVAR Type: view CONSUMPTION

Quantity Variance

C_QuantityVariance is a Consumption CDS View that provides data about "Quantity Variance" in SAP S/4HANA. It reads from 3 data sources (I_CalendarDate, P_SupplierEvalByQuantity, P_QuantityVarianceUpdatedScore). It has 6 associations to related views. It is used in 11 Fiori applications: Supplier Evaluation by Quantity, Operational Supplier Evaluation, Supplier Evaluation by Price, ....

Data Sources (3)

SourceAliasJoin Type
I_CalendarDate Calendar left_outer
P_SupplierEvalByQuantity P_SupplierEvalByQuantity from
P_QuantityVarianceUpdatedScore UpdatedScore left_outer

Parameters (4)

NameTypeDefault
P_DisplayCurrency displaycurrency
P_StartDate bedat
P_EndDate bedat
P_DateFunction datefunctionid

Associations (6)

CardinalityTargetAliasCondition
[1..1] C_MM_SupplierValueHelp _Supplier $projection.Supplier = _Supplier.Supplier and $projection.CompanyCode = _Supplier.CompanyCode
[1..1] I_PurchasingOrganization _PurchasingOrganization $projection.PurchasingOrganization = _PurchasingOrganization.PurchasingOrganization
[1..1] I_PurchasingGroup _PurchasingGroup $projection.PurchasingGroup = _PurchasingGroup.PurchasingGroup
[1..1] I_MaterialGroup _MaterialGroup $projection.MaterialGroup = _MaterialGroup.MaterialGroup
[1..1] I_Material _Material $projection.Material = _Material.Material
[1..1] I_Plant _Plant $projection.Plant = _Plant.Plant

Annotations (11)

NameValueLevelField
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XL view
AbapCatalog.sqlViewName CMMQUANTVAR view
AbapCatalog.compiler.compareFilter true view
VDM.viewType #CONSUMPTION view
EndUserText.label Quantity Variance view
OData.publish true view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #NOT_REQUIRED view

Fiori Apps (11)

App IDApp NameTypeDescription
F1661 Supplier Evaluation by Quantity Analytical With the Supplier Evaluation by Quantity app, you can determine the quantity variance, which is based on the variance between the ordered quantity and delivered quantity of items. Both the excess and less delivered quantities are considered.
F1662 Operational Supplier Evaluation Analytical This app determines the score of a supplier in an organization based on the weighted average of the quantity variance, price variance, and time variance. The score is calculated over a period of 365 days. The overall score is calculated from the variance available from the different criteria, price, time, quantity or soft score after applying the weightage. Both early and late deliveries of items are considered variance.
F1663 Supplier Evaluation by Price Analytical With the Supplier Evaluation by Price app, you can determine the score of a given supplier in an organization based on the variance in the price of ordered items and delivered items. The score is calculated over a period of one year and is based on the difference in the purchase order amount and invoice amount. Both the excess and less price are considered as variance.
F1663A Supplier Evaluation by Price (Version 2) Analytical With the Supplier Evaluation by Price app, you can determine the score of a given supplier in an organization based on the variance in the price of ordered items and delivered items. The score is calculated over a period of one year and is based on the difference in the purchase order amount and invoice amount. Both the excess and less price are considered as variance.
F1664 Supplier Evaluation by Time Analytical ou can use this app to determine the score of a given supplier in an organization based on the difference in time between the ordered date of items and delivered date of items. The score is calculated over a period of 365 days. Both the late and earlier deliveries of items are considered as variance.
F1664A Supplier Evaluation by Time (Version 2) Analytical You can use this app to determine the score of a given supplier in an organisation based on the difference in time between the ordered date of items and delivered date of items. The score is calculated over a period of 365 days. Both the late and earlier deliveries of items are considered as variance.
F2234 Supplier Evaluation by Questionnaire Analytical
F2234A Supplier Evaluation by Questionnaire (Version 2) Analytical
F2309 Supplier Evaluation by Quality Analytical With the Supplier Evaluation by Quality app, you can determine the scores for given suppliers based on the inspection lot.
F2309A Supplier Evaluation by Quality (Version 2) Analytical With the Supplier Evaluation by Quality app, you can determine the scores for given suppliers based on the inspection lot.
F3295A Supplier Evaluation By Quality (for Quality Notification) (Version 2) Analytical

Supplier Evaluation by Quantity

Business Role: Strategic Buyer

With the Supplier Evaluation by Quantity app, you can determine the quantity variance, which is based on the variance between the ordered quantity and the delivered quantity of items. Both the excess and the lower delivered quantities are considered as variances. The score is determined over the previous year to date. The catalog role Materials Management - Purchasing Strategy (SAP_BCR_MM_PUR_STRATEGY) is required to access the app. Note that this catalog role is included in the business role Strategic Buyer (SAP_BR_BUYER). The following authorization objects must be maintained in SU22: F_BKPF_BUK M_BEST_WRK M_BEST_EKG M_BEST_EKO The KPI is displayed in the following views: By Supplier By Purchasing Group By Purchasing Organization By Purchasing Category By Material Group By Plant Document Trend by Supplier Trend by Purchasing Category

Key Features: You can perform the following tasks: Apply filters to display views. You can set default values for these filters: Purchasing Organization, Material Group, Plant, and Purchasing Group. To do this, go to User Actions Menu Settings Default Values. For more information, see Maintaining Your Default User Values. Apply filter to display views. Display views as chart and in tabular format. Send the app link as email or export as an excel Personalize tiles: Filter views Click the arrow icon on the screen Choose the Save as Tile option Enter relevant details and saveThe newly created tile displays on the launchpad. Navigate to the following apps: Create Activity Manage Activities Manage Purchase Order Manage Purchasing Category Purchasing Category Factsheet My Purchasing Document Items Supplier Factsheet

Operational Supplier Evaluation

Business Role: Strategic Buyer

This app determines the score of a supplier in an organization based on the weighted average of the quantity variance, price variance, and time variance. The score is calculated over the previous year to date. The overall score is calculated from the variance available from the different criteria, and then the weighting is applied. For example, price is weighted more than quantity. The catalog role Materials Management - Purchasing Strategy (SAP_BCR_MM_PUR_STRATEGY) is required to access the app. Note that this catalog role is included in the business role Strategic Buyer (SAP_BR_BUYER). The following authorization objects must be maintained in SU22: F_BKPF_BUK M_BEST_WRK M_BEST_EKG M_BEST_EKO The KPI is displayed in the following views: By Supplier By Purchasing Group By Purchasing Organization By Purchasing Category By Material Group By Plant Document Trend Trend by Supplier Trend by Purchasing Category By Top 10 Suppliers By Bottom 10 Suppliers

Key Features: Using this app, you can do the following: Apply filters to display views. You can set default values for these filters: Purchasing Organization, Material Group, Plant, and Purchasing Group. To do this, go to User Actions Menu Settings Default Values. For more information, see Maintaining Your Default User Values. Analyze data in the form of chart and in tabular format. Share the analysis results via an email or export as an excel. Save the analyzed filters for later reference as a new tile: Filter views Click the arrow icon on the screen Choose the Save as Tile option Enter relevant details and saveThe newly created tile displays on the launchpad. Navigate to the following apps: Manage Purchasing Category Purchasing Category Factsheet My Purchasing Document Items Supplier Factsheet The views are grouped according to the supplier, purchasing group, purchasing organization, purchasing category, material group, document, and trend.

Supplier Evaluation by Price

Business Role: Strategic Buyer

With the Supplier Evaluation by Price app, you can determine the score of a given supplier in an organization based on the variance in the price of ordered items and delivered items. The score is calculated over the previous year to date and is based on the difference in the purchase order amount and invoice amount. Both the excess price and the lower price are considered as variances. The catalog role Materials Management - Purchasing Strategy (SAP_BCR_MM_PUR_STRATEGY) is required to access the app. Note that this catalog role is included in the business role Strategic Buyer (SAP_BR_BUYER). The following authorization objects must be maintained in SU22: F_BKPF_BUK M_BEST_WRK M_BEST_EKG M_BEST_EKO The KPI is displayed in the following views: By Supplier By Purchasing Group By Purchasing Organization By Purchasing Category By Material Group By Plant Document Trend by Supplier Trend by Purchasing Category

Key Features: You can perform the following tasks: Apply filters to display views. You can set default values for these filters: Purchasing Organization, Material Group, Plant, and Purchasing Group. To do this, go to User Actions Menu Settings Default Values. For more information, see Maintaining Your Default User Values. Apply filter to display views. Display every view as chart and in tabular format. Personalize tiles: Filter views Click the arrow icon on the screen Choose the Save as Tile option Enter relevant details and saveThe newly created tile displays on the launchpad. Navigate to the following apps: Create Activity Manage Activities Manage Purchase Order Manage Purchasing Category Purchasing Category Factsheet My Purchasing Document Items

Supplier Evaluation by Price (Version 2)

Business Role: Strategic Buyer

This new app is a replacement for the app , which is planned to be deprecated with SAP S/4HANA Cloud 2102. We recommend that you start using this new app instead of the old app Supplier Evaluation by Quality (Deprecated). SAP Fiori ID for this app is F3295A. You can now view number of purchase orders and number of purchase order items with this app.

Supplier Evaluation by Time

Business Role: Strategic Buyer

You can use this app to determine the score of a given supplier in an organization based on the difference in time between the ordered date of items and delivered date of items. The score is calculated over the previous year to date. Both the late and early deliveries of items are considered as variance. You can also see the time variance by delivery date. The catalog role Materials Management - Purchasing Strategy (SAP_BCR_MM_PUR_STRATEGY) is required to access the app. Note that this catalog role is included in the business role Strategic Buyer (SAP_BR_BUYER). The following authorization objects must be maintained in SU22: F_BKPF_BUK M_BEST_WRK M_BEST_EKG M_BEST_EKO The KPI is displayed in the following views: By Supplier By Purchasing Group By Purchasing Organization By Purchasing Category By Material Group By Plant Document Trend by Supplier Trend by Purchasing Organization

Key Features: Using this app, you can do the following: Apply filters to display views. You can set default values for these filters: Purchasing Organization, Material Group, Plant, and Purchasing Group. To do this, go to User Actions Menu Settings Default Values. For more information, see Maintaining Your Default User Values. Apply filter to display views. Analyze data in the form of chart and in tabular format. Share the analysis results via an email or export as an excel. Personalize tiles: Filter views Click the arrow icon on the screen Choose the Save as Tile option Enter relevant details and saveThe newly created tile displays on the launchpad. Navigate to the following apps: Create Activity Manage Activities Manage Purchase Order Manage Purchasing Category Purchasing Category Factsheet My Purchasing Document Items Supplier Factsheet

@ClientHandling.algorithm: #SESSION_VARIABLE //Inserted by VDM CDS Suite Plugin

@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL
@AbapCatalog.sqlViewName: 'CMMQUANTVAR'
//Commented by VDM CDS Suite Plugin:@ClientDependent: true

@AbapCatalog.compiler.compareFilter: true
@VDM.viewType: #CONSUMPTION
@EndUserText.label: 'Quantity Variance'
//Commented as analytical manager no longer supports AVG, COUNT, COUNT_DISTINCT

//@Analytics.dataCategory: #CUBE

@OData.publish: true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #NOT_REQUIRED

define view C_QuantityVariance

  with parameters
    @Consumption.defaultValue: 'EUR'
    @Consumption.valueHelpDefinition: [{
      entity: {
        name:'I_Currency',
        element:'Currency'
      }
    }]
    P_DisplayCurrency           : displaycurrency,
    
    @Consumption.derivation: { lookupEntity: 'C_SglGregorianCalDateFunction', 
    resultElement: 'DateFunctionStartDate', binding: [ {
      targetParameter: 'P_DateFunction', type: #PARAMETER, value : 'P_DateFunction' },
       { targetParameter : 'P_Language' , type : #SYSTEM_FIELD, value : '#SYSTEM_LANGUAGE'  } ] 
    } 
    @Consumption.hidden: true
    P_StartDate: bedat,
    
    @Consumption.derivation: { lookupEntity: 'C_SglGregorianCalDateFunction', 
    resultElement: 'DateFunctionEndDate', binding: [ {
      targetParameter: 'P_DateFunction', type: #PARAMETER, value : 'P_DateFunction' },
       { targetParameter : 'P_Language' , type : #SYSTEM_FIELD, value : '#SYSTEM_LANGUAGE'  } ] 
    } 
    @Consumption.hidden: true
    P_EndDate: bedat,
    @Consumption.defaultValue: 'PREVIOUSYEARTODATE'
    @Consumption.valueHelpDefinition: [{
      entity: {
        name:'C_GregorianCalDateFuncVH',
        element:'DateFunction'
      }
    }]
    P_DateFunction              : datefunctionid 
  as select from    P_SupplierEvalByQuantity( P_DisplayCurrency : $parameters.P_DisplayCurrency,
                                              P_StartDate : $parameters.P_StartDate,
                                              P_EndDate : $parameters.P_EndDate)    as QuantityVariance

//   inner join P_SuplrEvalScoring as CalculatedScore on (   QuantityVariance.PurchasingOrganization = CalculatedScore.PurchasingOrganization

//                                                      and CalculatedScore.SuplrEvalCriterion                = '2'

//                                                      and QuantityVariance.QuantityVariancePctWithSign     = CalculatedScore.AbsolutePercentage

//                                                      and CalculatedScore.IsSupplierEvalSwitchActive = 'X'

//                                                      )

//                                                   or (    (  ( QuantityVariance.PurchasingCategory    = CalculatedScore.PurchasingCategory )

//                                                          or ( QuantityVariance.PurchasingCategory is null and CalculatedScore.PurchasingCategory is null ) )

//

//                                                      and CalculatedScore.SuplrEvalCriterion                = '02'

//                                                      and QuantityVariance.QuantityVariancePctWithSign     = CalculatedScore.AbsolutePercentage

//                                                      and CalculatedScore.IsSupplierEvalSwitchActive = 'X'

//                                                      

//                                                   )

    
    left outer join P_QuantityVarianceUpdatedScore  as UpdatedScore     on  QuantityVariance.PurchaseOrder     = UpdatedScore.PurchaseOrder
                                                                                 and QuantityVariance.PurchaseOrderItem = UpdatedScore.PurchaseOrderItem
    left outer  join  I_CalendarDate as Calendar    on PurchaseOrderDate = Calendar.CalendarDate
    
  association [1..1] to C_MM_SupplierValueHelp   as _Supplier                   on $projection.Supplier = _Supplier.Supplier 
                                                                               and $projection.CompanyCode = _Supplier.CompanyCode

  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_MaterialGroup          as _MaterialGroup              on $projection.MaterialGroup = _MaterialGroup.MaterialGroup

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

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

{
      /* Keys */
  key cast( QuantityVariance.PurchaseOrder as vdm_purchaseorder )                       as  PurchaseOrder,
  key cast( QuantityVariance.PurchaseOrderItem as vdm_purchaseorderitem)                as  PurchaseOrderItem,


  @Consumption: {
                      filter: {                    -- Usage of derviation.lookupEntity requires a filter definition too!
                                mandatory: false,
                                hidden: true,
                                selectionType: #SINGLE,
                                multipleSelections: false
                              },
  //                     hidden: true,

                      derivation: {
                                    lookupEntity: 'F_SuplrEvalCriteriaGenConfign',
                                    resultElement: 'SuplrEvalCritraDelivCompleted'
                                  }
                    }
  @Environment.sql.passValue: true 
  //@Semantics.booleanIndicator:true

  SuplrEvalCritraDelivCompleted , 
  
      /* Order Date */
      PurOrdItmFirstGRPostingDate,
      PurOrdItmFinalGRPostingDate,
      @Semantics.calendar.year: true
      Calendar.CalendarYear,
      Calendar.CalendarQuarter,
      Calendar.CalendarMonth,
      Calendar.CalendarWeek,

      /* Org Data */
      @Consumption.labelElement: 'PurchasingOrganizationName'
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_PurchasingOrgValueHelp', element : 'PurchasingOrganization' } }]
      QuantityVariance.PurchasingOrganization,
      @Semantics.text: true
      _PurchasingOrganization.PurchasingOrganizationName ,
      @Consumption.labelElement: 'PurchasingGroupName'
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_PurchasingGroupValueHelp', element : 'PurchasingGroup' } }]
      PurchasingGroup,
      @Semantics.text: true
      _PurchasingGroup.PurchasingGroupName,
      CompanyCode,

      /* Supplier Data */
      @Consumption.labelElement: 'SupplierName'
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MM_SmplSupplierValueHelp', element : 'Supplier' } }]
      Supplier,
      @Semantics.text: true
      _Supplier.SupplierName,
      @Consumption.labelElement: 'CountryName'
      _Supplier.Country                                                                 as   SupplierCountry,
      @Semantics.text: true
      _Supplier._CountryText[1: Language = $session.system_language].CountryName,

      /* Item Data */
      @Consumption.labelElement: 'MaterialName'
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MM_MaterialValueHelp', element : 'Material' } }]
      Material,
      @Semantics.text: true
      _Material._Text[1: Language = $session.system_language].MaterialName,

      @Consumption.labelElement: 'MaterialGroupName'
      QuantityVariance.MaterialGroup,
      @Semantics.text: true
      _MaterialGroup._Text[1: Language = $session.system_language].MaterialGroupName,

      @Consumption.labelElement: 'PlantName'
      Plant,
      @Semantics.text: true
      _Plant.PlantName                                                                  as  PlantName,

      @ObjectModel.text.element: ['PurgCatName']
      @Consumption.labelElement: 'PurgCatName'
      @Consumption.valueHelpDefinition: [{ entity: { name : 'I_PurchasingCategoryValueHelp', element : 'PurchasingCategory' } }]
      PurchasingCategory,
      @Semantics.text: true
      PurgCatName,

      @Semantics.unitOfMeasure: true
      PurchaseOrderQuantityUnit,

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

      /* Measures */
      @DefaultAggregation: #SUM
      @Semantics.quantity.unitOfMeasure: 'PurchaseOrderQuantityUnit'
      cast( OrderedQuantity as mm_a_ordered_quantity )                                  as  OrderedQuantity,
      @EndUserText.label: 'Goods Receipt Quantity'
      @DefaultAggregation: #SUM
      @Semantics.quantity.unitOfMeasure: 'PurchaseOrderQuantityUnit'
      DeliveredQuantity                                                                 as  GoodsReceiptQty,

      @DefaultAggregation: #SUM
      @Semantics.quantity.unitOfMeasure: 'PurchaseOrderQuantityUnit'
      cast ( QuantityVarianceInOrdUnit as mm_a_quantity_variance )                      as  QuantityVarianceInOrdUnit,

      @DefaultAggregation: #SUM
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      cast( QuantityVarianceInDspCrcy as mm_a_quantity_var_amount )                     as  QuantityVarianceInDspCrcy,

      @DefaultAggregation: #AVG
//      0 as QuantityVarianceScore,

      cast( case when UpdatedScore.IsScoreChanged = 'X' 
        then UpdatedScore.QuantityVarianceScore
       else SupplierEvaluationScore
      end as mm_a_variance_score )                                                      as  QuantityVarianceScore,


      @DefaultAggregation: #AVG
      cast ( QuantityVarianceInPct as mmpur_ana_de_quantityvar_pct )                               as  QuantityVarianceInPct , // changed the DE to avoid numeric overflow error , as this filed holds the variance and not percentage mm_a_timevar_statdeliv_pct 

      
       
      
      // @EndUserText.label: 'Purchase Order Count'

       @Aggregation.referenceElement: ['PurchaseOrder']
      @Aggregation.default: #COUNT_DISTINCT
       cast( 1 as mm_pur_ana_numbrofpurords ) as NumberOfPurchaseOrders,    
       
      //@EndUserText.label: 'Purchase Order Item Count'

        @DefaultAggregation: #SUM
       cast( 1 as mm_pur_ana_numbrofpurorditms ) as NumberOfPurchaseOrderItems  
      
}