Sustainability Blogs
Delve into SAP sustainability blogs. Gain insights into tech-driven sustainable practices and contribute to a greener future for businesses and the planet.
cancel
Showing results for 
Search instead for 
Did you mean: 
pedrofreitas
Product and Topic Expert
Product and Topic Expert
2,696

There is a way to integrate SAP Analytics Cloud with SAP Sustainability Control Tower for real-time data access and dynamic visualization by establishing a live connection. This currently only supports greenhouse gas (GHG) emissions data. For more information on how to do that, you can have a look at the SAP Help for SAP Sustainability Control Tower Integrations here: SAP Analytics Cloud Integration

In addition to that, SAP Sustainability Control Tower offers APIs as another way to replicate data from your source systems into SAP Sustainability Control Tower, or to replicate data from SAP Sustainability Control Tower to your systems.

The main focus of this blog, is to help anyone out there who is looking to connect SAP Sustainability Control Tower to SAP Analytics Cloud via APIs for data replication.

Let's do this! ...in 3 parts:

  1. Setting up is needed in your Subaccount in the SAP BTP Cockpit
  2. Testing of the API can be done in the SAP Business Accelerator Hub
  3. Configuring the connection in SAP Analytics Cloud

 

Setting up what is needed in your Subaccount in the SAP BTP Cockpit

First, you need to go into your SAP BTP Cockpit and find the Subaccount you have set up for using SAP Sustainability Control Tower.

Check there to see if you have already enabled Cloud Foundry.

If not, you'll see a button to Enable Cloud Foundry:

pedrofreitas_7-1718732202846.png

When you click to Enable Cloud Foundry, a popup will come up, and you'll just have to click on Create:

pedrofreitas_8-1718732363053.png

After that is done, you'll need to create a Space. To do that, click on Create Space:

pedrofreitas_9-1718732757690.png

In the popup that will come up, give it a Space Name and click to Create:

pedrofreitas_11-1718732892538.png

Next, click on Entitlements on the menu in the left side of your screen.

Check in that list for the SAP Sustainability Control Tower service and verify if you already have the service sct-service-api with the standard plan listed there:

 

pedrofreitas_3-1718731646079.png

If it's there, you can skip this next step. 

If it's not there, proceed to add this by clicking on Edit on the top right side of your screen. That will enable a new button to Add Service Plans. Click to Add Service Plans, and you'll get the popup below:

pedrofreitas_2-1718731498943.png

Type in "control" in the search box, which will result in finding the service SAP Sustainability Control Tower.

Click on SAP Sustainability Control Tower, and that will display the Available Plans on the right.

Click to check the checkbox for standard - SAP Sustainability Control Tower service broker (API).

Click on the right bottom corner to Add 1 Service Plan.

When back in the Entitlements list, click on the top right of your screen to Save.

Now, you should be able to find the service in the list:

 

pedrofreitas_3-1718731646079.png

Next, click on Instances and Subscriptions on the left menu:

pedrofreitas_5-1718731985811.png

On the top right corner, you'll find the button to Create, click on that button.

In the dropdown to Select service, find SAP Sustainability Control Tower sct-service-api:

pedrofreitas_12-1718733058906.png

In the dropdown to select a Plan, select standard under Instances:

pedrofreitas_13-1718733126483.png

Give it an Instance Name, and click on Create:

pedrofreitas_14-1718733185537.png

You should now be seeing 1 Instance and 1 Environment together with your 1 Subscription in the Instances and Subscriptions screen:

pedrofreitas_15-1718733330639.png

Next, click on the Instance, to see its details:

pedrofreitas_16-1718733495585.png

Click on the Create button to create a Service Key.

In the popup, give it a Service Key Name and click to Create:

pedrofreitas_17-1718733586551.png

This is the end of the steps in the SAP BTP Cockpit, but don't close it just yet, as we'll need to come back here to check the JSON code of the Service Key for the Cliend ID and Client Secret.

 

Testing of the API in the SAP Business Accelerator Hub

Now, let's go to the SAP Business Accelerator Hub (https://api.sap.com/) to check if this is working!

Search for sustainability control tower:

pedrofreitas_18-1718734125293.png

In the search results, click on the ODATA V4 API Get Sustainability Metrics.

Once in the Get Sustainability Metrics API, click on Try Out:

pedrofreitas_19-1718734225830.png

 

Then, on the left menu, select a metric for which you have data in SAP Sustainability Control Tower.

In this example, I will select Environmental Metrics and then GET /GhgEmissions:

pedrofreitas_28-1718736198879.png

Now, click on Select Environment on the top right corner of your screen and choose to Add New Environment:

pedrofreitas_21-1718734850406.png

In the popup to Configure New Environment.

Give it a Display Name, and then you'll need to fill in Cliend ID and Client Secret:

pedrofreitas_24-1718735244381.png

This is where you need to go back to the SAP BTP Cockpit, and look at the details of the Service Key.

For that, you need to click the name of your Service Key, that is a link that will show you more details:

