SAP S/4HANA, SAP S/4HANA Embedded Analytics

SAP S/4HANA Embedded Analytics – From process to table

In this blog post we will lay out the technical aspects of SAP S/4HANA Embedded Analytics, specifically how to get from a process to the apps and eventually the underlying CDS-views and tables. This is called data lineage. This information can be helpful when an issue arises in an app or the dataset needs to be adjusted or expanded.

When implementing SAP S/4HANA, the organization starts with capturing the processes. When the processes have been outlined, the corresponding S/4 reporting functionality can be found. There are three possible scenarios to do this:

1) The client uses a standard Fiori Analytical App (top flow)

2) The customer uses a (custom) Query (bottom flow)

3) Functionality is tailor-made

Depending on the scenario there is different method applicable to analyze the data lineage. The third scenario is not discussed in this blog post.

A graphical representation of the complete process is presented below.

Determine the process

We start by determining the process. To find the appropriate app we use the SAP Best Practices Explorer via https://rapid.sap.com/bp/. Click on SAP S/4HANA and then SAP Best Practices for SAP S/4HANA (on premise)‎. In menu item Solution Scope you will have the option to select the Scope Items per Line of Business. These Scope Items cover the standard processes as defined in SAP S/4HANA. For this blog post we will use Scope Item Procurement of Direct Materials (J45) as an example.

Get the Business roles

When opening the Scope Item, a description of the S4/HANA standard process is shown. This includes a document called Test script. In this document, the process of the Scope Item is described in detail including the business roles involved in the execution of this process. The Business Roles form the basis of what Fiori app is used for which part of the process. A user must be assigned a business role to use the Fiori Apps that fall within this Scope Item.

In the Test script you will find a chapter called Roles, in which the business roles of the process are shown. Logically, many of the roles within Procurement of Direct Materials are related to Purchasers, Inventory Managers and Accounts Payable Accountants, as you can see in the role description in the screenshot below.

Get the Fiori Analytical apps

Once the business roles within the scope item are known, the Fiori Apps that are included in this role can be requested. Since we are discussing Embedded Analytics, we focus on the Fiori Analytical Apps, the built-in Fiori apps aimed at reporting and analytics. In our example, the role of Purchaser (SAP_BR_PURCHASER) is used.

To find the Fiori Analytical Apps for the purchasing role, we can use the SAP Fiori Apps Reference Library via the link https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer.

Click on All apps for SAP S/4HANA in the menu on the left side of the screen and select by Roles. At the top left a search bar will appear where a business role can be entered. As shown in the screenshot below, this role has 149 apps. Via the filter button, only the Analytical Type SAP Fiori – Analytical can be selected, after which only the reporting apps are shown. When selecting an app, more information about this Fiori Analytical app (read: report) is shown.

In this example, the analytical app Monitor Materials Without Purchase Contract was selected. When assigning the business role SAP_BR_PURCHASER to the user, this user can immediately start using this standard report which shows all materials without a purchase contract.

But where is the data in the report come from?

Look up the OData service of the Fiori app

To find the source data of an app, the first step is to find the name of the OData service. This can be done in two ways:

  1. via the Fiori Apps library
  2. via the app’s Manifest.json file.

Option 1 – via the Fiori Apps library

In the App Details of the Fiori app the OData service of the app can be found under Implementation information -> Configuration -> OData Service(s).

Option 2 – via the manifest.json file

If it is not listed in the Fiori App Library, the OData service can be found in the app’s manifest.json file. The technical name of the SAPUI5 application can be used for this.

Open the SAP GUI and start transaction SE80. Select BSP Application and enter the technical name of the SAPUI5 application. In section Page Fragments you will find the file manifest.json. The OData service can be found in the code of this file under “dataSources”. Please note, this option is available in the SAP S/4HANA on-premise and private cloud variant only.

Determining the CDS views of the OData service

Once we found the OData service that supplies the Fiori app with data, the underlying CDS views found as well. Depending on the naming convention of the OData Service, this can be done in three ways:

  1. OData service with suffix CDS
  2. suffix _SRV
  3. prefix CB

1. OData service <xxxx>_CDS

Take the name of the OData service without the suffix _CDS.

The Data Definition of this can be found in Eclipse. Please note, this is only possible in the SAP S/4HANA on-premise or private cloud variant.

2. OData service <xxxx>_SRV

For the OData services with naming convention _SRV, an additional step is required. First step is to take the OData service without the suffix _SRV.

Open the SAP GUI, go to the SAP Gateway Service Builder (transaction SEGW) and open the OData service. This shows the data model of the OData service. Click on the hierarchy to show the Entity Types this will show the CDS views. Copy the technical name of the CDS view without the suffix Type and you can find the CDS view in Eclipse. This step is also only possible in SAP S/4HANA on-premise or private cloud.

3. OData service CB_<xxxxx>

To retrieve the underlying CDS views of an OData service with naming convention CB_, the first step is to go to transaction /IWFND/MAINT_SERVICE in the SAP GUI. The OData service can be searched via the filter button. When found, select the service, and click Service Implementation at the bottom right.

Open the Data Provider class.

Go to the method GET_ENTITYSET and search within the ABAP code for the technical names of the CDS views.

Other OData services

If you have an OData service that does not fall within these naming conventions, there is another way to determine the underlying CDS views. To do this, go to transaction /IWFND/MAINT_SERVICE again and click on Service Implementation. This time, open the Model Provider Class.

Search within the class for the method IF_SADL_GW_MODEL_EXPOSURE_DATA~GET_MODEL_EXPOSURE.

Search in the code for dataSource type=”CDS” and after binding= you will find the names of the CDS views.

This is the data lineage process of a Fiori Analytical app to the CDS views. But what if it is not a standard Fiori app that is used, but a query?

Determine the Query

Open the Query Browser app in SAP S/4HANA and type in a keyword of the data you are looking for, like Product. The Query Browser now lists all queries that have product in the view name.

Get the CDS view

When the query is found, the underlying views can be retrieved in the SAP S/4HANA app View Browser. Since the query itself is also a view, the technical name of the query can be looked up directly. A query is always of View Type Consumption.

Click on the view and select the Cross reference tab to see the CDS views.

Another way, only available for SAP S/4HANA on-premise and private cloud, is to search for the technical name of the query view directly in Eclipse.

Get the table(s)

Finding the CDS view is not the end of our journey. CDS views often take data from other CDS views, that in turn read their data from SAP source tables. To get an overview of the relations between various CDS views and source tables the Dependency Analyzer can be used.

This is done by searching for the CDS view in eclipse. By right clicking in the code, you can select Open with a Dependency Analyzer.