Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Product and Topic Expert
Product and Topic Expert

In most of the integration implementation projects, the major challenge faced by integration consultants is to continuously monitor the data flow between cloud & on-premise systems and provide a live tracking of the failed messages so that the business is not impacted due to failed replications. This blog post will help the integration consultants to trigger dynamic e-mail alerts to a predefined e-mail address when an interface call fails in Cloud Platform Integration.


Main Part: Cloud Platform Integration Customization to trigger e-mail notification

Custom Iflow for email server connection
Cloud Platform Integration will  connect the smtp mail server. So iflow is required to connect the SMTP mail  to customer server, which will send the notifications

Step 2:
Process Direct connection helps us to call this iflow inside another iflow using the end point maintained in the connection property.


Step 3:
A Groovy script is needed to process the message parameter as per the customer specific content.

The integration developer needs to create the method processData
This method takes Message object of package
which includes helper methods useful for the content developer:
The methods available are:
public java.lang.Object getBody()
public void setBody(java.lang.Object exchangeBody)
public java.util.Map<java.lang.String,java.lang.Object> getHeaders()
public void setHeaders(java.util.Map<java.lang.String,java.lang.Object> exchangeHeaders)
public void setHeader(java.lang.String name, java.lang.Object value)
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
public void setProperties(java.util.Map<java.lang.String,java.lang.Object> exchangeProperties)
public void setProperty(java.lang.String name, java.lang.Object value)
import java.util.HashMap;

def Message processData(Message message) {
def body = message.getBody();

def map = message.getHeaders();
//Get initialized cached entity form Header
String sExceptionMessage = map.get("ExceptionMessage");
String sExceptionTrace = map.get("ExceptionTrace");
String sParentMPLId = map.get("ParentMPLId");
String siFlowName = map.get("iFlowName");

String CPITenantURL; // = System.getenv("HC_APPLICATION_URL");
String UrlPart1 = System.getenv("HC_APPLICATION");
String UrlPart2 = System.getenv("HC_HOST");
String UrlPart3 = '{"messageGuid":"';
String UrlPart4 = '"}';

UrlPart1 = UrlPart1.replaceAll("iflmap","");
if(UrlPart1 != null || UrlPart2 != null || UrlPart3 != null || sParentMPLId != null || UrlPart4 != null){
CPITenantURL = "https://" + UrlPart1 + "-tmn.hci." + UrlPart2 + "/itspaces/shell/monitoring/MessageDetails/" + UrlPart3 + sParentMPLId + UrlPart4;
if(CPITenantURL != null){
message.setProperty("EPTenantURL", CPITenantURL);
if(sExceptionMessage != null){
message.setProperty("EPExceptionMessage", sExceptionMessage);
if(sExceptionTrace != null){
message.setProperty("EPExceptionTrace", sExceptionTrace);
if(sParentMPLId != null){
message.setProperty("EPParentMPLId", sParentMPLId);
if(siFlowName != null){
message.setProperty("EPiFlowName", siFlowName);
return message;


Step 4:
SMPT connection to call the customer mail server: Set up the SMTP connection to the mail exchange server

Sample e-mail body content:
Dear  IT Admins,

An internal error occurred in iflow ${property.EPiFlowName}. For error details check MPL ID ${property.EPParentMPLId} in message monitoring or use the URL ${property.EPTenantURL}

Time: ${date:now:yyyy-MM-dd hh:mm:ss a}

Find below exception details for quick reference.

Cloud Platform Service


Step 5:
Calling the custom IFlow in business flow
-> Use an exception subprocess to call the email notification iflow when the exception is called.
-> In the connection in subprocess provide the URL defined in the custom iflow creation.

When ever an error is logged in Cloud Platform Integration an email is triggered to the defined mail ids.
Sample email as below


With this blog post, we learnt how to identify Cloud Platform Integration message parameters, build the mail body content using message parameter and finally push this as e-mail to IT Administrators for further tracking of messages.