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!
cancel
Showing results for 
Search instead for 
Did you mean: 
Daggolu_PremSai
Participant
3,629

Introduction:

Monitoring failed interfaces in SAP Cloud Platform Integration (CPI) can be challenging, especially when dealing with multiple integrations. Manually checking Message Processing Logs (MPL) for errors is time-consuming and inefficient. To streamline this process, we can automate email alerts that notify stakeholders about failed messages in a structured and timely manner.

In this blog, we will walk through the implementation of an iFlow that fetches failed interface details from the Message Processing Logs (OData V2 API), consolidates errors interface-wise, and sends an email alert with relevant details. Additionally, we'll use Value Mapping to dynamically route notifications to the right recipients based on the interface name. This ensures that only relevant stakeholders receive the alerts, enhancing efficiency.

Why Not Real-Time Alerts for Every Failure?

While real-time alerts can be useful for critical interfaces, they can also create excessive noise for non-priority ones. If every failure triggers an email, stakeholders may end up with a flooded inbox, making it difficult to focus on actual issues.

To prevent this, our approach consolidates all errors within a defined time window into a single structured email. This reduces email spam while ensuring visibility into all failures. By scheduling email notifications at regular intervals (e.g., every 30 minutes), we can balance timely alerts with efficient monitoring.

Integration Flow Overview:

Daggolu_PremSai_2-1739709815635.png

Our iFlow will follow these key steps:

  1. Retrieve Failed Messages – Fetch error details from the Message Processing Logs (OData V2 API) for a specified timeframe (e.g., since the last run). Also, Fetch the error message based on message Id using HTTP request.
  2. Filter and Consolidate – Group errors by interface and summarize key details like error message, timestamp, message id, correlation id and link to view in CPI monitor page.
  3. Determine Email Recipients – use value mapping to dynamically assign different recipients based on interface name. If an interface is not found in value mapping, send the alert to the default recipient (defaultToMail prameter). You can add multiple email separated by ,(comma)
    • Daggolu_PremSai_3-1739712020188.png

       

  4. Apply Records Per Email Limit – If an interface has more failures than the configured Records Per Email value, split the records into multiple emails. This prevents excessively long emails.
  5. Format Email Content – Structure the error details into a readable email format.
  6. Send Email Notification – Trigger a single email alert with the consolidated error report instead of multiple real-time alerts.

Download Integration flow and value mapping from the Git : link

  • Download the Email Alert Notifications For SAP CPI.zip  and VM_EmailRecipients_Alerts.zip from the Git.
  • Upload it in CPI
  • Go to configure and update below parameters.

Configure timer based on required frequency (e.g.,  every 30 min)

Daggolu_PremSai_4-1739712334083.png

Receiver Mail:

Credential NameName defined in the Security Material for Mail
FromFrom Mail ID
CCOptional

Daggolu_PremSai_6-1739712782862.png

Receiver CPI_ErrorMessage (HTTP):

AuthenticationBasic / OAuth2 Client Credentials
Credential NameName defined in the Security Material for Mail

Daggolu_PremSai_7-1739713089141.png

Receiver CPI_MessageProcessingLogs (HCIOData):

AuthenticationBasic / OAuth2 Client Credentials
Credential NameName defined in the Security Material for Mail

Daggolu_PremSai_8-1739713244196.png

More All Parameters:

defaultToMailTo Mail (support team mail id)
LastRunDateTime Defaultlast run date time in yyyy-MM-ddTHH:mm:ss.SSS for the first run, later on value will be picked from local variable.
Records Per Emailenter the no. of error records can be sent in single mail.
Tenant URL

URL of CPI tenant by removing https:// <--->.com, refer below screenshot.

Daggolu_PremSai_9-1739713395822.png

Click on save and deploy.

Result:

iFlow successfully processed:

Daggolu_PremSai_10-1739714492628.png

Email triggered with errors:

Daggolu_PremSai_11-1739714742711.png

 

Customization possibilities for the Email Alert iFlow

This iFlow can be further customized based on business requirements to improve monitoring and avoid unnecessary email spam. Some possible enhancements include:

  • Filtering Based on Specific Failure Types – Exclude known transient errors or specific failure codes that do not require immediate attention.
  • Categorizing Alerts by Severity Levels – Implement different email formats or recipients based on the severity of the failure.
  • Attachment-Based Alerts – Instead of listing all failures in the email body, provide a structured report as an attachment for better readability.

Handling Critical Interfaces to Prevent Duplicate Alerts

One of the workarounds to prevent duplicate alerts for critical interfaces is to let them send email alerts directly through their main interface instead of using the consolidated email alert iFlow. This can be achieved by:

  1. Setting the Custom Status for Critical Interfaces.
    • Assign the SAP_MessageProcessingLogCustomStatus property as “Critical” in Content Modifier Property for these interfaces.
  2. Excluding Critical Interfaces in the OData Query
    • Modify the OData query to filter out logs where customStatus = Critical
    • status eq 'FAILED' and customStatus ne 'Critical'
    • This ensures that the alert iFlow does not pick up failed messages for critical interfaces, preventing duplicate email alerts.

By implementing this approach, critical interfaces handle their own email alerts in real-time, while the Automated alert iFlow continues to monitor and notify failures for all other interfaces.

Conclusion:

This approach consolidates failed interface alerts into structured, interface-specific emails, reducing email spam while ensuring timely notifications. Value Mapping enables dynamic recipient assignment and the Records Per Email parameter prevents excessive email length. Additionally, handling critical interfaces separately is a suggested enhancement to avoid duplicate notifications.

Let me know your thoughts or if you have any questions drop a comment below!

Happy Integrating! 

 

6 Comments
EuricoBorges
Participant
0 Kudos

@Daggolu_PremSai  very good aproach. I like It.

indrajitsarkar
Explorer
0 Kudos

Great approach. Thanks for sharing.

Daggolu_PremSai
Participant
0 Kudos

@EuricoBorges Thank you! Glad you liked it.

Daggolu_PremSai
Participant
0 Kudos

@indrajitsarkar Thank you! Appreciate your feedback. 

satsunros
Explorer
0 Kudos

Good approach, Thank you @Daggolu_PremSai 

One question ,where did you get Tenant URL info?

Rolu
Discoverer
0 Kudos

Daggolu PremSai,

I have download your I flow and tried to test the flow. but I am getting below error 

Rolu_0-1741799639667.png

Can you please help me how to resolve this error.

Labels in this area