Calculating Custom Metrics with CPE-UM

In SAP Sustainability Control Tower, users can use SAP-defined metrics or create custom metrics based on their needs. However, some metrics require complex calculations with combinations of subtractions and divisions and cannot be implemented with custom metrics. The sections below describe how to use CPE-UM (Universal Model) and the CPE-UM environments delivered by SAP to implement these calculations. The end-to-end process is based on the following steps:
  1. Replicate master data and measure data from SAP Sustainability Control Tower to CPE-UM with the SCT Connector environment.

  2. Calculate the custom metrics in CPE-UM at any hierarchy level: business locations, legal entities, organizational units, as well as periods.

  3. Write the calculated results back to SAP Sustainability Control Tower and save the results as basic custom metrics with the calculation type No Aggregation (as the aggregated values are pre-calculated in CPE-UM).

To ease the implementation of this process, SAP provides the following CPE-UM environments:
SAP-provided CPE-UM environments

Environment

Purpose

SCT Connector environment (SCTCONNECT)

  • To retrieve the master data and data in CPE-UM

  • To expose the master data and data to the custom CPE-UM environments

Write Basic Custom Metrics to SCT environment (SCTWBCM)

  • To expose a table and a function to write back the basic custom metrics to SAP Sustainability Control Tower

  • To write the calculated results to the basic custom metrics with the inbound APIs

For more information, see Writing Data from CPE-UM to SAP Sustainability Control Tower.

SCT Sample Custom Metrics (SCTSMETRIC), a customizable environment

  • Connected to the SCT Connector and Write Basic Custom Metrics to SCT environments

  • To implement the calculations of the custom metrics

Prerequisites

General

Access to CPE-UM

  • Create a custom tile to access the CPE-UM homepage in the My Custom Tiles app. For more information, see Using the My Custom Tiles Application.

  • The URL to CPE-UM is based on the URL of your tenant: https://<tenant>.sct.sustainability.cloud.sap/ace/cp.portal/site#Shell-home.

Your own custom metric environment

To use the environment SCT Sample Custom Metrics (SCTSMETRIC) to implement the calculation of your own custom metrics, copy the provided SCT Sample Custom Metrics environment. Do not work directly in the SCT Sample Custom Metrics environment but configure the calculations in the copied environment. To copy the SAP-provided environment, perform the following steps:
  1. In CPE-UM, open the app Manage Environments.

  2. Select the environment SCT Sample Custom Metrics and choose Copy.

  3. Rename the copied environment and change its description.

To use existing CPE-UM environments in other tenants, you can transport them from one tenant to another, for example, from a development to a productive tenant. To do so, you need to export the respective environment to a .ZIP file and then import this file to the desired tenant. For more information, see Exporting and Importing CPE Packages.

Process "SCT Custom Metrics sample"

The process "SCT Custom Metrics sample" is available in the environment SCT Sample Custom Metrics. You can customize it in your copied environment. The purpose of this process is to run the end-to-end calculation with the following activities:

Activities

Description

01. Refresh data from SAP Sustainability Control Tower, trigger the calculations and writing back to SAP Sustainability Control Tower

Replicate the master data and measure data from SAP Sustainability Control Tower to the SCT Connector environment.

02. Write to SCT Connector

Write the results of calculated metrics from the SCT Sample Custom Metrics environment to the Write Basic Custom Metrics to SCT environment.

03. Push and validate basic custom metrics

Push the metric data to the DPI and run the validation rules in SAP Sustainability Control Tower.

04. Error validation logs of the metrics to discard

Errors detected during the validation. All metrics with errors will be discarded.

05. Warning validation logs of the metrics to discard

If all rows of a metric already exist in SAP Sustainability Control Tower, the metric is discarded.

06. Discard basic custom metrics with issues

Discard the metrics identified in steps 04. and 05.

07. Validation logs for publishing metrics

This activity displays the data of the objects that do not have any errors or warnings. All the data listed in this activity will be published to SAP Sustainability Control Tower.

