C_PurOrdValueWithPlnd

DDL: C_PURORDVALUEWITHPLND SQL: CPOVALPLNDVSACTL Type: view CONSUMPTION

Purchase Order Value with Planned Spend

C_PurOrdValueWithPlnd is a Consumption CDS View that provides data about "Purchase Order Value with Planned Spend" in SAP S/4HANA. It reads from 4 data sources (P_UNSGNDMATGRPTXT, P_PurgCatPlndSpndItems, P_PurgSpendActlFutr, I_PurchasingCategoryMatlGroup). It has 11 associations to related views. It is used in 4 Fiori applications: Purchase Order Value and Scheduling Agreement Value, Purchase Order Average Delivery Time, Quantity Contract Consumption, ....

Data Sources (4)

SourceAliasJoin Type
P_UNSGNDMATGRPTXT _Doc left_outer
P_PurgCatPlndSpndItems P_PurgCatPlndSpndItems left_outer
P_PurgSpendActlFutr P_PurgSpendActlFutr from
I_PurchasingCategoryMatlGroup PurchasingCategoryMatlGroup left_outer

Parameters (3)

NameTypeDefault
P_DisplayCurrency displaycurrency
P_Language sylangu
P_DateFunction datefunctionid

Associations (11)

CardinalityTargetAliasCondition
[1..1] C_MM_MaterialGroupValueHelp _MaterialGroup $projection.MaterialGroup = _MaterialGroup.MaterialGroup
[0..1] C_MM_SupplierValueHelp _Supplier $projection.Supplier = _Supplier.Supplier and $projection.CompanyCode = _Supplier.CompanyCode
[1..1] C_MM_MaterialValueHelp _Material $projection.Material = _Material.Material and $projection.Plant = _Material.Plant
[0..1] C_PurchasingGroupValueHelp _PurchasingGroup $projection.PurchasingGroup = _PurchasingGroup.PurchasingGroup
[0..1] C_PurchasingOrgValueHelp _PurchasingOrganization $projection.PurchasingOrganization = _PurchasingOrganization.PurchasingOrganization
[1..1] I_Plant _Plant $projection.Plant = _Plant.Plant
[1..1] I_PurchasingDocumentType _PurchasingDocumentType $projection.PurchasingDocumentType = _PurchasingDocumentType.PurchasingDocumentType and $projection.PurchasingDocumentCategory = _PurchasingDocumentType.PurchasingDocumentCategory
[1..1] I_PurgDocumentItemCategory _PurgDocumentItemCategory $projection.PurchaseOrderItemCategory = _PurgDocumentItemCategory.PurchasingDocumentItemCategory
[1..1] I_PurchasingDocumentCategory _PurchasingDocumentCategory $projection.PurchasingDocumentCategory = _PurchasingDocumentCategory.PurchasingDocumentCategory
[1..1] I_CompanyCode _CompanyCode ActualSpend.CompanyCode = _CompanyCode.CompanyCode
[1..1] I_CompanyCode _ReceivingCompanyCode $projection.ReceivingCompanyCode = _ReceivingCompanyCode.CompanyCode

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName CPOVALPLNDVSACTL view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
AccessControl.personalData.blocking #NOT_REQUIRED view
EndUserText.label Purchase Order Value with Planned Spend view
VDM.viewType #CONSUMPTION view
OData.publish true view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #L view

Fiori Apps (4)

App IDApp NameTypeDescription
F1378 Purchase Order Value and Scheduling Agreement Value Analytical You can use this app to retrieve the order value for all the purchase orders over time. The app also helps to determine the KPI value of the purchase orders for a given set of filter criteria such as the materials, supplier, and plant. The business value of the app is that you can determine all the current value of all purchase orders in the system.
F1380 Purchase Order Average Delivery Time Analytical You can use this app to check the average delivery time of orders to the suppliers.
F2012 Quantity Contract Consumption Analytical
F2013 Value Contract Consumption Analytical

Purchase Order Value and Scheduling Agreement Value

Business Role: Strategic Buyer