pedrofreitas_2-1718799312252.png

When you click that name of the Service Key which is a link, a popup will appear with the JSON code and in that code you'll find Client ID and Client Secret in the lines highlighted in green below:

pedrofreitas_22-1718735154368.png

Copy the lines in green, one at a time, to fill in the Client ID and Client Secret in the Configure New Environment popup back in the SAP Business Accelerator Hub to test the API.

Keep the SAP BTP Cockpit open, as we'll need to come back here to get a URL from this same JSON code again when configuring the connection in SAP Analytics Cloud.

Then, fill in the Landscape and Subdomain from your SCT tenant URL:

pedrofreitas_25-1718735466456.png

Last, click the checkbox to Apply and select the Save this environment for future sessions option.

Click to Configure:

pedrofreitas_26-1718735533676.png

When you click on Configure, it may take a while for the screen to react, no need to click on Configure again, just wait a little bit.

To test this, click on the Run button on the top right side of your screen:

pedrofreitas_29-1718736451618.png

You should get something like this:

pedrofreitas_30-1718736535762.png

If you get results like this to show up, this means the connection is working!

Alright, time to go to SAP Analytics Cloud...

 

Configuring the connection in SAP Analytics Cloud

In SAP Analytics Cloud, go to Connections, you can find it on the left menu, almost at the bottom:

pedrofreitas_0-1718737045370.png

Click on the "+" option on the top right corner:

pedrofreitas_1-1718737127347.png

Type "odata" in the search, to find OData Services:

pedrofreitas_0-1718798864630.png

Click on OData Services and the below popup will appear:

pedrofreitas_1-1718798971402.png

 

Start by entering a Connection Name.

To fill in the Data Service URL, you'll need to go back to the SAP BTP Cockpit one last time, and in the JSON code of the Service Key, you'll find a URL which ends with "sustainabilityMetrics":

pedrofreitas_3-1718799646121.png

As Authentication Type, select OAuth 2.0 Client Credentials.

By now, you already know where to find the OAuth Client ID and Secret again, in the JSON of your Service Key in the SAP BTP Cockpit.

For the Token URL, you'll have to go back to the SAP Business Accelerator Hub, search for "control tower", find the ODATA V4 API called Get Sustainability Metrics, go into it and then click to Try Out. Or... you can try this direct link: https://api.sap.com/api/SustainabilityMetrics/tryout

Once you are there, you'll have to click on Select Environment, and next to the name of your Environment, there will be a pencil button you can click to check its details. In that popup you'll find the Token URL:

 

pedrofreitas_4-1718800199796.png

Copy the Token URL and paste it in the New OData Services Connection popup in SAP Analytics Cloud and after that you can click on the Create button.

Now your new Connection should show up in the Connections list in SAP Analytics Cloud.

Next, go to the Modeler, you can find it as a little cube icon on the left menu:

pedrofreitas_5-1718800434137.png

Click on Model, to create a new model, and a popup will appear:

pedrofreitas_6-1718800492761.png

Leave it with Start with Data selected and click Next.

Type in odata, to search for OData Services:

pedrofreitas_7-1718800570798.png

Click on OData Services and then you'll have to select a Connection.

In the dropdown to select a connection, you should find your new connection:

pedrofreitas_8-1718800650225.png

Click Next and then you'll have to set up a New Query for OData Services:

pedrofreitas_9-1718800730282.png

In this example, we're still considering you have data for emissions, so you can search for ghg and select GhgEmissions, for example:

pedrofreitas_10-1718801004976.png

After you click Next, you'll need to select data and filters.

You can drag and drop the GhgEmissions to the Selected Data:

pedrofreitas_11-1718801172231.png

After you click on Next, the below popup will appear with a Batch Size.

You can leave that as is and click to Create:

 

pedrofreitas_12-1718801221962.png

Your new model will show up, and you'll need to click on the disk in the top menu under General, to Save it.

pedrofreitas_13-1718801316102.png

A popup will appear where you can just click Save:

pedrofreitas_14-1718801381162.png

Now you can use the data in SAP Analytics Cloud!!!

Let's give it a quick try... for example, creating a story.

Go to the left menu and click the icon that looks like a chart for Stories:

pedrofreitas_15-1718801509454.png

Next, click on the big button to create a new Canvas.

A popup will appear where you can just click to Create:

pedrofreitas_16-1718801605162.png

Now you can drag and drop a Chart from the left Widgets menu into the main content section of your New Story. When you do that, a popup will appear to Select Dataset or Model:

pedrofreitas_17-1718801772708.png

Click on the name of your model to select it.

Next, on the right menu, you can select Measures and Dimensions:

pedrofreitas_18-1718801911379.png

In this example, let's select for Measures, the measure QUANTITY and for Dimensions, the dimension BUSINESSLOCATIONID.

Finally, you get a Chart in your New Story in SAP Analytics Cloud with your SAP Sustainability Control Tower data!

pedrofreitas_0-1718802485178.png

Top kudoed authors