Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Hi Community,

I am Ravindra Singh Rathore. This is my first blog post, and we will discuss about cloud integration monitoring and accessing the MPL Logs through OData API called “Message Processing Log” to create a failed message report.

Problem Statement:

SAP CI(aka. CPI) have functionality to see the failed messages in monitoring page but there is no functionality to create a failed message report. This blog helps you to understand and provides the details about how to fetch the last 6-hour, last two days, last week and last thirty days report in SAP CI.

Using the MPL log API we can retrieve the MPL log with error details of failed messages.


  1. Which integration scenarios have failed in the required timeline and how many messages?

  2. What are the total number of integration errors in the required timeline?

  3. What are the total number of successful messages?

  4. Reduce the intermediate work between client and the integration team as the report mail can be send directly to the client.

Let's see all steps of iFlow.

Set a timer to run the iflow according to the requirement and create properties to capture datetime for automatic run.

Groovy Script: Create filter queries based on message status, start date, and end date. Get the start and end date values ​​from the content modifier.

Query = "LogStart gt datetime'"+LastRun+"' and LogEnd le datetime'"+CurrentDate+"'and (Status eq 'COMPLETED' or Status eq 'FAILED')"

Request-Reply: Follow the below configuration to fetch the MPL logs from the MessageProcessingLogs API using OData V2 adapter.

Address: https://<<TenentURL>>/odata/api/v1
Resource Path: MessageProcessingLogs

Mapping: Use mapping to calculate the number of failed and successful messages and the percentage of variable fields and filtered the "failed" records in mapping to get the corresponding error messages in the next step.

Count and percentage logic:

Custom function used in above logic to store the failed, successful message count and percentages in properties. Please find code below.

Logic to filter the Failed messages.

Iterating splitter: Split the failed message and send it to the local process call to get the error details.

XPath Expression: //MessageProcessingLog

**Local integration steps**
Filter: Filter the payload header details from payload.

XPath Expression: //MessageProcessingLog

Content Modifier: Save the payload and message ID in properties to use in the next step.

Request -Reply: To get the error information of the corresponding message ID via the HTTP adapter, follow the settings below.

Method: GET
Credential: Alias name from Security Material

Content Modifier: Store the error value in a property to use it in mapping and modifying the message body with the actual payload stored in the previous content modifier.

Note: Error values can contain XML tags. Therefore, when saving it as a property, enclose it in double quotation marks.

Mapping: A mapping to retrieve the error message that stored in the property and map it to the target error field along with the corresponding actual payload field

**Local integration Ended**

Gather: Collect all messages from the previous step.

Groovy: Create groovy to remove the multimap tag from the payload if needed.

XSLT Mapping: Create an HTML table of failed messages using an XSLT mapping.

XSLT Mapping:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:template match="/">
<table border="1" style="width: 100%; border-collapse: collapse;">
<tr bgcolor="#add8e6">
<th style="text-align:left">Iflow</th>
<th style="text-align:left">MessageId</th>
<th style="text-align:left">Status</th>
<th style="text-align:left">Error</th>
<xsl:for-each select="/MessageProcessingLogs/MessageProcessingLog">
<td><xsl:value-of select="IntegrationFlowName"/></td>
<td><xsl:value-of select="MessageGuid"/></td>
<td><xsl:value-of select="Status"/></td>
<td><xsl:value-of select="Error"/></td>

Content Modifier: Create a custom HTML email template in the message body of content modifier.

HTML: Sample Code for the Customized Email Template
<table border="0" style="width: 100%;background-color: #EDF4F4; border-collapse: collapse;">
<tr style="height: 20px;">
<td align="left" style="padding: 0;">
<table border="0" style="border-collapse: collapse; width: 100%;">
<td align="center" style="padding:10px 0 10px 0;background:#EDF4F4;">
<div style="height:166px; width:100%; background:#019CE0;font: bold 140px 'Trebuchet MS'; color:white;letter-spacing: -10px ">SCPI</div> </td></table><br>
<style="color:#000000;font-size:15px">Hello Team,</i></br><p/>
<style="color:#000000;font-size:15px">Please find below monitoring details for time period:${property.LastRun} to ${property.Currentdate}</br>

<h1>Message Monitoring Report</h1>
<table border="1" style="height: 40px; width: 101.191%; border-collapse: collapse;">
<tr style="height: 10px;">
<td style="width: ${property.Failed_percentage}%; text-align: center; height: 20px;background-color: #ff0000; color: white;">${property.Failed}</td>
<td style="width: ${property.Completed_percentage}%; text-align: center; height: 20px;background-color: #008000; color: white;">${property.Completed}</td>
<table border="1" style="height: 40px; width: 101.191%; border-collapse: collapse;border-color: #EDF4F4;">
<tr style="height: 10px;">
<td style="width: 50%; height: 20px;text-align: Left; border-color: #EDF4F4;">Failed:${property.Failed}</td>
<td style="width: 50%; height: 20px;text-align: center; border-color: #EDF4F4;">Successful:${property.Completed}&nbsp; &nbsp;</td>
<style="color:#000000;font-size:15px">Failed Message Details:</br>
<style="color:#000000;font-size:15px">Please check the failed message and contact to corresponding Team if you need assistance.
<style="color:#000000;font-size:16px;font-family:Arial,sans-serif;">Thanks & Regards,
<style="color:#000000;font-size:16px;font-family:Arial,sans-serif;">SAP CPI</br>
<table border="1" style="border-collapse: collapse; width: 100%;">
<td <td style="font-size: 12px; line-height: 34px;margin:0; font-family: Arial,sans-serif; background-color: #b2babb; color: white;">&reg; Company</td></td></table></td>

Write variable: Save run date and run time for next run.

Mail adapter: After sending an email to the customer's email address, you will receive a message report with the error reason of failed message.

The following email with a table of error messages and the number of failed and successful messages, color coded by percentage will be received as below.

Note: The output message from Gather step can be converted into a CSV file and send it as an email attachment.

Conclusion: This is one of the way to generate report for failed messages with error reason for your Cloud Integration.
If you have any suggestions, or questions, please feel free to contact me in the comments.


Reference: 1.

Labels in this area