08. Publish basic custom metrics without issues

Publish the all validated metrics.

09. Review the data sent to SAP Sustainability Control Tower

Review the data sent to SAP Sustainability Control Tower.

Only the first activity must be manually initiated. The other activities then run automatically.
There are two ways to initiate the first activity:
  • Run the activity: The master data and measure data is refreshed in the SCT Connector. Once the refresh is finished, the activity is automatically confirmed, and the next activity becomes active and is run.

  • Confirm the activity: the master data and measure data is not refreshed. The next activity becomes active and is run. This option is relevant if you have updated the custom metric calculation in the SCT Sample Custom Metrics environment and want to run the calculation on the existing data replicated from SAP Sustainability Control Tower.

You can adapt this process, but the existing activities (and their activity links) must remain intact. For example, if you need to add an activity to input data, you can create an activity between the first and second activity. Once the new activity is confirmed, the second activity to write to the SCT Connector environment must become active to run the other steps of the process.

Connection Between Environments

The environments SCT Connector, Write Basic Custom Metrics to SCT, and SCT Sample Custom Metrics exchange two types of data:
  • From SCT Connector to SCT Sample Custom Metrics: the master data and measure data are replicated from SAP Sustainability Control Tower to the environment SCT Connector. Once this information is available, it can be consumed by your own environment. The environment SCT Connector exposes tables to consume this information.

  • From SCT Sample Custom Metrics to Write Basic Custom Metrics to SCT: Once the calculation of custom metrics is completed in your own environment, the results must be written back to SAP Sustainability Control Tower. To do so, the data first needs to be written to the Write Basic Custom Metrics to SCT environment.

The connection between these three environments is already defined and available in Manage Connections:
  • The connection from SCT Connector environment to the environment SCT Sample Custom Metrics is defined in SCT Sample Custom Metrics using the ID SCTCONNECT.

  • The connection from the environment SCT Sample Custom Metrics to the environment Write Basic Custom Metrics to SCT is defined in SCT Sample Custom Metrics using the ID SCTWBCM.

All the tables exposed by the environments SCT Connector and Write Basic Custom Metrics to SCT are automatically created in the environment SCT Sample Custom Metrics as Model Reference functions. These functions are available in the folders zSCTConnector and zWriteToSCT.

Data exposed by the environment SCT Connector

The environment SCT Connector exposes several model entities (tables) which can be used in your own environment. These model entities expose the master data and data replicated from SAP Sustainability Control Tower.

Find the list of model entities exposed by the SCT Connector environment which are relevant to calculate custom metrics below:

Model Entity ID

Description

Hierarchy Aggregation Tables

SCTBusinessLocationsProj

Table used to calculate custom metrics at any level of the business location hierarchy. For each node of the hierarchy, it provides the list of leaves attached to the node.

SCTLegalEntitiesProj

Table used to calculate custom metrics at any level of the legal entity hierarchy. For each node of the hierarchy, it provides the list of leaves attached to the node.

SCTOrgUnitsProj

Table used to calculate custom metrics at any level of the organizational unit hierarchy. For each node of the hierarchy, it provides the list of leaves attached to the node.

SCTPeriodsProj

Table used to calculate custom metrics at any level of the period hierarchy. For each node of the hierarchy, it provides the list of leaves attached to the node. For monthly data, it is used to calculate the metrics by month, by quarter, and by year. For quarterly data, it is used to calculate the metrics by quarter and by year.

Measure Data

SCTAccountingMeasureData

Measure data of the DPI Accounting (Prosperity)

SCTCorruptionMeasureData

Measure data of the DPI Corruption Incidents

SCTEmissionMeasureData

Measure data of the DPI Emissions

SCTEnergyMeasureData

Measure data of the DPI Energy

SCTGenericMeasureData

Measure data of the DPI Generic

SCTInjuryMeasureData

Measure data of the DPI Injury

SCTLandSiteMeasureData

Measure data of the DPI Land Sites

SCTPeopleMeasureData

