cancel
Showing results for 
Search instead for 
Did you mean: 

IfS and IfSWithOutElse

Former Member
0 Kudos

Hi,

Can any one tell me what is the purpose of the following standard boolean fucntions that are available as part of SP15?

1.IfS

2.IfSWithoutElse

Thanks,

Regards,

Naresh

Accepted Solutions (1)

Accepted Solutions (1)

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

Have a look at SAP note [1090369|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1090369].

Thanks

SaNv...

Former Member
0 Kudos

Ooops...I do not have account.

Can you please post the content here.

Thanks

santhosh_kumarv
Active Contributor
0 Kudos

From SAP Note 1090369:

Summary

Symptom

The behaviour of functions 'if' and 'ifWithoutElse' in Message-Mapping has been changed. We have changed it after we've become aware of the fact that both functions behave inconsistently with the documentation.
This change has some important consequences, which are described in this note.
Let us consider the function 'if'. The situation with 'ifWithoutElse' is analogous to it.

There are, in fact, two distinct use-cases for the function 'if':

1. One is when the function is used as an if statement. For example, consider this pseudocode:

if <condition>
  value = <expression1>
else
  value = <expression2>
end

In this case, one expects that the <condition> expression is evaluated first and then, depending on the value of the condition, one of the branch expressions is evaluated and assigned to variable 'value'.

2. The second use case is when the function is used as a procedure. In pseudocode:

value = if (<condition>, <expression1>, <expression2>)

In this case, all three expressions (<condition>, <expression1> and <expression2>) whould be evaluated first and the results of this expressions would be passed to function 'if', which in turn, would return one of them, depending on condition value, to be assigned to 'value' variable. This second use-case is also known in some programming languages as function 'iif'.

In Message-Mapping, the analog of evaluating an expression is advancing a pointer on one of the argument queues of a function. It turned out that the function 'if' did not consistently work either way and that the customers need both variants of the function. The SAP Note 1053706 has delivered the first patch to the function 'if'. This patch was not functionally complete and the function 'if' was patched again. The SAP Note 1085331 has delivered the finally fixed function 'if'. With this Note, the function always works as in use-case 2 above. That is, all arguments are evaluated first, then value of one of them is returned. To minimize compatibility problems with old usages, the function makes one exception to this rule: in case when evaluating one of the branches throws an Exception, the function ignores it, if the exception is in the branch that is not selected by condition.

This change in behaviour can lead to some of the Message-Mappings producing different results than before implementing the patch.
One common problem situation is when one of the branches of function 'if' contains a User-Defined function that produces side-effects. Like increments and stores a counter in 'GlobalContainer', for example. Such functions will be executed more times than before and will cause the numbering to go awry.


Other terms

Message Mapping, XI, PI, IF,IFS IFSWIthoutElse Boolean functions


Reason and Prerequisites

See above.

Solution

To provide customers with functions to use in use-case 1 above, SAP will deliver new standard functions 'ifS' and 'ifSWithoutElse'. The 'S' in the names states for 'Statement'. The new functions will be delivered in

Patch level 1 of SP21 of XITOOLS 3.0,
and SP22 onwards

Patch level 1 of SP14 of XITOOLS 7.0,
Patch level 2 of SP15 of XITOOLS 7.0
and SP16 onwards

SP05 of SAPXIESR 7.1 and SAPXIPCK 7.1,
and subsequent Support Packages of each corresponding major release.

It is not recommended to install the patches between SAP Note 1053706 and 1085331. If you decide to install a patch from Note 1085331 or any subsequent release, carefully test Message-Mappings before deploying the patch in productive systems.

In case the upgrade is necessary and Message-Mappings do not work as before, there is a possibility to workaround the problem. There's no known generic workaround for all kinds of problems that can arise.

Note :
IFS and IFSWIthoutElse functions have a Limitation.

When the The IFS and IFSWIthoutElse functions have the UDF of type Queue or Context, it will be executed unconditionally.
i.e the Queue UDF will be executed once even it does not have a matching condition in the input queue and the Context UDF will be executed once for every Context in the input queue, even if there is no matching condition in the input context.

For situation with functions leaving side-effects described above, we recommend to add a new argument to the User-Defined Function and create the side-effect conditionally based on that argument. Most probably you will want to put in this additional argument the same queue that you use in condition for function 'ifS'.

Please read the relevant Note 1158485 also.

Thanks

SaNv...

Former Member
0 Kudos

reverted back..

Answers (0)