CPI Extensibility – Message Monitor Overview
I hope everyone are safe and doing good during these challenging times. I am Venu Ravipati. I am a SAP integration consultant working on SAP technologies like SAP XI, SAP PI/PO, CPI, S/4HANA, SAP BTP.
CPI is the best in class integration software as a service to integrate any SAP, non-SAP, on-premise and cloud applications with vast integration content and capabilities. While CPI provides rich functionality out of the box, if there are use cases where we need to build custom solutions for CPI, this blog explains the concepts of CPI extensibility using APIs. In this blog i am going to provide details of one of the CPI extensibility use case. Integration consultants who worked on SAP PI/PO, know the message monitor overview page of SAP PO which provides overview of the number of successful, error and scheduled messages in different time frames like hourly, daily, weekly etc. Let us see how we can leverage APIs of CPI to build similar monitor overview page for CPI. So let’s get started.
Side by side extensibility is one of the extensibility patterns to extend S/4HANA applications using SCP. The side by side approach helps to develop extensions to standard applications without making any change to the standard application. This is possible using the white listed APIs from api business hub. The same side by side extensibility approach can be used to implement CPI extensions as well. The implementation of side by side extension needs knowledge of SCP services and cloud native development using SAP cloud application programming model and SAP Cloud SDK. More information on side by side extensibility can be found in below documentation.
CPI APIs are available and can be used to access the data of CPI tenant like Integration scenarios, message processing logs etc. The list of all CPI APIs and documentation is available in SAP api business hub and SAP help portal below.
CPI provides an API for getting the deployed integration scenarios. Below is the endpoint for the API.
More details on the API parameters and and response data structure can be found in SAP api business hub.
API is available for getting message processing logs of CPI. For an integration scenario, the count of all messages of different processing status (i.e. COMPLETED, FAILED, RETRY) can be obtained from the API as below
For Example, the API call for getting count of messages for a day will look like below
https://<cpihost>/api/v1/MessageProcessingLogs/$count?$filter=Status eq ‘COMPLETED’ and IntegrationFlowName eq ‘<ScenarioName>’ and LogStart gt datetime’2020-06-20T00:00:00′ and LogEnd lt datetime’2020-06-20T23:59:59′
https://<cpihost>/api/v1/MessageProcessingLogs/$count?$filter=Status eq ‘FAILED’ and IntegrationFlowName eq ‘<ScenarioName>’ and LogStart gt datetime’2020-06-20T00:00:00′ and LogEnd lt datetime’2020-06-20T23:59:59′
https://<cpihost>/api/v1/MessageProcessingLogs/$count?$filter=Status eq ‘RETRY’ and IntegrationFlowName eq ‘<ScenarioName>’ and LogStart gt datetime’2020-06-20T00:00:00′ and LogEnd lt datetime’2020-06-20T23:59:59′.
We can run tests on the API data using SAP api business hub or using a rest client like postman. Testing CPI APIs is very simple and only needs a CPI user with administrator access.
Using these APIs, the side by side extension is built on SCP CF environment using SAP cloud application programming model and SAP cloud SDK. There is great content and sample applications in the community on these areas. Below is the SAP help documentation
The final monitoring overview page looks like below with message monitoring overview for different time ranges.
I hope this blog left you with an understanding of CPI extensions using APIs. We can use the APIs standalone in postman to answer different questions easily like for example, 1. Which integration scenarios have most traffic in in last 2 days and how many messages?. 2 . What are the total number of integration errors in this week?. If an extensibility use case exists, a side by side extension can be built on SCP. Please share your valuable comments and feedback. If i error anywhere, please correct me ?. If you are interested in this topic, stay tuned for more blogs in this area.
I finally want to thank all the community and members Vadim Klimov, Eng Swee Yeoh, Raffael Herrmann, Wouter Lemaire, DJ Adams, Marius Obert, Thomas Jung, Appala Naidu Uppada, Mandy Krimmel, Sriprasad Shivaram Bhat, Fatih Pense, Ariel Bravo Ayala and many others whose blogs, answers and insights helped and inspired me.
Thank you all and have a wonderful day…
API business hub:
Side by side extensibility:
SAP CPI API help:
SAP cloud application programming model (CAPM)
SAP cloud SDK