cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping using an If without else Issue

Former Member
0 Kudos

Hello All,

I have a mapping where I use an If without Else boolean function. My problem occurs when the if condition is not true, but the user-defined function in the then section of the mapping is executed anyway. Is there a way to turn off this "feature"? When the user-defined funtion is executed it throws an error because the WBS_ELEMENT does not exist. I can avoid the error by using an if-else boolean function instead, but I would like to know why the if without else behaves the way it does? All information is greatly appreciated.

Thanks, jesse

Accepted Solutions (0)

Answers (3)

Answers (3)

stefan_grube
Active Contributor
0 Kudos

Check the parameter of ifWithoutElse by double click.

The parameter (keep suppress) should be 'true'

Regards

Stefan

Former Member
0 Kudos

Hi,

Can you take a screen shot of ur message mapping and email me,

I will try to help you.

my email id is joshi.shripad@gmail.com

Regards,

Shri

Former Member
0 Kudos

What might be happening is that the udf is getting executed with an empty queue?

Why don't have an "is not null" check for the queue parameter in the udf ?

Thanks,

Renjith

Former Member
0 Kudos

Hello Renjith,

Good thought, but when the udf is executed the queue is not empty. The error only occurs when the WBS_ELEMENT does not exist for the account during cases when it shouldn't. The problem is that the udf is executed when it shouldn't be and my error handling cannot differentiate between when it really is an error and when it is not, which I had thought the if condition on the if-then structure of the if without else would have taken care of. I don't understand why there isn't short circuit processing on this function.

Thanks, jesse

henrique_pinto
Active Contributor
0 Kudos

Jesse,

actually, the "then branch" is always executed prior to the "if branch" having been evaluated yet or not, but its result will only be passed to the output (meaning, everything to the right of the If function) if the "if branch" is true. In a normal If function, the "else branch" is also executed prior to the "if branch" evaluation.

In order to execute an UDF or pipeline of functions only if boolean = true, you should put it in the "output branch", before the actual target field.

Regards,

Henrique.

Former Member
0 Kudos

HI,

to give condition to If without else, you can add and the WBS_ELEMENT is exist or equals to some valid value then input to if.. so no problem. then UDF will not execute.

the another way is mapwithdefault function to WBS_ELEMENT from there UDF .. it will execute..

the other way is you can handle if the WBS_ELEMENT is not existed then return null or empty ..depends upon the business requirement..

http://help.sap.com/saphelp_nw2004s/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/content.htm

Regards

Chilla

former_member431549
Contributor
0 Kudos

I have not observed this behavour. Are you saying nothing is passed beyond if w/o else to the function immediately following it, but the function is executed ?

Former Member
0 Kudos

Hello Tim,

I am saying that the if-then functionality of an if without else statement does not hold true because the "then" is executed regardless of the "if" condition. The fields are populated when being passed to my user defined function, but the problem is that the user defined function is executed as if the "if" were true. I would have assumed short circuit processing because this seem unecessary and can create problems. The "if" condition appears to only be a gateway to whether or not the value is mapped to the idoc structure.

Thanks, jesse