Skip to Content
Technical Articles

Consume CDS views in SAP Analytics Cloud – Step by step

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.

23 Comments
You must be Logged on to comment or reply to a post.
  • Hi Vinayak,

    I am using the trial version of SAP Analytics Cloud and trying to consume the CDS View by following your blog.

    I have created the CDS View and added to backend service by going to /n/IWFND/MAINT_SERVICE.

    When I am trying to create a Model in trail version, unable to select connection SAP B/W and says need to upgrade.

    Is there any other way to proceed further connection type or solution to accomplish this scenario ?

    Please advise

    Regards,

    Reethimanth

  • Hello,

    I am working with import data connection (acquire data) and S/4HANA premise. I have applied your steps but I don’t see my CDS View in SAC. When I create the model I select S/4HANA system from acquire data but my CDS View doesn’t appear in the list.

    Could you help me? Thanks in advance.

    Regards,

     

    Miquel

    • Hello Miguel,

      Sorry to getting back to you so late.

      Can you please check if you have access to the cds view. The second thing to check would be if the view has been exposed as odata.

      Thanks

      Vinayak

  • Hello Vinayak,

    Thanks for your answer. I am working with S/4HANA on premise and I want to compare live connection vs import connection.

    I had problems finding standard CDS View in the popup:

    After some tests it seems it depends on type of connection:

    • If you are working with live connection you have to use technical name (C_*).
    • If you are working with import connection you have to use corresponding datasource (2C*).

    Could you confirme this?

    Regards,

    Miquel.

     

     

     

  • Hi Vinayak,

     

    excellent blog. I am using S/4HANA Cloud instead and have option of creating custom CDS views via app. Is there a option to activate and set oDATA for consumption in SAC ?

     

    Regards

    Prateek

  • Hi Vinayak,

     

    Although your steps to expose the CDS view using oData via the gateway services are spot on, they are not a requirement to consume a CDS view in SAC using a LIVE connection.

    As long as you have the annotation @analytics.query: true, that will in essence make your CDS View behave like a BEx query, and process it through the OLAP engine, so much so that you can test it in tcode RSRT if you’re using S/4 or BW.

    Whatever semantics you have defined in the Consumption view, and underlying Composite view will be inherited in SAC through that live connection (given whatever limitations S/4, HANA, BW have with the tool).

    Great blog nonetheless on exposing the CDS view as oData.

    Cheers!

    Marcelo

    • Thank you Marcelo.

      I will try to inculcate the steps you have defined and see how it works out.

       

      Best regards,

      Vinayak

      • Hi Vinayak,

        I would like to re-iterate Marcelo Berger‘s point as it is 100% accurate.  As it stands now, this blog post suggests that the SAC Live Connection is consuming CDS views via oData services when in fact this is certainly not the case.  If the intention is to communicate how to consume CDS views via the Live Connection, I suggest you update this post to remove the references and steps related to oData, to avoid any confusion.

        Regards,

        Mustafa.

        • Totally agree, exposed to OData is not a pre-requisite to consume CDS data in SAC, you might have to exposed to OData if you want to consume CDS in Fiori or UI5 apps, actually, when you use 2C* objects to connect CDS in SAC, it is connected to the embedded query (Technically same as BW Bex query) generated by the system as a result of annotation @Analytics.query: true

          • I would like add one more step to make CDS query visible in SAC, API State has to set to Use System-Internally (Contract C1), otherwise it will be available in RSRT, but not in SAC live connection.

  • Good day, thank you Vinayak for the info in this blog.

    This blog is referring to “Custom” CDS viewsused in SAC – but see below scenario/question regarding S4H standard CDS views used in SAC via Live & Data Import connection – which Marcelo Berger & Mustafa Bensan referred as well.

    According to note 2595552 a CDS view with property @Analytics.Query:True can be used in SAC but naming convention in SAC is not the CDS view name but 2C<SQLviewname> of the CDS view.

    So if working with S4H standard CDS views eg. Trial Balance “C_TRIALBALANCE” with SQL name “CFITRIALBALANCE” then the view “2CCFITRIALBALANCE” is available in SAC by using the LIVE Connection. But using the “DATA IMPORT” connection this view or any other are not found / not available. What is the procedure to make them also available for “DATA IMPORT” connection ?

    Regards

    Tinus

      • Found it: I had to use transaction /n/iwfnd/maint_service, search for the service and press “Load Metadata”. After this the custom CDS views appeared for import connection.

    • Hello Tinus,

      I found the answer while trying to activate standard content. You would need to create a connection of the type BW but connecting to S4HANA. That would enable the 2CC queries to be used to consume in import connection. However, I am facing issues while using this method and am following up with SAP.

       

      Regards

      Vinayak

  • Hi Vinayak,

     

    Is it correct that the CDS views are exposed first as BW Transient provider and then consumed by the SAC-BW Live connection?

    Are there other ways to consume CDS views from S4 system, if I can make a direct live connection?

     

    Regards,

    Goutam

  • Using live data connection what are the limitations we face?
    I understand the live data connection we don’t load any data into SAC in such case is it possible to edit data in SAC?