Skip to Content
Technical Articles
Author's profile photo Vinayak Gole

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.

Assigned tags

      31 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Reethimanth K
      Reethimanth K

      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

      Author's profile photo Vinayak Gole
      Vinayak Gole
      Blog Post Author

      Hi Reethimanth,

      Sorry for the delay in getting back to you. The free trial has certain limitations and can connect only to local data sources as per information you can find here:

      https://www.sapanalytics.cloud/quick_answers/free-trial/

      As a workaround, you might be able to import your data to excel and then build your models

      Thanks and best regards

      Vinayak

      Author's profile photo Prakash Waddar
      Prakash Waddar

      Hi Reethimanth,

      Create Live Connection between  SAC and S/4 hana system,then you can see the SAP B/W  option  in the dropdown. Please  find  the below link to connect SAC  to  S/4 Hana  System.

      SAC Data connection s/4HANA cloud and other connections.

      https://www.sapanalytics.cloud/guided_playlists/connect-sap-s4hana/

      Author's profile photo Miquel Fornieles Moreno
      Miquel Fornieles Moreno

      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

      Author's profile photo Vinayak Gole
      Vinayak Gole
      Blog Post Author

      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

      Author's profile photo Miquel Fornieles Moreno
      Miquel Fornieles Moreno

      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.

       

       

       

      Author's profile photo Christian Winheller
      Christian Winheller

      Hi Miquel,

      I think you got it right except for having mixed the bullet points 😉

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

      However, for import you could also search for the service name or specific entities published under the service. There is also often not only a C_* but also I_*. E.g. there may be services published providing access to I_Material.

      Author's profile photo Prateek Jain
      Prateek Jain

      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

      Author's profile photo Vinayak Gole
      Vinayak Gole
      Blog Post Author

      Hi Prateek,

      For the cloud you can use communication arrangement. The same has been detailed here.

      https://blogs.sap.com/2018/04/20/sap-s4hana-cloud-integration-sap-analytics-cloud/

      Author's profile photo sudheer keerthipati
      sudheer keerthipati

      Nice blog.Helpful.

       

      Thanks,

      Sudheer

      Author's profile photo Marcelo Berger
      Marcelo Berger

      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

      Author's profile photo Vinayak Gole
      Vinayak Gole
      Blog Post Author

      Thank you Marcelo.

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

       

      Best regards,

      Vinayak

      Author's profile photo Mustafa Bensan
      Mustafa Bensan

      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.

      Author's profile photo Haitao Du
      Haitao Du

      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

      Author's profile photo Haitao Du
      Haitao Du

      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.

      Author's profile photo Tinus Marais
      Tinus Marais

      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

      Author's profile photo Thomas Karner
      Thomas Karner

      Tinus Marais Could you achieve to consume a custom CDS view via Import conneciton in SAC?

      Author's profile photo Thomas Karner
      Thomas Karner

      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.

      Author's profile photo Tinus Marais
      Tinus Marais

      Thomas Karner Yes you are correct. I also followed same procedure for the SAP CDS views using the GUI transaction to add the service for the view, and afterwards it was available in SAC as Data Import.

      Regards

      Author's profile photo Vinayak Gole
      Vinayak Gole
      Blog Post Author

      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

      Author's profile photo Ashok Babu Kumili
      Ashok Babu Kumili

      Great supportive document. Highly appreciated?

      Author's profile photo Goutam Khandelwal
      Goutam Khandelwal

      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

      Author's profile photo Christian Winheller
      Christian Winheller

      Regarding the question "Are there other ways to consume CDS views from S4 system, if I can make a direct live connection?" -> As to my experience: No. Everything else would require publishing the CDS as an OData Service (Which is quiet easy. For consumption however a Cloud Connector would need to be configured).

      Author's profile photo Ashok Kumar
      Ashok Kumar

      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?

      Author's profile photo John Leggio
      John Leggio

      See this for HANA Live:

      https://help.sap.com/viewer/00f68c2e08b941f081002fd3691d86a7/release/en-US/6ac0d03d53f3454f83d41c6f51c2fc31.html

      And this for BW Live:

      https://help.sap.com/viewer/00f68c2e08b941f081002fd3691d86a7/release/en-US/c464e6c7f3a5460292217f9d738512dd.html

      https://launchpad.support.sap.com/#/notes/2788384

       

      Author's profile photo raja sekhar katuri
      raja sekhar katuri

      The note '2977560 - Integrated Financial Planning for SAP S/4HANA with SAP Analytics Cloud' provides the list of OData services for master data and transaction data that can be used in SAC for integrating the data from S/4 HANA.

      It would be great if someone could please share the pros and cons of directly consuming the CDS view using the 2C* objects in comparison to using OData.

       

      Document link in the sap note,

      https://dam.sap.com/mac/preview/xXnXxZ.htm

      Regards,

      Raj.

      Author's profile photo Abhimanyu Sharma
      Abhimanyu Sharma

      why do we need to add annotations @OData.publish:true in live connection to consume CDS view. As per my understanding it would be required if we want to expose the CDS view for Fiori or if we have import connection with SAP /Non SAP systems.

      @Analytics.query:true should be enough to expose it for SAC. isn't it the case ?

      Author's profile photo Suraj Kumar
      Suraj Kumar

      Hello,

      I am working with LIVE connection and S/4HANA premise.t I don't see my CDS View in SAC. When I create the model I select SAP BW system but my CDS View doesn't appear in the list.

       

      I added @Analytics.query:true in my custom CDS View

      Could you help me? Thanks in advance.

      Regards,

       

      Suraj Kumar

      Author's profile photo Christian Winheller
      Christian Winheller

      Suraj Kumar, did you look for the generated "2C*" name or the CDS view name? Please see above comments for a clarification on the right names.

      I also sometimes experience the need to close some dialogs in SAC or clean the whole browser cache in order to force SAC to reload the right information from SAP.   E.g. if you had the CDS selection dialog open and publish the view in the meantime, the Dialog won't notice. Cancel the action completely and restart - you may see your CDS then.

      Author's profile photo Henry Banks
      Henry Banks

      Hi Suraj Kumar 

      how about if in SAC you create Connection > Live > S/4HANA ? ('Direct' in case of CORS, 'Tunnel' in case of Cloud Connector)

      i realize this blog discusses using BW connection type, but it my opinion it ought to be S/4 (whilst technically probably the same under the covers)

      Regards, H

      Author's profile photo Christian Winheller
      Christian Winheller

      Abhimanyu Sharma As some comments above also state this you can see you got it right.