Skip to Content
0

Send Email On a Condition Without Using Mail Package

Aug 25, 2017 at 05:46 AM

59

avatar image
Former Member

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-scenarios/

and

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

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
avatar image
Former Member Sep 07, 2017 at 02:52 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Manoj K Aug 25, 2017 at 06:06 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Aug 25, 2017 at 07:04 AM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded
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.

0