Reporting on S/4HANA using CDS views as a basis
With the arrival of SAP HANA, there has been a paradigm shift in the way data is managed and applications developed. Since HANA is an in-memory database and performance (fast and real time) is a major requirement for a lot of Businesses, the strategy has been to perform as many operations as possible at the database level. In the past, data modelling was done mostly on the application server and not on the database server. In order to leverage the advantages of HANA, SAP introduced a new data modelling infrastructure which is done at the database level using CDS (Core data services). CDS views exist in 2 flavours, namely, ABAP CDS views and HANA CDS views.
One of the common needs in an organization is the ability to do analytics and real time data reporting on transactional data. With the power of HANA on the backend, analytics (large queries) can now be done directly on S/4HANA without any significant performance degradation or the need for a separate data warehouse. Using CDS views, virtual data models (VDM’s) can now be created directly in ERP with optimal performance that can be consumed by the various front-end tools.
SAP S/4HANA embedded Analytics comes with a pre-packaged collection of analytical features (pre-delivered CDS views) that can be used to perform real-time data analytics on live transactional data with little knowledge of the underlying data tables/structures. Depending on the analytical needs of a Business, either the views can be consumed directly or combined with new views (or modified/enhanced views) to create new data models.
The key principle of a virtual data model is to build a semantic layer on top of the existing database model. There are 2 main VDM types, namely, Interface views (Basic and Composite) and consumption views.
- Interface Views are subdivided into 2 types:
o Basic views (Core Entity views, Text view and Hierarchy views) are built directly on top of DDIC tables or views and hence interact with database tables for fetching data.
o Composite Views are built on top of one or more basic views. Multiple basic views can be joined and calculation done (using expressions and functions) to make a composite view. Composite views can either be consumption specific or re-usable
- Consumption Views:
o Consumption views are built on top of composite views and hence do not interact either with basic views or DDIC tables
o Consumptions views are the ones which are exposed to the front-end tools
A consequence of the layered structure of the VDM models explained above is that the database tables will not be accessed directly by consumer views but only through the interface layer.
The CDS views (consumption type) created can be consumed by many SAP front end tools like Fiori apps, Analysis for office, SAP analytics cloud etc. As was explained above, generally CDS consumption views can be used for building dashboard/reports or performing ad-hoc analysis. However, it is also possible to create Bex Queries on top of CDS views of Analytics categories #CUBE and #DIMENSION (Transient provider). Although CDS views of type query should be used wherever possible, in specific cases creating a Bex Query may be more preferred/required. Some of the reasons for using Bex Queries are:
- Availability and usage of OLAP functions (difficult to impossible in CDS views)
- Exposing Bex Query for external access by OData
- Offset of variables, formulas, calculations, exceptions, cell editor functions are a few which are more easy to accomplish in a Bex Query (some of them are possible in CDS views as well)
The general rule of thumb should be to use CDS queries if all the required functionalities can be achieved. Use of Bex queries on top of CDS views (transient provider) should be done only if absolutely necessary. One particular point to note is; when changes are made to CDS views (e.g., renaming of fields), the reactivation of the CDS views leads to change in object names in Bex Queries and hence making it necessary to re-adjust the Bex Queries.
Contact us for more information