Measure data of the DPI People

SCTResourceUseMeasureData

Measure data of the DPI Resource Use

SCTWasteMeasureData

Measure data of the DPI Waste

SCTWaterMeasureData

Measure data of the DPI Water

Writing Back to SAP Sustainability Control Tower

SCTBasicCustomMetricsData

Once the calculation of the custom metrics has been done in your own environment, the results must be written back to SAP Sustainability Control Tower. To do so, first write this data to the table. Then, this table is used in the next steps of the process to write the data to SAP Sustainability Control Tower.

Other Tables

 

SCTMeasureList

List of available measures in SAP Sustainability Control Tower

SCTSustainabilityMetrics

List of available metrics in SAP Sustainability Control Tower (including basic and custom metrics).

SCTPeriods

Periods (month, quarter, year)

SCT<dimension>

For each dimension, a model entity is exposed with the master data of the corresponding dimension.

The SCT Connector environment exposes additional tables for the master data replicated from SAP Sustainability Control Tower. If you need to access this master data (for example, to use a property of a dimension in the calculation), you can create a new "Environment" connection from the SCT Connector environment to your copied environment and filter on the exposed tables you want to use.

Overview: Calculating a Custom Metric

The next topics describe how to implement the calculation of a custom metric in your own environment and how to write the results back to SAP Sustainability Control Tower. The SCT Sample Custom Metrics environment is delivered with one example calculation of a custom metric. For most of the steps described in the next topics, you need to duplicate the functions of the example and adapt the copied functions according to your use case.

In the next topics, the explanations follow the example of a calculation with an example metric "Gender Pay Gap Excluding Base Salary".

Prerequisites

Before implementing a new custom metric in your own environment, check the below prerequisites:
  • Create the basic custom metric with the calculation method No aggregation. The ID of the basic custom metric will be used during the implementation of the calculation in CPE-UM.

  • The runtime status of the environments SCT Connector and your own environment are "Current" in the Manage Environments CPE-UM application.

  • Define the components of the calculation rule base on the formula of the custom metric:

    • Metric ID of the basic custom metrics created in SAP Sustainability Control Tower.

    • List of measures used in the formula and their IDs.

    • List of the DPIs which provide the above measures.

    • List of dimensions used to filter the measure data.

    • List of partial formulas and their calculation rules. Depending on the complexity of the formula, it could be relevant to divide the calculations into two or more steps (for example, if a partial formula is used multiple times in the formula of the custom metric).

Based on this information, build a table as in the example below based on the sample custom metric "Gender Pay Gap Excluding Base Salary". Different information from this table will be needed at each step of the configuration which will be specified in the relevant step.

Calculation Rule Components

Description

ID of basic custom metric

Z_G_GAP

Formula

The full formula which calculates the metric Gender Pay Gap Excluding Base Salary.

Measures

  • Remuneration: PPL_REMUNERATION

  • Hours Worked: PPL_HOURS_WORKED

  • Base Salary: PPL_BASE_SALARY

List of DPIs

All the above measures are provided by the People DPI.

Filtered dimensions

The data of each measure must be distinguished by gender (female and male), which is the filtered dimension during the calculation.

Partial formula

The formula can be divided into two steps:

  • Step 1: Calculate the salary bonus component per gender

    The partial formula which calculates the salary bonus component for females.

    The partial formula which calculates the salary bonus component for males.

  • Step 2: Calculate the custom metric based on an intermediate measure "Salary Bonus Component"

Overview of the steps to implement the calculation

  1. Select the measure data used for the calculation of the custom metric: Selecting the Measure Data.

  2. Prepare the aggregated data by Business Location, Legal Entity, and Reporting Line hierarchies: Preparing Aggregated Data by Hierarchies.

  3. Calculate the custom metric: Calculating a Custom Metric.

  4. Write the results of the calculation of the custom metric to the SCT Connector environment: Writing Results Back to the SCT Connector Environment.

In the section "Details" of the function, the section "Documentation" contains a description of the purpose of the function.