GRC
HR
SCM
CRM
BI
Expand +


Article

 

Develop Custom Core Data Services in SAP S/4HANA Embedded Analytics

by Akash Kumar, Technical Consultant, SAP Labs

May 29, 2018

In the past operational reporting was done by standard reports and Report Builder. The reports were then migrated to SAP HANA Live on SAP Business Suite powered by SAP HANA, which offered huge performance benefits. Now with the release of SAP S/4HANA, the whole concept of SAP HANA Live has been moved to core data services (CDS).

Big data and analytics are now at the top of the corporate agenda. A data-driven strategy is becoming an important consideration, and many organizations are turning to SAP S/4HANA for competitive differentiation. The defined architecture for the SAP S/4HANA Embedded Analytics platform follows these key business objectives:

  • Reduced total cost of ownership (TCO)
  • Innovative applications
  • Better and faster decisions

SAP Business Suite powered by SAP HANA was based on SAP HANA Live. SAP decided to move to SAP S/4HANA Embedded Analytics. The overall concept between SAP HANA Live and SAP S/4HANA Embedded Analytics remains the same except for the core data services (CDS). SAP S/4HANA Embedded Analytics is based on ABAP CDS, which in turn is based on the Virtual Data Model (VDM) in Figure 1.


Figure 1
SAP S/4HANA Analytics architecture

The advantages of the new SAP S/4HANA Embedded Analytics approach are as follows:

  • Full ABAP integration allows the reuse of existing authorizations and the entire life cycle of the CDS entity, which was difficult with SAP HANA Live
  • CDS views are open (i.e., the CDS views definition can be deployed on any database supported by the SAP system)

The VDM is a reusable, stable, and compatible platform for development. It consists of two types of views: consumption views and interface views.

Consumption views are created on top of the interface views, and they address specific application requirements. Only the consumption views are accessed by end-user tools, such as SAP Fiori and SAP BusinessObjects, or third-party tools, such as MicroStrategy.

Interface views are accessed by consumption views and consist of the following two views: composite interface views (generally called composite views) and basic interface views, also known as private views but generally referred to as basic views. Composite views are built upon by selecting the basic views or by creating the association between the basic views. Basic views are the most granular level of VDM views created by directly accessing the database tables or by creating the join between the database tables. A basic view consists of three views:

  • Core entity views. These views contain the join between the different database tables and are often used for master data such as SalesOrderHeaders
  • Text views. These views contain the language-dependent text for the business entity
  • Hierarchy views. These views contain the hierarchy nodes for a specific business entity

The important consideration is that database tables should not be accessed directly by the consumption views. The consumption views (Figure 2) should access the basic views, which in turn access the database tables.


Figure 2
SAP S/4HANA VDM

SAP has already predelivered standard CDS views with SAP S/4HANA NetWeaver 7.5. Companies that have installed SAP S/4HANA should leverage the standard CDS before building a custom CDS. This step helps to reduce development time and cost.

The VDM views consist of CDS views that can easily be consumed by SAP Fiori and other SAP BusinessObjects tools by writing annotations. The annotation exposes CDS to different frameworks, such as Open Data Protocol (OData), Analytics, and SAP BI tools (Figure 3).


Figure 3
A different CDS framework

SAP has a predefined set of annotations that are evaluated by the framework in one of the following ways:

  • ABAP annotations are evaluated when the object defined in the DDL sources is activated or when the object is used in the ABAP run-time environment
  • Component annotation is evaluated by the framework of other components, such as OData, user interfaces (UIs), and Analytics

As soon as the CDS views are activated, an object is created in the internal database table in the ABAP Data Dictionary. Some of the most common annotations used in the CDS are as follows:

  • Analytics annotations
  • Default aggregation annotations
  • OData annotations
  • Search annotations
  • Semantics annotations
  • UI annotations                                   

