Saturday, 8 December 2018

How to find a predefined Virtual Data Model in S/4HANA

Purpose 


This blog illustrates how to find a predefined Virtual Data Model (VDM), template of the CDS View for business entities in S/4HANA in many ways.

The target audience are developers  looking to create reports or other applications, and functional experts writing specifications for  development. Each are expected to have already understood the basic concept of CDS views and S/4HANA application architecture (Fiori-OData-CDS Views) and want to save the effort for development by using Predefined VDMs, and want to know what kind of VDMs are available in S/4HANA.

I have had sessions regarding S/4HANA Development in which I recommend VDM. After  these sessions, I have been asked for a process of locating standard VDMs by the audiences several times. I write this blog to answer this typical question.

Motivation


Predefined VDM is one of the keys in S/4HANA architecture, but I feel not so many customers enjoy them, and one of the reason is, I believe, it is difficult to find the Predefined VDM they want to use. By providing some ways to find Predefined VDMs, I expect customers to enjoy Predefined VDM in S/4HANA.

Options to find a CDS View


There are several ways to find CDS Views in S/4HANA. Below are the main ways:

1. Fiori View Browser

To list CDS Views and display the definition of the CDS Views and export the list as Excel File

2. Transaction RSRT in SAPGUI

To execute Analytic Query of CDS Views and the associated source

3. List View of Fiori Apps Library

To find the CDS View used in each Fiori app

4. Where Used List of Transaction SE11 in SAPGUI

To find the VDM from the source table

Opening a CDS View definition


Whichever options you use to find a CDS View, in many cases, it is necessary to check the source of the CDS View to understand it in more detail.

ADT:

In ABAP Development Tools (ADT), the CDS View can be opened.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

Search with CDS View name. By adding “type:DDLS” into the earch string, only the data definitions are searched.

In this case, “I_PROFITCENTER” should be opened. Then, type “I_Profit type: DDLS”, and select I_PROFITCENTER, in this example, the first entry in the result.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

The definition of the CDS View is displayed as follows:.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

Program RUTDDLSSHOW2

The Definition can be opened with the program RUTDDLSSHOW2 in the transaction SE38 of SAPGUI.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

SQL Views are also generated as part of the CDS View. The SQL View can be opened in the transaction SE11 of SAPGUI.

The definition of the selected SQL View is displayed. The name in “DDL Source” field in the SQL definition, is the name of CDS View. If the name is started with “I_”, it should be a predefined VDM (as now the SQL View name also begins with “I”).

The following example using SE11 shows:,

DL SQL View name is “IFIPROFITCENTER”

DDL Source name (CDS View name) is “I_PROFITCENTER”.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

◈ By clicking the name of DDL Source (I_PROFITCENTER), the source code can be checked (program RUTDDLSSHOW2).

For some views, it is possible to run “Contents” (data preview) in this screen, but for other views, it is not possible, e.g. when the corresponding CDS View has the parameters.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

◈ Mappings between CDS View name and SQL view name are stored in the table CDSSQLVIEW.

Options for Locating CDS Views


1. Fiori View Browser

Fiori View Browser is the most basic tool to check CDS view including VDM. This tool can be used by assigning users the role SAP_BR_ANALYTICS_SPECIALIST. Before doing that, initial setting is needed (Activate OData “CDSALLVIEWS” with Transaction “/iwfnd/maint_service” in Frontend Server).

https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/#/detail/Apps(‘F2170’)/S12OP

What I do is to export the list of the CDS View in the desktop of my PC from View Browser and use it when I have to find the views.

“View Browser” can be launched from Fiori Launchpad.

