EDUCAÇÃO E TECNOLOGIA

Access SAP Cloud ALM analytics from SAP Analytics Cloud

SAP Cloud ALM, the SAP Application Lifecycle Management platform for cloud-centric customers was launched in May 2020. Since then, additional services and features are added regularly. In the area of APIs, the SAP Cloud ALM Analytics API is live for customers and partners since September 2021. The documentation and sandbox for this API are available from the SAP API Business Hub.

SAP Cloud ALM offer two flavours of analytics interface: REST and REST/OData. While those two types of interfaces accept different syntax, they provide you access to the exact same data with the same set of dimensions, measures and attributes.

Interface Type Description
DataSet REST/OData Provide access to all analytics data and metadata (dimensions, measures, attributes)
Provider List REST Returns the list of data providers available
Provider Filters REST Returns the dimensions, measures, and attributes of a data provider
Provider Data REST Provide access to all analytics data

SAP%20Cloud%20ALM%20Analytics%20interfaces

In this blog I’d like to demonstrate with a basic example how we can interface SAP Analytics Cloud with SAP Cloud ALM using the OData interface: we’ll see how to display the catalog of CALM Analytics data providers in SAP Analytics Cloud.

As a prerequisite you’ll need:

  • SAP Cloud ALM tenant
  • SAP Analytics Cloud tenant

For those who don’t have access to a SAP Analytics Cloud tenant, you can check the OData syntax here.

Get your SAP Cloud ALM OAuth credentials

SAP Cloud ALM public APIs are protected with OAuth 2.0 Client Credentials grant flow.

We need an OAuth key to access the SAP Cloud ALM tenant; This is done from SAP BTP cockpit, within a Cloud Foundry space.

There, we create a new instance of service “SAP Cloud ALM API”.

This service instance will hold the key and the needed authorisations. This at service instance creation time that we provide the authorisation scopes.

Caution: the scopes are passed at service instance creation time and not at key creation time.

In this example, we need the following two scopes:

  • calm-api.analytics.read: to access SAP Cloud ALM Analytics API
  • calm-api.analytics.providers.read: to access the catalog data provider
{    "xs-security": {        "xsappname": "CALMExtensionAPI",        "authorities": [            "$XSMASTERAPPNAME.calm-api.analytics.read",            "$XSMASTERAPPNAME.calm-api.analytics.providers.read",        ]    }
}

From the service instance we can create a key. When creating the key, we can leave the JSON parameters section blank. The key will inherit from the service instance scopes.

This is from the key we retrieve the OAuth 2 parameters will need in the following steps:

  • clientid
  • clientsecret
  • url

Create SAP Cloud ALM Analytics API connection to your tenant

In SAP Analytics Cloud we need an OData Services connection.

We enter the following parameters:

  • Data Service URL (assuming your tenant is on European region eu10): https://eu10.alm.cloud.sap/api/calm-analytics/v1/odata/analytics/
  • Authentication Type: OAuth 2.0 Client Credential
  • OAuth Client Id: clientid retrieved from the key (see above)
  • Secret: clientsecret retrieved from the key (see above)
  • Token URL: url retrieved from the key (see above) concatenated with path “/oauth/token”. It could look like: https://<subdomain>.authentication.<region>.hana.ondemand.com/oauth/token
  • Scope: leave this blank

We can re-use this connection for all models accessing the data of this SAP Cloud ALM tenant.

Create SAP Cloud ALM Catalog Model

We build the model from an OData data source and select the CALM connection we created previously.

We give a name to the query and select the entity DataSet in the list. Then we go to the next step.

We can select one by one (by double click or drag & drop) the dimensions and measures we want to include in the model, but by double clicking on DataSet we include all dimensions and measures available. The OData interface offers a set of predefined dimensions (provider, version, period…), 20 generic dimensions (d1k/d1V, d2k/d2v…d20k/d20v) and 10 generic measures (m1k/m1v, m2k/m2v… m10k/m10v).

Generic names ending with letter “k” contain the key of a dimension or measure, while generic names ending with letter “v” contain the value of a dimension or measure.

Depending on the data provider, only a subset of generic dimensions and measures might be used.

More information on the interface and on the predefined dimensions is available here.

In our case, we just need to set as filter the technical name of the data provider: (provider = PROVIDERS_LIST). This is the Catalog data provider (also known as Discovery data provider) that returns information about all data providers available in CALM.

Caution: when accessing OData interface, it’s mandatory to select at least one data provider in the filters.

Then we create the model.

SAP Analytics Cloud preloads some draft data. We select this draft to finalize the model.

Most of dimensions are empty or useless in this case. We can keep the following generic dimensions in the model to build the story:

  • d2v: name of the data provider
  • d3v: description of the data provider
  • d4v: version of the data provider

Then we finalize the model creation.

Build SAP Cloud ALM Catalog Story

Build a simple story from the previous model is a no-brainer with SAP Analytics Cloud.