cancel
Showing results for 
Search instead for 
Did you mean: 

Generate mail message only if value mapping fails

Former Member
0 Kudos

Hi All,

I have a scenario wherein I need to populate the default value NA if a VM lookup fails and send an email which lists all the values in a message for which the VM failed.

I tried achieving the same through 1:N mapping populating both the required target message and mail message from same source message. This setup works fine when the VM is absent. But the mail message gets generated, without any content, even if the VM is present. I have set the cardinality of the mail message in the mapping signature as 0 to 1.

Please suggest of a possible way to achieve the above.

Note: we are using PI 7.3

Regards,

Diptee

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Multiple alerts are being generated, reopening to find a solution for the same.

Hi All,

I am mapping a graphical variable to the send mail function.

However, this works only when the graphical variable is created after the last source node which is being value mapped.

This leads to multiple alerts when the parent node ofthe graphical variable is generated more than once.

Please suggest a way out.

Regards,

Diptee

Edited by: diptee s on Dec 9, 2011 12:29 PM

Former Member
0 Kudos

Hi try generate only one occurance when you map the graphical variable to target UDF using node functions

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Use enhanced determination and do lookup during mapping and decide the target messages including mail reciever.

Please see this link (go through multiple inbound interfaces topic)

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90dcc6f4-0829-2d10-b0b2-c892473f1...

Former Member
0 Kudos

Hi Baskar,

Thanks for the link.

The solution with multiple service interfaces works fine when the VM is present; that is no alert email is generated.

However, when the VM is absent, the message fails in error RoutingException: InterfaceDetermination did not yield any actual interface.

Note: The multiplicity of my target interfaces are 1 for the required target message and 0..1 for the optional mail alert. The message mapping works fine when VM is absent, that is it generates both the target and the alert mail message.

Regards,

Diptee

Former Member
0 Kudos

Hi Deepti,

in your case mail adapter would always be called and it will generate mail. An option would be to call(Conditional based) RFC in message mapping to a function module which will send mail from abap stack. Again, it is not a better solution but you can try it.

-Amol

Former Member
0 Kudos

Thanks Amol,

The use of multi-mapping is not mandatory in our case, but we wish to be using only the javastack.

Hence any alternative solution will also be great.

Regards,

Diptee

Former Member
0 Kudos

Hi,

With enhance interface determination you will use source values in the conditions, Since you have to perform VM first, Not sure if this will work in your scenario.

Amol

Former Member
0 Kudos

Hi Amol,

Could this be the reason for the interface determination error I am now facing?

Regards,

Diptee

Edited by: diptee s on Nov 23, 2011 11:05 AM

Former Member
0 Kudos

Hi Experts,

The error is now being received for both VM failure and success.

Regards,

Diptee

Former Member
0 Kudos

Hi,

You can try sending the mail with the VM values from the message mapping itself, no need to use multimapping in this case.

Refer the foll link for how to send an email from a udf.

http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=90570965

Regards

Former Member
0 Kudos

Thanks Shiladitya,

The UDF has been really useful in generating the mail through MM directly.

I am using the UDF as below

1. perform VM lookup for source value

2. if VM lookup fails send the default value NA as the output of VM function.

3. check through a if - else condition whether the output of VM function equals NA.

i. if yes, i am feeding the output of the mail UDF (set to be the value NA) to the then condition, ultimately sent to the target

ii. if no send the mapped value to target

However, the mail UDF is getting executed even when the VM is present.

Any pointers where I am going wrong?

Regards,

Diptee

Former Member
0 Kudos

Hi Experts,

Just confirmed that the 'then' block of a 'if-then-else' function is always evaluated even if the 'if' condition yields a false. Only that the value sent as output of the 'if-then-else' function in this case, is that of the 'else' block.

I have got around this through the addition of a UDF, for collecting all values for which the VM lookup is failing, which would be applied after the VM lookup.

Now this UDF needs to work upon a global variable which will have to be intialized to a empty string.

Can you suggest how and where to declare the global variable?

Regards,

Diptee

Former Member
0 Kudos

Hi All,

Just to add a point I need this variable to be accessible accross functions in the same mapping.

Regards,

Diptee

Former Member
0 Kudos

If you are on PI 7.1, go to Functions tab in message mapping and define the global variables under "Attributes and Methods"

Former Member
0 Kudos

Hi All,

Thanks for your help!

The problem is solved, used the setParameter and getParamteter methods of the global container object to set and fetch the values of the Global variable.

Regards,

Diptee