Skip to Content
Technical Articles
Author's profile photo VEERENDRA BAPU KARRI

Bulk MPL Attachment/Multiple Payload Download/Export message processing log with CPI API

Dear Community


Message processing log (MPL) is one of very demanded topics in SAP CPI, MPL is an invaluable source of information for monitoring and troubleshooting, as compared to SAP PIPO retry of a message in CPI is different and limited with JMS Ques or data source. There are many blogs available to retry messages using JMS Ques, sometimes it is required to download hundreds of messages for reprocess.

I would like to share an approach to implement an iflow, which can be used to download multiple messages and resend using postman/or another iflow.

There is a way to export CPI message processing log for failed messages in mass with error details by using SAP CPI API.


Download multiple messages into any local SFTP Directory (connected backend of Cloud Connector) for a particular iflow for a particular period using SAP CPI API Calls.

Refer below link to understand SAP CPI API Calls for different requirements like access message logs, access message attachments etc.,


                                                SAP CPI API

The below are the three important API End points can be utilised together to achieve the requirement.

Iflow Message List Request End Point API: This API End point can be used to get list of messages processed for a particular period.
https://<TENANT URL>/api/v1/MessageProcessingLogs?%24select=IntegrationArtifact%2CStatus%2CLogStart%2CLogEnd&$filter=IntegrationArtifact/Id eq ‘IFLOW_NAME’ and Status eq ‘FAILED’ and  LogStart ge datetime’2023-05-05T09:00:00.000′ and  LogEnd le datetime’2023-05-05T11:00:00.000′


Screenshot of postman call for the above API Call




Iflow Attachment List by Message GUID API Call : this endpoint can be used to get list of attachments for a particular message id.
https://<TENANT URL>/api/v1/MessageProcessingLogs(‘MESSAGE GUID CAN BE GET FROM ABOVE END POINT URL ‘)/Attachments



Iflow Attachment by Attachment GUID API : This end point can be used to get attachment/payload for a particular message guid
https://<TENANT URL>/api/v1/MessageProcessingLogAttachments(‘3838363037306666747…………ATTACHEMNT ID………………. GET FROM MESSAGE GUID URL …………….32393138346232’)/$value

Need to use 3 Request Reply calls to achieve the above in CPI


Design of the Iflow


Below are the design flow steps

  1. First Request Reply to get the list of Messages for a Iflow for particular period (with odata filters can be used in the end point URL to achieve this)
  2. Groovy Script to replace name spaces from xml response of first request reply
  3. import;
    import java.util.HashMap;
    def Message processData(Message message)
        def body=message.getBody(java.lang.String) as String;
        body=body.replace("<feed xmlns=\"\" xmlns:m=\"\" xmlns:d=\"\" xml:base=\"https://<tenant URL>/api/v1/\">","<feed>");
        def messageLog = messageLogFactory.getMessageLog(message);
        if(messageLog != null){
            messageLog.setStringProperty("Logging#1", "1 Iflow Message List")
            messageLog.addAttachmentAsString("1 Iflow Message List:", body, "text/plain");
            //def MessageID = message.getHeaders().get("orderNo");
        return message;
  4. Iterating Splitter to split multiple messages by element <entry>
  5.  Process Call for looping.
  6. Use Content modifier to capture.
    XPATH <id> where end point url of next request reply
  7. Request reply to get list of attachments against above Message ID for the specified Iflow
  8. Again, Groovy Script to replace names space.
  9. Content Modifier to capture xpath id but this time to capture attachment end point URL.
            <id><TENANT>/api/v1/MessageProcessingLogAttachments(‘38383630………message attachment id…………974795f37332f32383762393463342d396339352d343266622d616438332d316530393532393138346232’)</id>
            <title type=”text”>MessageProcessingLogAttachments</title>
  10. Last Request reply to capture the message with the above URL (need to add

Note : The setup can be used for retry mechanism for any iflow.

We just saw how to configure the SAP CPI API calls to get Messages List for an iflow, to get attachments list for a Message ID and to get attachment.

To be very clear: This blog post is specifically about using of SAP CPI API to deal with multiple payloads and another mechanism of retry system.

If you’re interested in learning more about the SAP API Calls, I recommend reading Deepak G Deshpande blog post: SAP Cloud Integration – Step towards Building API Based Integrations

If you’re interested in learning more about the message retry system, I recommend reading Arundathi Sarala blog post :Message retry using Process Direct and Data Store in SAP CPI

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.