Some of the sample annotations that are used more frequently are as follows:

  • @EndUserText.label: It shows the label on the UIs
  • @Analytics: {data category: #Cube} is used by BI tools and identifies transaction data
  • @DefaultAggregation: specifies the default aggregation behavior for the BI tools

You can refer to SAP Help for a comprehensive list of all the predefined CDS annotations that SAP has released. Now let’s create a custom VDM and expose the consumption view to the SAP Fiori Query Browser application.

To create a CDS view, right-click the package name, select the New option, and then the select the Other ABAP Repository Object option in Figure 4.


Figure 4
Create an ABAP Repository Object

This action opens the screen in Figure 5.


Figure 5
A new ABAP Repository Object

In the pop-up screen in Figure 5 expand the Core Data Services folder, select Data Definition, and click the Next button to display the screen in Figure 6.


Figure 6
Enter the name of the CDS view and a description

On this page of the wizard (Figure 6) you specify the name for CDS view and description. Enter the Package as ZSAPPHIRE2017, the Name as ZAK_ Basic, and the Description as Basic Core Data Services. Click the Next button to open the screen in Figure 7.


Figure 7
Selection of a transport request

Now assign the object to a transport request in Figure 7. Select the transport request. Click the Next button to displays the screen in Figure 8.


Figure 8
Select a CDS template

In the wizard (Figure 8) select the default template Define View and click the Finish button to display the screen in Figure 9.


Figure 9
Default ZAK_BASIC view

The default CDS view is created with the template in Figure 9.

The first view to create in CDS is the basic view (Figure 10). This view is the most granular. You create it by joining multiple database tables. The way to identify a basic view is by this annotation: @VDM.viewType: #BASIC.


Figure 10
The CDS basic view

Now let’s create a composite view (Figure 11), which has the majority of the business logic. The steps to create the view are the same as mentioned in the steps from Figure 4 to Figure 8. The composite view calls the basic view to get the data and further build logic. The way to identify a composite view is by this annotation: @VDM.viewType: #COMPOSITE.


Figure 11
The CDS composite view

Now let’s create the consumption view (Figure 12), which is the final view. It consumes the composite view. The way to identify a composite view is by this annotation: @VDM.viewType: #CONSUMPTION.


Figure 12
The CDS consumption view

As mentioned earlier, the consumption view can be accessed both by SAP Fiori and other analytical tools. This access is made possible by these annotations:

@OData.publish: true -> Creates an Odata Service

@Analytics.query: true -> Creates an Analytical View

SAP has delivered the SAP HANA Live Browser, which provides information on the SAP HANA Live Models in the SAP Business Suite powered by SAP HANA Analytics. Similarly, SAP S/4HANA has the Query Browser and Query Designer on SAP Fiori to support business users. Business users can access both the applications from SAP Fiori. However, the following roles need to be assigned in the SAP front-end server using transaction code SU01:

  • SAP_BR_EMPLOYEE
  • SAP_BCR_BW_AQD

To access the Query Browser, log in to SAP Fiori using the URL provided by the Basis team (Figure 13).


Figure 13
The SAP Fiori log-in page

Search for the Query Browser application in the SAP Fiori launchpad (Figure 14). Click the application Query Browser. The system then shows all the standard and custom-built CDS views.


Figure 14
The SAP Fiori launchpad

In Figure 15 ZC_DAYSALESOUTSTANDING is an example of one of the custom CDS views.


Figure 15
CDS analytical queries

Click the view named C_DAYSALESOUTSTANDING in Figure 15 to view the details in Figure 16.


Figure 16
C_DaySalesOutstanding view details

Click the Open in Design Studio button in Figure 16 to view the CDS model in SAP Design Studio (Figure 17).


Figure 17
The Day Sales Outstanding reporting view

Query Designer is another way to view CDS views. It is beneficial to business users who don’t have access to SAP HANA studio or don’t have deep technical knowledge.

Roadmap Details

SAP has recommended you use S/4HANA Embedded Analytics in SAP S/4HANA, whereas SAP HANA Live was built for SAP Business Suite powered by SAP HANA.

Since the release of SAP S/4HANA, users who are on SAP Business Suite powered by SAP HANA and want to move to S/4HANA in next two to three years are having a difficult time making a decision about their next steps for Analytics. They need to decide whether to adopt SAP HANA Live or to wait for the migration to SAP S/4HANA to adopt SAP S/4HANA Embedded Analytics. SAP HANA Live is not supported on SAP S/4HANA and has to be rewritten in CDS Views.

My advice is that users who are on SAP Business Suite powered by SAP HANA who do not have any immediate plans to migrate to SAP S/4HANA should leverage SAP HANA Live Analytics. Other users who have immediate plans to migrate to SAP S/4HANA and can’t wait for CDS views should try to build custom SAP HANA views to meet the analytics requirements. SAP has not released CDS views on the Business Suite powered by SAP HANA Analytics for productive usage. The custom views work fine after migration to SAP S/4HANA if there are no underlying table changes due to simplification in SAP S/4HANA.

An email has been sent to:





 

Akash Kumar

Akash Kumar (akashkumar1987@gmail.com) is an SAP technical consultant specializing in ABAP and SAP HANA. He has more than five years of experience in design and development of products with corporate organizations such as TCS, RBS, and SAP Labs.



More from SAPinsider



COMMENTS

Please log in to post a comment.

No comments have been submitted on this article. Be the first to comment!


SAPinsider
FAQ