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: 
suraj_s
Explorer
Hello Everyone,

I am Suraj Shelke. In this blog series, I shall be sharing my experience, my trip, my adventure as a CPI Consultant.

I shall be sharing my exploration and knowledge in each blog. So, it’s more like, I will be sharing as I am exploring the world of Integration. l will be happy to hear from you what do you think and what I can improve.

Solet’s get started.

 

Introduction:

In most integration Implementation Projects, The common requirement is to trigger an email notification whenever there is any failure or any specific business scenario. These alerts and notifications can be either technical in nature – pertaining to the health of cloud integration or it could also be a business alert sent to the line of business users regarding an end-to-end process that they are responsible for. The possibilities and use cases are immense.
If you want a basic understanding of how to create email notifications and how to build the process Iflow, you can check this blog: https://blogs.sap.com/2019/10/16/trigger-email-notifications-from-cloud-platform-integration by Ratish.

So in this blog, I am assuming you have built the error handling subprocess already and I am considering a scenario where integration flow is failing due to any reason and the email notification has to be sent to a particular set of users.

Iflow Design:


Email Error Notification Iflow Design


 

In the iflow, below are the components which I used.

1) ProcessDirect Adapter: At the start of the message I have used the Process Direct adapter. In all the other business iflows (Caller Iflow) I have used the Error Handling Subprocess and with this sub-process, I am calling this processDirect iflow to trigger the email notification. (If you want to know how Process Direct works please head to this blog: https://blogs.sap.com/2018/02/14/processdirect-adapter )

2) Content Modifier: To set the Current Date and time as below:



Content Modifier Config


3) Mail Adapter: The Mail adapter is where we will configure our custom template using "HTML & CSS". Please follow the below configuration for the mail adapter.


Mail Attributes


Note: I am receiving the below headers from the ProcessDirect adapter which I have configured in the error handling subprocess of the Business/Main Iflow.

  1. Iflow_Name

  2. Error_Message


I have configured

HTML Code:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="x-apple-disable-message-reformatting">

<style>
table,
td,
div,
h1,
p {
font-family: Arial, sans-serif;
}

</style>
</head>

<body style="margin:0;padding:0;">
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#ffffff;">
<tr>
<td align="center" style="padding:0;">
<table role="presentation" style="width:602px;border-collapse:collapse;border:1px solid #cccccc;border-spacing:0;text-align:left;">
<tr>
<td align="center" style="padding:10px 0 10px 0;background:#fff;">
<div style="height:166px; width:100%; background:#019CE0;font: bold 140px 'Trebuchet MS'; color:white;letter-spacing: -10px ">
CPI
</div>
</td>
</tr>
<tr>
<td style="padding:36px 30px 42px 30px;">
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
<tr>
<td style="padding:0 0 36px 0;color:#153643;">
<h1 style="font-size:24px;margin:0 0 20px 0;font-family:Arial,sans-serif;">ERROR IN CPI</h1>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:Arial,sans-serif;">Hi Team, <br/>Please be informed that an error has occurred in CPI integration flow with the following details:</p>
</td>
</tr>
<tr>
<td style="padding:0;">
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
<tr>
<td style="width:130px;padding:0;vertical-align:top;color:#153643;">
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:Arial,sans-serif;">CPI Tenant&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</p>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:Arial,sans-serif;">Interface Name &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</p>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:Arial,sans-serif;">Date Time &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</p>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:Arial,sans-serif;">Exception Message&nbsp;&nbsp;:</p>
</p>
</td>
<td style="width:20px;padding:0;font-size:0;line-height:0;">&nbsp;</td>
<td style="width:260px;padding:0;vertical-align:top;color:#153643;">
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:Arial,sans-serif;">${property.CPI_tenant}
</p>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:Arial,sans-serif;">${header.Iflow_Name}
</p>
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:Arial,sans-serif;">${header.Date_Now}
</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:Arial,sans-serif;">
${header.Error_Message}
</div>
</td>
</tr>
<tr>
<td>
<div style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:Arial,sans-serif;">
Please contact support Team if you need assistance.
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding:15px;background:#A9A9A9;">
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;font-size:12px;font-family:Arial,sans-serif;">
<tr>
<td style="padding:0;width:50%;" align="left">
<p style="margin:0;font-size:12px;line-height:16px;font-family:Arial,sans-serif;color:#ffffff;">
&reg; Your Company Name <br />
</p>
</td>
<td style="padding:0;width:50%;" align="right">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

Output:


Email Notification


 

Conclusion: Using the above template you can create a standard-looking email notification which you can use for the error notification. This process direct iflow is a generic iflow that you can reuse again and again.

 

In the next blog, I will share some of the groovy script examples for message mapping and other complex scenarios.

Meet you in the next One

Thanks & Regards,

Suraj
4 Comments
roman_velichko
Explorer
Please show screenshot of Connection Tab for mail adapter. What kind of email smtp-server do you use? Is this smtp-server is public or it is embeded in CPI? 😉
sap_kalyan
Explorer
Great blog really informative ..!!
suraj_s
Explorer
0 Kudos
Hi Roman, I am using my Gmail for connection. You can also use Gmail or you can use any other smtp server. As of now, CPI does not have any embedded email server.
PB2
Participant
Awsome! Looking to implement soon.
Labels in this area