cancel
Showing results for 
Search instead for 
Did you mean: 

Send Email On a Condition Without Using Mail Package

0 Kudos

Hi PO Experts

I have to send an email based on a condition which I can calculate using a UDF.

Till now I used to create a message mapping. Source message, the input payload and Target Message the Mail package. Based on the calculated condition, I created the row and mapped the data and used mail package in the receiver comm channel until I stumbled on to the following blog

https://blogs.sap.com/2016/03/10/stop-using-mail-package-simplify-your-mail-receiver-adapter-scenari...

and

https://blogs.sap.com/2015/09/04/create-email-with-body-and-attachments-for-binary-payload-with-java...

As per the the blog, I need to create java mapping to set the mail content and not use mail package in the receiver channel.

Now my question is how do I NOT send an email when the condition is not met? Java mapping executes and sends out email irrespective.

With Mail Package I could control the output based on a condition but with java mapping I have to use receiver determination method which gets complicated.

Hope my question is clear. Any input highly appreciated

Regards

Sonal

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Thanks Manoj for all your responses. I have implemented the dynamic receiver determination for the scenario.

Answers (2)

Answers (2)

0 Kudos

Thanks Manoj

Yes I didnt create the target row when the condition didnt meet in case of mail package.

So if I raise the exception, will I see a failed message in message monitor?

Yes, dynamic receiver determination is the way I am can think of but then the code to determine the condition would have to be duplicated as I have to include the result of the condition need to be included in the mail content.

If you could elaborate a bit on raising the exception and if the message doesnt error out in message monitor then it sounds a good option 🙂

Regards

Sonal

manoj_khavatkopp
Active Contributor
0 Kudos
Yes I didnt create the target row when the condition didnt meet in case of mail package.

The does that mean u would trigger a blank mail ?

Yes the exception causes failure in message monitoring.

manoj_khavatkopp
Active Contributor
0 Kudos

Hi Sonal,

Why did u used to to do with mail package when condition was not met ? fail the mapping ? If yes then you do it in java mapping by raising exception. Or another option go with extended RD execute the condition if met then send to the receiver or you may ignore or raise an error.

The concept of java mapping was to replace the mail package mainly so you can first have Graphical mapping with whatever condition(u can use same source /target structure) and then next use java mapping to build your mail content.

Br,

Manoj