Visualize S4HANA Cloud ABAP CDS views using SAP Cloud Platform & Analytics Cloud
S/4HANA Cloud is being constantly enhanced to offer a wide range of functionality. Over the last few months I have been working with different customers helping them to realize few use cases which require extension of S/4HANA Cloud. One of the common requirement is the ability to mash up data from existing S/4HANA Cloud system with other SAP and non-SAP system to provide more meaningful information across an E2E process.
S/4HANA Cloud has a set of whitelisted APIs. These APIs are made available in https://api.sap.com. At the time of writing this blog, there are 138 APIs (OData + SOAP) which can be used to extract information from S/4HANA Cloud.
As of S/4HANA Cloud 1711 release, a new capability has been introduced which would allow customers to replicate ABAP CDS views from S/4HANA Cloud to a HANA database on SAP Cloud Platform. This was announced here in this blog.
In this blog, I wanted to share my experience on how I managed to replicate CDS views & tables to HANA database on SAP Cloud Platform and build analytics on top of it.
Below is the overall architecture which shows various components involved across S/4HANA Cloud, SAP Cloud Platform and SAP Analytics Cloud.
In order to achieve this scenario, you would need an account on SAP Analytics Cloud and HANA database on SAP Cloud Platform. On providing the details of the SAP Cloud Platform account, the Cloud DevOps team would install the Cloud Connector and configure SAP Landscape Transformation Replication server (SLT) and prepare the landscape for real-time replication.
Below is my HANA database which I am using for the replication scenario. I also have a Cloud Connector connected to this SAP Cloud Platform account (which uses a service channel to expose the HANA database)
In S/4HANA Cloud, I need to configure a Communication System as well as a Communication agreement.
I have created a Communication system and provided the HANA DB user credentials in the outbound communication user
In the Communication agreements (for scenario SAP_COM_0048), I have referred to the previously created Communication system and provided the Schema name.
Once the Communication system & agreements have been configured, the next step would be to use the “Replicate CDS Views”
This view will by default display the logical system which would have been configured by the Cloud Operations team. The logical system will be used internally to replicate data to the HANA DB. In the below screenshot, I have already added 6 views for replication. To add more view, I can just click on the add icon.
This will open up a popup screen with the list of released CDS views. As of today, there are only 18 CDS views which are made available. I can select any of the CDS view and add them to the application.
Notice the number in orange (top right corner) which states that 1 view is ready to be replicated. In order to add this view the existing replication process, you need to click on the “publish” button.
Notice that the status of the view changes from “To be replicated” to “replicating”
In order to examine what’s going in the background, you can switch to the application log. This will navigate to another Fiori application.
Here you can view the status of all the replication jobs and drill down into the detail of each job.
The current job which I had triggered , shows the replication status of individual CDS views. You can see that it has replicated existing CDS view and also created new objects for I_GLACCOUNTLINEITEMS.
I can now switch to SAP Cloud Platform account and view the catalog objects in HANA database. There are two schemas which would have been created. One with the name provided in the Communication Agreement – “SCPTA” and another schema with the naming convention “<SCHEMA>_TABLE_REPL_PUBLIC_VIEWS_CLIENT_100”. This schema have all the replicated CDS views.
SCPTA schema has all the tables which are being used by the views.
I can create new calculation views based on the catalog object and mash them with data from other sources. In the below image, I have shown the creation of a Sales data calculation view.
Once the Calculation views have been modelled, they are ready to be consumed in Analytics Cloud. In Analytics Cloud, I would need to first create a connection the SAP Cloud Platform account.
Once the connection has been configured, we would need to create a model which refers to this calculation view.
When creating a model, I am selecting a Live Data connection as shown below
This will give me a popup screen to select the system and I can select the calculation view which I had created earlier.
The last step is creating a story based on this model. I am selecting a chart type and selecting the measures and dimensions.
The below report shows the top Sales documents by net value
I think this is a great step forward which now enables us to extract data out of S/4HANA Cloud and build mashup scenarios. In the above example, the charts show the data in real-time from S/4HANA Cloud systems.