Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Matthew_Shaw
Product and Topic Expert
Product and Topic Expert
I've written a bunch of Sample Scripts, in Postman, that demonstrate how the 'export data' API retrieves data from models stored inside SAP Analytics Cloud. These samples are now available.

This blog first takes a step back and provides an overview of other means and ways to extract data before then introducing the sample scripts themselves. If you are thinking of using the export data API, then these samples and the associated User Guide can remove some barriers to adopting the API since much of the code and logic can easily be re-used and they provide a useful insight into how the API works and behaves.

A number of, currently undocumented but supported features, also form part of these samples. It means the samples and this associated User Guide provide a practical starting point to ensure your coding project gets off to the best start possible.

Overview


SAP Analytics Cloud is often chosen as an enterprise planning solution. The planning data, held in SAP Analytics Cloud, occasionally needs to be further integrated with other systems to complete the business planning process in some way or another. This new ‘export data’ API provides another option to the many already existing options that are described now.

There are many means and ways to export data from SAP Analytics Cloud to other systems and these include using the:

A new method is available with SAP Analytics Cloud Q2 2022 Quarterly Release called the ‘export data’ API. This is an extension to the OData standard and allows the retrieval of all the data from acquired models (both analytic and planning models) on a ‘pull’ basis, unlike the above methods which operate on a ‘push’ basis. The official documentation describes it as

… a PULL based API data extraction API that helps with data integration from SAP Analytics Cloud to SAP Data Warehouse Cloud, SAP BW, SAP HANA, and other third-party tools. The API doesn't have a dedicated user-interface, and simply extracts data and information about providers.

Sample Scripts


These sample scripts, written in Postman, demonstrate each of the API endpoints. The samples are provided on an ‘as is’ basis and they only retrieve data from SAP Analytics Cloud models, they don’t do anything with the data once it’s been retrieved. Though some of the samples write the data to the console, that’s it. It means these samples are just to demonstrate the API endpoints along with many aspects such as how:

  • sessions and errors can be managed

  • ‘pages’ of data can be retrieved when multiple pages are available (the samples automatically fetch all the pages of data)

  • optional request parameters can be used


If you’re using an SAP connector then there’s no code to develop, it’s just plug-and-play:















Target system that will pull data from SAC: Related article:
Data Warehouse Cloud and Data Intelligence blog
SAP HANA, SAP BW on HANA, SAP BW/4HANA blog

However, if you are using your own custom application then you will need to write code.







Postman, which is freely available, is a commonly used tool for implementing API workflows. Postman provides a good basis to demonstrate how requests are made to the API, and optionally export code snippets in various languages, such as Java, Python, C, PHP, Node.js and many others. This means development time can be reduced, but nevertheless, you will need to adapt the scripts for your own use, either to process the data or upload it to a target data source for further processing.

The list of the samples I've provided are:

  • Export Data 761-Test-Environment Setup

  • Export Data 762-Metadata

  • Export Data 763-Namespaces (sets Environment ExportData_NamespaceID)

  • Export Data 764-Namespaces ID

  • Export Data 765-Namespaces ID Provider

  • Export Data 766-Fcj-Provider Metadata

  • Export Data 767-Fcj-Service Document

  • Export Data 768-Fcj-Fact Data

  • Export Data 769-Fcj-Master Data

  • Export Data 770-Fcj-Audit Data

  • Export Data 771-Fcj-Dimension Master Data


Resources













SAP Analytics Cloud Export Data API Sample Scripts User Guide Version 0.7.1 - August 2022
.pdf Download
.pdf Preview
Samples (the code) Version 0.7.1 – August 2022
GitHub (zip downloadChange log

Frequently Asked Questions


Q1: When retrieving a dimension the columns 'read' and 'write' (that are used by SAP Analytics Cloud for Data Access Controls) are not returned, why is this?

A1: Data Access Controls and Data Locks are not part of the master data but an extension to the dimension metadata for use only by SAP Analytics Cloud, they have a dependency on them. They are not available for data retrieval and they don't form part of the API. There are no plans to change this.

 

Q2: When retrieving a dimension the column 'parent' (that is used by SAP Analytics Cloud for hierarchical data structures) is not returned, why is this?

A2: The hierarchy is part of an internal hierarchy extension and doesn't form part of the data retrieval and they don't form part of the API. There are no plans to change this.

 

Q3: Calculated measures are not retrieved, why is this?

A3: The API is for data retrieval only and a calculated measure is out of scope for this reason (the API is only for data retrieval not for any form of 'query' aspect). They are not available for data retrieval and they don't form part of the API. There are no plans to change this. As a workaround, these measures could be materialised via a data action making them then retrievable.

 

Q4: Is Public Dimension Master Data accessible using this Export Data API?

A4: No. Dimensions in the model are accessible, however, public dimension Master Data is not available. Please see Influence Request 264969

 

Q5: Are custom properties of a dimension accessible using this Export Data API?

A5: Whilst hierarchical data is not available, generic (also known as custom) properties are accessible via the API

 

Q6: A planning model contains group currency values, does the Export Data API enable these values to be exported?

A6: No. The group currency values are not materialized or persisted and they are not available via the Export Data API. The data export API provides only data from base measures but not from calculated measures or conversion measures. However, if you really want to export converted currency values then you can create a second model that contains all necessary (calculated or conversion) measures as base measures. Then, create a cross-model copy between the original model and the new model. You need to map the calculated measures and the conversion measures to the corresponding base measures in the target model. Once the cross-model copy is executed, the calculations are performed and stored (materialized) in the target model. You can now export via Data Export Service from this second model. To be sure the calculations are up to date, you would have to run the copy any time before you export data from the second model.

 

Feedback


I’ve invested a great deal of time and effort into these materials so your feedback is very welcome and will help judge if I should continue to create these kinds of resources

Please do:

  • Comment if you use these resources in any way (or if you’re shy, just hit the like button!)

  • Share which sample scripts you’ve used. Other customers would love to hear if you’ve used the scripts. It will give them a sense of how reliable they are! 😉

  • Share your experience

  • Share how much time you saved because of these resources, would you have been as successful without them?


Before posting any questions please:

  • Do read the contents of the User Guide. I appreciate you may not have the time to read it all. If you’re looking for a quick answer and don’t have the time, feel free to post a question to the community rather than here, it will help keep the number of questions here reduced and it will help others find answers easier (than searching this blogs’ Q and A). You can always ‘@tag’ me in your post so I get a notification, and you can always post a link to your question from a comment to this blog if you think that might help others.

  • If you’ve got a question about the API in general, then post a question to the community rather than here


Feel free to follow this blog post for updates. I’ll update the version numbers in this blog post when there’s one to update.

Many thanks

Matthew Shaw @MattShaw_on_BI

matthew.shaw/#content:blogposts

 

Other related articles


https://blogs.sap.com/tag/sap-analytics-cloud-data-export-service/

Data Export API: A tour of the API by david.stocker provides an overview of each endpoint and how to integrate this with Python.

 
11 Comments