Hi Community,
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.
Introduction:
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.
https://extensibilityexplorer.cfapps.eu10.hana.ondemand.com/ExtensibilityExplorer/
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.
https://api.sap.com/package/CloudIntegrationAPI?section=Artifacts
https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/a617d6f37ddc43db8eeb1279662...
CPI provides an API for getting the deployed integration scenarios. Below is the endpoint for the API.
https://<cpihost>/api/v1/IntegrationRuntimeArtifacts
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
https://<cpihost>/api/v1/MessageProcessingLogs/$count
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
https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/00823f91779d4d42aa29a498e05...
https://help.sap.com/doc/2324e9c3b28748a4ae2ad08166d77675/1.0/en-US/js-index.html
The final monitoring overview page looks like below with message monitoring overview for different time ranges.



Conclusion:
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…
References:
API business hub:
https://api.sap.com/package/CloudIntegrationAPI?section=Artifacts
Side by side extensibility:
https://extensibilityexplorer.cfapps.eu10.hana.ondemand.com/ExtensibilityExplorer/
SAP CPI API help:
https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/a617d6f37ddc43db8eeb1279662...
SAP cloud application programming model (CAPM)
https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/00823f91779d4d42aa29a498e05...
SAP cloud SDK
https://help.sap.com/doc/2324e9c3b28748a4ae2ad08166d77675/1.0/en-US/js-index.html