You can use this app to retrieve the order value for all the purchase orders within a stipulated time. The app also helps to determine the KPI value of the purchase orders for a given set of filter criteria such as the materials, supplier, and plant. The business value of the app is that you can determine all the current value of all purchase orders in the system. The role Strategic Buyer (SAP_BR_BUYER) is required to access the app. This KPI is displayed in the following views: •By Supplier•By Purchasing Category•By Material Group•By Purchasing Group•By Plant•By WBS Element•Document•Trend

Purchase Order Average Delivery Time

Business Role: Strategic Buyer

Using the Purchase Order Average Delivery Time Weighted app, you can check the average delivery time of orders to the suppliers. The role Strategic Buyer (SAP_BR_BUYER) is required to access the app. The app is displayed in the following views: •By Supplier•By Material Group•By Plant•By Purchasing Category•Document

Quantity Contract Consumption

Business Role: Strategic Buyer

You can use this app to identify the consumption percentage of quantity type contracts in the last 365 days, from the current date. You can also find the target and released quantity of the contracts.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:•M_BEST_EKG•M_BEST_EKO•M_BEST_WRK•M_RAHM_EKG•M_RAHM_EKO•M_RAHM_WRK•F_BKPF_BUK•S_RS_COMP•S_RS_COMP1The KPI is displayed in the following views:•By Supplier•By Purchasing Group•By Purchasing Organization•By Purchasing Category•By Material Group•By Cost Center•Document•Trend

Value Contract Consumption

Business Role: Strategic Buyer

You can use this app to identify the consumption percentage of value type contracts over the last 365 days from the current date. You can also find the target and released amount of the contracts.The role Materials Management - Purchasing Strategy (SAP_BCR_MM_PUR_STRATEGY) is required to access the app. The following authorization objects must be maintained in SU22:•M_BEST_EKG•M_BEST_EKO•S_RS_COMP•S_RS_COMP1The KPI is displayed in the following views:•By Supplier•By Purchasing Group•By Purchasing Organization•Document•Trend

@AbapCatalog.sqlViewName: 'CPOVALPLNDVSACTL'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@AccessControl.personalData.blocking: #NOT_REQUIRED
@EndUserText.label: 'Purchase Order Value with Planned Spend'
@VDM.viewType: #CONSUMPTION
@OData.publish: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory:  #L

define view C_PurOrdValueWithPlnd
  with parameters
    @Consumption.defaultValue: 'EUR'
    @Consumption.valueHelpDefinition: [{
      entity: {
        name:'I_Currency',
        element:'Currency'
      }
    }]
    P_DisplayCurrency : displaycurrency,

    @Consumption.hidden : true
    @Environment.systemField : #SYSTEM_LANGUAGE
    P_Language        : sylangu,
    @Consumption.defaultValue: 'PREVIOUSYEARTODATE'
    @Consumption.valueHelpDefinition: [{
      entity: {
        name:'C_GregorianCalDateFuncVH',
        element:'DateFunction'
      }
    }]
    P_DateFunction    : datefunctionid,

    @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       : /srmsmc/puc_spend_valid_from,

    @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         : /srmsmc/puc_spend_valid_to

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


    left outer join I_PurchasingCategoryMatlGroup                                     as PurchasingCategoryMatlGroup on ActualSpend.MaterialGroup = PurchasingCategoryMatlGroup.MaterialGroup
    left outer join P_UNSGNDMATGRPTXT                                                 as _Doc                        on DocNumber = _Doc.DocNumber
    left outer join P_PurgCatPlndSpndItems(  P_DisplayCurrency:$parameters.P_DisplayCurrency,
                                                  P_StartDate:$parameters.P_StartDate ,
                                                  P_EndDate : $parameters.P_EndDate ) as PlannedSpend                on  PurchasingCategoryMatlGroup.PurgCatUUID = PlannedSpend.PurgCatUUID
                                                                                                                     and ActualSpend.YearQuarter                 = PlannedSpend.YearQuarter
  association [1..1] to C_MM_MaterialGroupValueHelp  as _MaterialGroup              on  $projection.MaterialGroup = _MaterialGroup.MaterialGroup
  association [0..1] to C_MM_SupplierValueHelp       as _Supplier                   on  $projection.Supplier    = _Supplier.Supplier
                                                                                    and $projection.CompanyCode = _Supplier.CompanyCode
  association [1..1] to C_MM_MaterialValueHelp       as _Material                   on  $projection.Material = _Material.Material
                                                                                    and $projection.Plant    = _Material.Plant
  association [0..1] to C_PurchasingGroupValueHelp   as _PurchasingGroup            on  $projection.PurchasingGroup = _PurchasingGroup.PurchasingGroup
  association [0..1] to C_PurchasingOrgValueHelp     as _PurchasingOrganization     on  $projection.PurchasingOrganization = _PurchasingOrganization.PurchasingOrganization //and

  association [1..1] to I_Plant                      as _Plant                      on  $projection.Plant = _Plant.Plant
  association [1..1] to I_PurchasingDocumentType     as _PurchasingDocumentType     on  $projection.PurchasingDocumentType     = _PurchasingDocumentType.PurchasingDocumentType
                                                                                    and $projection.PurchasingDocumentCategory = _PurchasingDocumentType.PurchasingDocumentCategory
  association [1..1] to I_PurgDocumentItemCategory   as _PurgDocumentItemCategory   on  $projection.PurchaseOrderItemCategory = _PurgDocumentItemCategory.PurchasingDocumentItemCategory
  association [1..1] to I_PurchasingDocumentCategory as _PurchasingDocumentCategory on  $projection.PurchasingDocumentCategory = _PurchasingDocumentCategory.PurchasingDocumentCategory
  association [1..1] to I_CompanyCode                as _CompanyCode                on  ActualSpend.CompanyCode = _CompanyCode.CompanyCode
  association [1..1] to I_CompanyCode                as _ReceivingCompanyCode       on  $projection.ReceivingCompanyCode = _ReceivingCompanyCode.CompanyCode


