Custom KPIs for ABAP-based components

This page describes how a custom KPI for an ABAP-based component can be defined and instrumented. You can select the respective service type during the definition of the KPI.


Custom KPI Definition

The definition of the KPI is done in the Business Process Monitoring Application. Details on Creating Custom KPIs(opens in new tab) are available on the SAP Help Portal.

For the definition and the instrumentation relevant technical aspects of a KPI are name, identifier, service type, header, and data. These details are relevant for the instrumentation of the custom KPI and will be used in the specific steps.

Prerequisites

  • Business Process Monitoring is successfully configured. The relevant setup steps are available in the area Business Process Monitoring - Setup & Configuration.
  • Supported managed component types:
    • SAP Business Suite 7
    • SAP S/4HANA
    • SAP S/4HANA Cloud Private Edition
  • Please make sure to have at least ST-PI 740 SP31 implemented in the managed component.

Instrument KPI

The following steps describe how to implement a custom KPI in the managed component and require ABAP development knowledge.

Info: You must define a separate class for each KPI, the example below is using the KPI ZKPITA0001.

Step 1: Create the custom KPI in SAP Cloud ALM Business Process Monitoring using KPI Management. During this process, you also need to select the KPI category, such as Throughput or Backlog.

  • Backlog figures measure the number of business documents, line items, or schedule lines that are blocked, incomplete, or not completely processed by an expected date. e.g. the KPI value represents the total number of business documents.
  • Throughput figures measure the total number of business documents, line items, or schedule lines that are processed within the selected time frame. E.g. KPI value represents the total number of business documents.

For a full description, refer to the KPI Categories in SAP Help Portal.

The screenshot below shows the result for the example KPI used in this context.

For more details, see: Creating Custom KPIs in SAP Help Portal.

 

Step 2: Create a subclass of /SDF/CL_CRBPA_CKPI


Step 3
: Implement the following two methods of the interface /SDF/IF_CRBPA_CKPI

  • Redefine method GET_KPI_ID:
    In this method, you must specify the ID of your custom KPI. Use the KPI ID as defined in Step 1.
ABAP Code

method /sdf/if_crbpa_ckpi~get_kpi_id.

  rv_kpi_id = 'ZKPITA0001'.

endmethod.

  • Redefine method GET_DATA:
    In this method, you maintain the details of where the data for the KPI must be collected and hand it over in the respective format.

    The following code lines explain, following the example, how data records are selected to transfer them as part of the regular data collection:
ABAP Code

method /sdf/if_crbpa_ckpi~get_data.

 

  data lt_sbook type table of sbook.

  data lv_look_back_time type dats.

 

  get time stamp field data(lv_collection_time).

  lv_look_back_time = sy-datum - 180.

 

  select carrid connid fldate bookid forcuram from sbook

    into corresponding fields of table lt_sbook

      where fldate >= lv_look_back_time.

 

  loop at lt_sbook into data(wa_sbook).

    insert value #(

      id = wa_sbook-carrid && wa_sbook-connid && wa_sbook-fldate && wa_sbook-bookid

      field_1 = wa_sbook-bookid

      field_2 = wa_sbook-fldate

      field_3 = wa_sbook-forcuram

      field_4 = wa_sbook-carrid

      timestamp_utc = lv_collection_time

    ) into table et_data.

  endloop.

 

endmethod.


Result of Step 2 and 3
: The following example shows the class with the redefined methods:


Step 4
: (No manual activity required – automatic step)
Once the next auto discovery execution starts, the custom KPI will be included in the data collection and be available in Business Process Monitoring with the next execution of the data collection.
Info: The auto discovery is scheduled on an hourly basis. You might need to wait for the next regular execution. 

Result

Once Step 4 was executed and the data collection took place successfully, you can see the details on the data collection in the KPI Management as well as the relevant data in the Business Process Monitoring application: