Skip to Content
Technical Articles

SAP Cloud Platform Integration – Number of messages

With the simplification of the pricing of our Integration Suite (see details here) – now based on messages- some customers start asking themselves how many messages actually flow through their Integration service tenant per month.

Indeed, until now the Integration service (aka. CPI) was based on number of connections and bandwidth. If you move to the Integration Suite, it’s good to have an idea of the number of messages flowing through there. Note that not all messages are counted though, for instance not the ones exchanged between 2 SAP applications.

Anyway: in order to do get an overview of the amount of messages, you can use the configurable dashboards or the Integration APIs.

EDIT: if you have an SAP Cloud Analytics access, you can also use the predefined business content for integration in order to get more information about your CPI environment!

Using the dashboards

This one is really simple…: log into your CPI sub-account and navigate to the “Monitoring” section.

Then click on the tile with a “+” and select the right conditions:

Click on “OK” and that’s it:

Through REST APIs

As you certainly know, all integration artefacts are accessible over REST APIs.

These are documented on the API Business Hub. Especially the MessageProcessingLogs is quite interesting.

You can use that API in WebIDE, Excel or any other tool that can talk to REST APIs – or you can use Postman. In our case, we’ll use Postman and its scripting capability.

1- Open your Postman client and create a new GET request. The URL should look something like this:

https://<yourID>-tmn.hci.eu1.hana.ondemand.com/itspaces/odata/api/v1/MessageProcessingLogs

If you are not sure, you can log into the API Business Hub and define your own environment. When testing, you can extract the URL from the CURL command.

2- Now you need to add the right parameters:

$inlinecount=allpages

$format=json

$orderby=LogEnd desc

$top=50

$filter=LogEnd ge datetime’<start date>‘ and LogStart le datetime'<end date>’

Eventually, the full URL looks like this:

https://<yourID>-tmn.hci.eu1.hana.ondemand.com/itspaces/odata/api/v1/MessageProcessingLogs?$inlinecount=allpages&$format=json&$orderby=LogEnd desc&$top=50&$filter=LogEnd ge datetime’<start date>‘ and LogStart le datetime’<end date>

The start date and end date must have the following format:

2020-07-19T08:37:42
3- Now you need to add your Integration service user name and password to be allowed access to the REST API.
Select the “Authorization” tab and chose “Basic Auth”. Enter your credentials, and that’s essentially it.
If you hit “Send” in Postman, you will get a response similar to this one:
{
“d”: {
“__count”: “153“,
“results”: [
{
“__metadata”: {
4- Because dates are changing perpetually, we want to make the Postman call dynamic.
To do so, let’s use the “Pre-request Script” feature. The tab is located under the URL of you request.
Paste the following code in there:
var moment = require('moment')

logStart = moment().toISOString();
logStart = logStart.slice(0,-5);
pm.globals.set("logStart", logStart);

logEnd = moment().subtract(1, 'month').toISOString();
logEnd = logEnd.slice(0,-5);
pm.globals.set("logEnd", logEnd);

This will create variables that you can now use in the parameters.

Now change your parameters to the following:
$inlinecount=allpages&$format=json&$orderby=LogEnd desc&$top=50&$filter=LogEnd ge datetime’{{logEnd}}‘ and LogStart le datetime’{{logStart}}
(to see the actual URL, with calculated dates, click on “Code” in Postman)
Voila! Now you will get the exact number of messages of your integration service tenant for the last month dynamically!
Obviously, this could also be scripted in Google Sheets, Excel, a Java or SAP UI5 application – consolidating all of your sub-account messages in one view – but I hope you got the idea 🙂
1 Comment
You must be Logged on to comment or reply to a post.
  • Hello Sven,

    thank you for this blog!

    Though I have one question, do you plan to put into the CPI a quota for messages per artifact (and certain time), similar like you have for example in SAP API Management ?

    It can very easily happen that DEV CPI tenant used for development/testing is, due to an error in external application, flooded with messages and this “simplification of pricing” can become a big problem.

    Thank you for your answer.

    Marek