{
  key ActualSpend.PurchaseOrder,
  key ActualSpend.PurchaseOrderItem,
  key ScheduleLine,
  key PurchaseRequisition,
  key PurchaseRequisitionItem,
  key SchedulingAgreement,
  key SchedulingAgreementItem,

      @Consumption: {
                          filter: {
                                    mandatory: false,
                                    hidden: true,
                                    selectionType: #SINGLE,
                                    multipleSelections: false
                                  },
                          derivation: {
                                        lookupEntity: 'F_ProcmtAnalyticsDataSelMeth',
                                        resultElement: 'PurgDocMigrtnIsCmpltdForAnlyts'
                                      }
                        }
      @Environment.sql.passValue: true
      @UI.hidden: true
      @Consumption.hidden: true
  key PurgDocMigrtnIsCmpltdForAnlyts,

      @Consumption.labelElement: 'PurchasingDocumentCategoryName'
      @ObjectModel.text.element: ['PurchasingDocumentCategoryName']
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_PurchasingDocCategoryVH', element : 'PurchasingDocumentCategory' } }]
      ActualSpend.PurchasingDocumentCategory,
      @Semantics.text: true
      _PurchasingDocumentCategory._Text[1: Language = $parameters.P_Language].PurchasingDocumentCategoryName as PurchasingDocumentCategoryName,

      @EndUserText.label: 'Document Type'
      @Consumption.labelElement: 'PurchasingDocumentTypeName'
      @ObjectModel.text.element: ['PurchasingDocumentTypeName']
      @Consumption.valueHelpDefinition: [{ entity: { name : 'I_PurchasingDocumentType', element : 'PurchasingDocumentType' } }]
      PurchasingDocumentType,
      @Semantics.text: true
      _PurchasingDocumentType._Text[1: Language = $parameters.P_Language].PurchasingDocumentTypeName         as PurchasingDocumentTypeName,

      @EndUserText.label: 'Item Category'
      @Consumption.labelElement: 'PurgDocItemCategoryName'
      @ObjectModel.text.element: ['PurgDocItemCategoryName']
      PurchaseOrderItemCategory,
      @Semantics.text: true
      _PurgDocumentItemCategory._Text[1: Language = $parameters.P_Language].PurgDocItemCategoryName          as PurgDocItemCategoryName,

      @Consumption.hidden: true
      PurchasingCategoryMatlGroup.PurgCatUUID,

      @Consumption.labelElement: 'SupplierName'
      @ObjectModel.text.element: ['SupplierName']
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MM_SmplSupplierValueHelp', element : 'Supplier' } }]
      ActualSpend.Supplier,
      @Semantics.text: true
      _Supplier.SupplierName,

      @ObjectModel.text.element: ['CountryName']
      @Consumption.labelElement: 'CountryName'
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MM_CountryValueHelp', element : 'SupplierCountry' } }]
      cast( _Supplier.Country as mm_a_supplier_country )                                                     as SupplierCountry,
      @Semantics.text: true
      _Supplier._CountryText[1: Language = $parameters.P_Language].CountryName,

      @Consumption.hidden: true
      ActualSpend.PurchaseOrderDate,
      ActualSpend.CalendarYear,
      ActualSpend.CalendarQuarter,
      ActualSpend.CalendarMonth,
      ActualSpend.CalendarWeek,
      @Consumption.hidden: true
      ActualSpend.YearQuarter,

      @Consumption.labelElement: 'PurchasingOrganizationName'
      @ObjectModel.text.element: ['PurchasingOrganizationName']
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_PurchasingOrgValueHelp', element : 'PurchasingOrganization' } }]
      ActualSpend.PurchasingOrganization,
      @Semantics.text: true
      _PurchasingOrganization.PurchasingOrganizationName,
      @Consumption.labelElement: 'CompanyCodeName'
      @ObjectModel.text.element: ['CompanyCodeName']
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_CompanyCodeValueHelp', element : 'CompanyCode' } }]
      ActualSpend.CompanyCode,
      @Semantics.text: true
      _CompanyCode.CompanyCodeName,

      @Consumption.labelElement: 'ReceivingCompanyCodeName'
      @ObjectModel.text.element: ['ReceivingCompanyCodeName']
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_CompanyCodeValueHelp', element : 'CompanyCode' } }]
      @EndUserText.label: 'Receiving Plant Company Code'
      ActualSpend.ReceivingCompanyCode,
      @Semantics.text: true
      _ReceivingCompanyCode.CompanyCodeName                                                                  as ReceivingCompanyCodeName,

      @Consumption.labelElement: 'PurchasingGroupName'
      @ObjectModel.text.element: ['PurchasingGroupName']
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_PurchasingGroupValueHelp', element : 'PurchasingGroup' } }]
      ActualSpend.PurchasingGroup,
      @Semantics.text: true
      _PurchasingGroup.PurchasingGroupName,

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

      @ObjectModel.text.element: ['CompanyCodeCountryName']
      @EndUserText.label: 'Ordering Country'
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MM_CountryValueHelp', element : 'Country' } }]
      _CompanyCode.Country                                                                                   as ProcmtHubCountry,

      @Semantics.text: true
      _CompanyCode._Country._Text[1: Language = $parameters.P_Language].CountryName                          as CompanyCodeCountryName,
      @ObjectModel.text.element: ['ImprtRespyRcvgPlantCountryName']
      @EndUserText.label: 'Receiving Country'
      @Consumption.valueHelpDefinition: [{ entity: { name : 'C_MM_CountryValueHelp', element : 'Country' } }]
      _Plant._OrganizationAddress.Country                                                                    as IssuingOrReceivingPlantCountry,

      @Semantics.text: true
      _Plant._OrganizationAddress._Country._Text[1: Language = $parameters.P_Language].CountryName           as ImprtRespyRcvgPlantCountryName,

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


      @ObjectModel.text.element: ['PlantName']
      @Consumption.labelElement: 'PlantName'
      ActualSpend.Plant,
      @Semantics.text: true
      _Plant.PlantName,

      ActualSpend.ProductType,
      ActualSpend.ServicePerformer,

      @Consumption.filter.hidden: true
      cast( '' as mm_supplier_classification preserving type )                                               as SupplierClassification,
      @Consumption.filter.hidden: true
      cast( '' as mm_material_grp_classification )                                                           as MaterialGroupClassification,
      @Consumption.filter.hidden: true
      cast( '' as mm_purg_grp_classification )                                                               as PurchasingGroupClassification,

      @DefaultAggregation: #SUM
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      cast( cast( 0 as abap.curr(21,5)) as mm_supplier_cumulative_spend preserving type )                    as SupplierCumulativeSpend,
      @DefaultAggregation: #SUM
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      cast( cast( 0 as abap.curr(21,5)) as mm_matl_grp_cumulative_spend preserving type )                    as MaterialGroupCumulativeSpend,
      @DefaultAggregation: #SUM
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      cast( cast( 0 as abap.curr(21,5)) as mm_purg_grp_cumulative_spend  preserving type )                   as PurchasingGroupCumulativeSpend,

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

      //  PurchasingCategoryMatlGroup._PurchasingCategory.PurgCatName,

      @Semantics.text: true
      case when PurchasingCategoryMatlGroup._PurchasingCategory.PurgCatName is null then

      _Doc.DomainText
      //  'Material Group not linked to purchasing category'

         else PurchasingCategoryMatlGroup._PurchasingCategory.PurgCatName   end                              as PurgCatName,


      @Semantics.currencyCode:true
      @UI.hidden: true
      ActualSpend.DisplayCurrency,
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      @DefaultAggregation:#SUM
      cast(ActualSpend.PurOrdNetAmountInDisplayCrcy as purchase_order_net_amount preserving type)            as PurOrdNetAmountInDisplayCrcy,

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

      //      cast(

      //      case when Numberofitems > 0

      //      then

      //      cast( division( PlannedSpend.PlannedSpendPerQuater, Numberofitems, 10 ) as abap.dec( 25, 13 ) )

      //      else 0

      //      end

      //      as mm_a_purc_category_plnd_spend )  as PurgCatPlndSpendAmount,

      @DefaultAggregation:#AVG

      cast( PlannedSpend.PlannedSpendPerQuater as mm_a_purc_category_plnd_spend )                            as PurgCatPlndSpendAmount,
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      @DefaultAggregation:#SUM
      PurRequisitionExpectedSpend,
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      @DefaultAggregation:#SUM
      ScheduleLineExpectedSpend,
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      @DefaultAggregation:#SUM
      SchedulingAgreementSpend,
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      @DefaultAggregation:#SUM
      SchedgAgreementExpectedSpend,
      @Semantics.amount.currencyCode: 'DisplayCurrency'
      @DefaultAggregation:#SUM
      cast ( ActualSpend.PurOrdNetAmountInDisplayCrcy + SchedulingAgreementSpend as mm_purchasing_spend )    as PurchasingSpend

}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"C_MM_MATERIALGROUPVALUEHELP",
"C_MM_MATERIALVALUEHELP",
"C_MM_SUPPLIERVALUEHELP",
"C_PURCHASINGGROUPVALUEHELP",
"C_PURCHASINGORGVALUEHELP",
"I_COMPANYCODE",
"I_COUNTRY",
"I_COUNTRYTEXT",
"I_ORGANIZATIONADDRESS",
"I_PLANT",
"I_PURCHASINGCATEGORY",
"I_PURCHASINGCATEGORYMATLGROUP",
"I_PURCHASINGDOCUMENTCATEGORY",
"I_PURCHASINGDOCUMENTTYPE",
"I_PURCHASINGDOCUMENTTYPETEXT",
"I_PURGDOCUMENTCATEGORYTEXT",
"I_PURGDOCUMENTITEMCATEGORY",
"I_PURGDOCUMENTITEMCATEGORYTEXT",
"P_PURGCATPLNDSPNDITEMS",
"P_PURGSPENDACTLFUTR",
"P_UNSGNDMATGRPTXT"
],
"ASSOCIATED":
[
"C_MM_MATERIALGROUPVALUEHELP",
"C_MM_MATERIALVALUEHELP",
"C_MM_SUPPLIERVALUEHELP",
"C_PURCHASINGGROUPVALUEHELP",
"C_PURCHASINGORGVALUEHELP",
"I_COMPANYCODE",
"I_PLANT",
"I_PURCHASINGDOCUMENTCATEGORY",
"I_PURCHASINGDOCUMENTTYPE",
"I_PURGDOCUMENTITEMCATEGORY"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/