Thursday, 28 November 2019 15:37

Consume CDS views in S/4HANA – Step by step

Written by https://blogs.sap.com/2019/11/29/consume-cds-views-in-s-4hana-step-by-step/
Rate this item
(0 votes)

SAP Analytics Cloud, the comprehensive Analytics Platform from SAP enables users to have an end to end analytics experience on multiple applications. With S/4HANA, SAC integrates with CDS (Core Data Services)

views and delivers real time data analytics to users. The augmented analytics capabilities of SAC enables users to dig deeper and derive comprehensive insights from available data. Coupled with live connectivity, SAC is able to deliver analytics without the need to store data or process it.

This blog post attempts to put out a step by step procedure to explore an end to end scenario of creating a custom CDS view and consuming it in SAC using a live connection.Listed below are the steps to connect SAP Analytics Cloud with S/4HANA CDS views. The same steps can be followed for other connections.

  1. CDS or Core Data Services is the underlying technology in S/4HANA that enables information processing directly on the database server instead of the application server. One of the features of CDS views is the use of annotations to enable additional metadata on the data model. For creating a CDS view, logon to the HANA studio. Select the ABAP perspective as shown below:
  2. At the top of the CDS views are the annotations which are used with the @ symbol. Annotations enable developers to add additional metadata features to the CDS views. In the current case the odata.publish has been enabled to ensure OData service can be enabled for this current view.
  3. Once the CDS view is created it needs to be released for being available for consumption and hence the API state needs to be set as shown below. This can be done by right clicking the view and selecting the API State from the drop down. Select the option “Display Use System-Internally”.
  4. Once the API state is set, the OData needs to be enabled. This can be done by logging on to the SAP GUI and connecting to the system.
  5. From the home screen, go to the transaction /n/IWFND/MAINT_SERVICE. This t-code is used to maintain services. This is where the OData service for the CDS view created in the previous step would be created.Since this is a newly created view, it would not be available in the services listed in under /IWFND/MAINT_SERVICE and hence would need to be created first before releasing an OData for the same.
  6. Click on the Add Service button as shown. This will bring up the screen for adding services as shown in the figure below:
  7. Select the system alias as shown and click on the Get Services button to list all the services currently available.
  8. The next screen will come up as shown. Verify the details and select the appropriate package from the screen. In case the object does not need to be transported, select the Local Object option. Click Continue to publish the service.
  9. The next screen will come up as shown. Verify the details and select the appropriate package from the screen. In case the object does not need to be transported, select the Local Object option. Click Continue to publish the service.
  10. The service will be published as below.
  11. The service would now be available in the list of OData services as shown in the next figure. This service can now be available for consumption as shown below:
  12. Now login to the SAP Analytics Cloud and Create a new model as shown below.
  13. Select the option Get data from datasource. The connections window will come up. Select the live connection. The list of connections will come up as shown below:
  14. Select the connection type as SAP BW since we would be connecting to S/4HANA. Select the connection name which bring up the authentication screen and once authenticated, select the datasource as shown. Now that the cds view we created has been successfully published as an OData service, it can be consumed from SAC and will show up within the list of analytical datasources as shown in the figure below:
  15. This OData analytical query can now be consumed in a model. The model can subsequently be consumed in a story.

OData provides an easy to integrate interface to bring in data from S/4HANA to the powerful data analysis features of SAP Analytics Cloud. However, exposing the CDS views for consumption consists of multiple steps which need to be followed diligently. Once the integration steps have been completed, the exposed OData can be consumed into models which in turn can be consumed into stories and boardrooms. Following the steps as outlined above ensures that each step is completed and the OData service exposed for further consumption.

Read 16 times

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.