How to search for messages in SAP CPI
Update: If you want to learn more about all you can monitor then check out the blog I have written about SAP CPI Monitoring.
We have a flow that spans our SAP PI/PO system and the SAP CPI(HCI) tenant. It would be really useful for users to be able to track how the messages are being processed. It would be nice if we could search on the business document or other values just as in SAP PI. That is not possible yet, but maybe sometime in the future.
So I have found two ways that make the tracking easier. There are the following fields that
This is a unique name for each subprocess that is called. It seems like it is generated automatically. So a search for this will always return one process. It seems like it is not possible to set this, and probably not something you want.
The correlation id is a bit more interesting to monitor processes. In this example, we have a process that spans two CPI processes using the process direct adapter. When we search for the Correlation ID we can see both processes that it is used for.
It would make sense to be able to set this correlation id to be the PI message ID, that way it is a lot easier to find which CPI process was started by which PI message. So you can just search on the PI Message GUID.
We simply just need to set the header SAP_MplCorrelationId in the HTTP call to the SAP PI message ID, and then we can search for the value in our CPI system.
As we can see on this message we set the payload, this time just using postman, but there are different ways to set the header in PI. Then we can see the same correlation ID in the CPI and search for the value. I can send the same message multiple times with the same correlation id it will just be added to the list.
In my scenario, I'm using the SOAP adapter and here XHeader1 value that get the name SAP_MplCorrelationId and then I set the dynamic property to that value.
Application Message ID
This is where you can put the content of your payload. So you can put in your invoice number. In my case, I want to set them as part of the payload that I can get with some Xpaths and an expression. You just need to send the header value for SAP_ApplicationID and you are able to search for the value
It is unfortunately not possible to search for part of the name or using % or *, but maybe that will change someday.
Sender and Reciever names
One of the cool things about this is that I also get to learn something. So, Marco Verhoef, that I did a podcast about their implementation on CPI had some extra way to log information. It is also possible to use the sender and receiver to save extra information on the processing. That way you can specify what was done with the message, so it is possible to see where the message was sent.
To do this in runtime you need to delete the sender/receivers and then create them assign values to them.
You can also set them in as an HTTP header in your calls SAP_Sender, that will also overwrite the configured values.
I'm not sure if this is a good use supported use of the messages or not. And it seems not ot be searchable.
SAP CPI error handling application
At figaf we have been working on making it easier to handle and troubleshoot your SAP PI and CPI applications we have now also improved the funcitonlity of the support function so you can see payload of all failed messages. See how fast it is possible to handle and process SAP CPI alerts or errors in the screen.
If this has helped your project please help share this blog on linked or twitter.
Leave a commentPlease log in or register to post a comment