(or launch URL directly: <https or https>://<server>:<port>/sap/bc/ui2/flp#CDSView-browse)

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

In View Browser, you can search with the search terms. By clicking an entry, the definition of the CDS View can be displayed.

In the following case, search term is “Profitcenter” and click “I_ProfitCenter”.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

Detail is displayed.

Definition:

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

Annotation:

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

Cross Reference:

Only CDS Views where a valid annotation of “@Analytics.query: true” is defined will the  “Show Content” be available. Data can be displayed. In the following case, as C_GLLINEITEMSQ0001 is Analytic Query, “Show Content” is available.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

By clicking “Show Content”, the CDS View is executed with Fiori Multidimensional Reporting.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

By clicking the “Settings” icon in the initial CDS View list, it is possible to add or remove fields, sort, filter, group.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

It is possible to export the list to excel file.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

It is possible to count the number of the view using Pivot table.

Below is the summary of the CDS View in S/4HANA1809 FPS00. FALSE/TRUE means release status.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

You would think too many views are there to check. But I think you don’t have to check all views, but the first step should be to focus on Interface View, and many of Interface View are master data.

Prefix of Predefined VDM is C_ (Consumption View), I_ (Interface View), P_(Private View), and E_ (Extension used in other views). The View type most frequently reused for custom objects is Interface View (I_), and many of them are master data (normally simple).

I like it. I stored the file in the desktop of my PC.

2. Transaction RSRT in SAPGUI

When? Who?

Analytic Query of CDS View works almost the same as BW Query. Slicing, dicing and drill down (OLAP navigations) are possible in the query. Analytic Query is only a part of all CDS View and it is a type of Consumption View. But as it is easy to run, it can be the first step to try the Analytic Query to have the overall image about VDMs in S/4HANA. After gaining an overall image, it is suggested to check the views in detail leveraging other methods. In addition, you can also check the contents of BPC for S/4HANA, as BW Queries for BPC for S/4HANA can be executed in the same way.

How to run Analytic Query CDS Views via Embedded BW:

You can run Analytic Query type CDS Views with Transaction RSRT from a SAPGUI session within your S/4HANA system like BW Query. In the InfoArea tree of the value help, the queries whose technical name start with “2CC” (the query name is “2C”+<SQL View name of the CDS View>. “2C” is prefix of Analytic Query, and SQL View name of Consumption View starts with “C”), can be selected.

It is possible to run Analytic Query type CDS Views with Fiori Query Browser, or BusinessObjects tools like Analysis Office. But I take Transaction RSRT in this blog as it can be used without additional setting and it can be executed in SAPGUI.

Push the Value Help button in the transaction RSRT.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

Select an Analytic Query.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

The view can be executed in this transaction.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

OLAP navigations are possible using the navigation panel in the left side of the screen.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material


The field is drilled down into COLUMN in the table
The field is drilled down into ROW in the table
 Data is filtered with the selected characteristic value(s).

In the Transaction RSRT, it is also possible to run the source of the Analytic Query. Then the query name is !2C<SQL View name of the CDS View>.  Specifically, the CDS View in which Analytic Data category is CUBE or DIMENSION can be executed in this way.

In the following case, “IFIGLLITMCUBE” is the SQL View of the CDS View “I_GLACCOUNTLINEITEMCUBE” and which is the source of “C_SLOWORNONMOVINGMATLQRY” (“CSLOWNOMOMATQ”). It can also be executed in Transaction RSRT by using the name “!2CIFIGLLITMCUBE”.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

Result

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

OLAP navigations are possible as in the Analytic Query.

3. List View of Fiori Apps Library

What is Fiori Apps Library?

Fiori Apps Library is the public site in which the configuration for each Fiori predefined apps is explained including, e.g. OData Service, UI5 Application, Role, Catalog. Some OData Services comes from CDS View.

When, Who?

Some OData services used in predefined Fiori Apps are generated from CDS View, and you can find the CDS View (VDM) used in the Fiori apps you are interested in in Fiori Apps Library. Functional experts would want to know where the data comes from in a Fiori predefined apps or which CDS View maybe required to be enhanced (* but Custom Fields and Logic should be used to add fields to Fiori apps as much as possible). Development experts want to create similar Fiori apps to the Predefined that are available,  so would want to know how the CDS View is coded and used in the Fiori apps they are interested in. In these cases, the Fiori apps library would help.

My favorite way is to change the Fiori Apps library display  to List View, to list the Fiori apps, export it to an excel file, and save it in the desktop of my PC and use it when I want to know the detail about the Fiori apps.

How to find VDM in Fiori Apps Library List View

Go to Fiori Apps Library and select “Fiori apps for SAP S/4HANA” in the left.

After selecting “All Apps”, and select “List View” on center bottom of the page.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

In the right, from “Column display settings” icon, select all columns to be displayed.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

You can detect application types with the column “UITechnology”, e.g. “SAP Fiori: SAP Smart Business generic drill down app” which refers to KPI tiles.

PrimaryODataServiceName column is the main OData Service used in the Fiori app. (“AdditionalODataServices” is another used OData Services). The name of the OData Services generated from CDS View ends with “_CDS”. (In the following sheet, new column I is created in which the formula is “=RIGHT(H,4)” for filtering with “_CDS”.

The OData Services whose name ends with “_SRV” is the one generated with Transaction SEGW, and CDS View MIGHT be used as the source of the OData Service. After adding the OData Service with Transaction /IWFND/MAINT_SERVICE, the main source CDS View of the OData Service might be able to be found in the table CFD_W_ODATA_CTXT.

Run Transaction /IWFND/MAINT_SERIVICE, and select the added OData Service, and push “Service Implementation” in the bottom-right of the screen. In this case, “ZFAC_GLV_GL_ACCOUNT_LINE_ITEMS_SRV” is selected.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

In Service Implementation, check Technical Model name.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

Search the name “FAC_GLV_GL_ACCOUNT_LINE_ITEMS_MD*” in CFD_W_ODATA_CTXT.

In this case, C_JOURNALENTRYITEMBROWSER is the CDS View used in the OData Service.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

This OData Service can be opened with Transaction SEGW.

SAP ABAP Development,  ABAP Extensibility, SAP S/4HANA, SAP ABAP Study Material

However, the applications of UItechnology Fiori Design Studio (=Multidimensional Reporting) do not use an OData Service, but Analytical Query of CDS view is used. For these, you can run Transaction RSRT from a SAPGUI session within your S/4HANA system. 

4. Where Used List of Transaction SE11 in SAPGUI

You can find the VDM using a table. Functional experts would want to find the VDM for Profit Center and have already known the source table should be CEPC. Then it is possible to find the VDM “I_ProfitCenter” from CEPC using Where-Used List in Transaction SE11.

2 comments: