cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Functions

manigram
Active Participant
0 Kudos

Dear Experts,

What is the difference between IF and IFS in PI. I checked in forum all are explaining difference for IF and IF else. Also give me some link to learn Boolean function.

Regards,

manigandan

Accepted Solutions (0)

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

The full explanation can be found on this note:

SAP Note 0001090369 - Changes in function 'if' in Message-Mapping

It would be too long to paste it here though

Regards,

Mark

Former Member
0 Kudos

have you seen below blog it's very helpful (From SAP Note 1090369)

http://scn.sap.com/message/6452385#6452385

manigram
Active Participant
0 Kudos

I dont hav account

Can u send me the doc to [removed by moderator]

EDIT Grzegorz Glowacki (Moderator): Please do not ask the community members to send you information via e-mail. This is not accepted by the .

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Can you try this? In your PI system, type tcode snote -> ctrl+f8 and input the note number and press execute.

Email communication is against the rules of engagement though.

Regards,

Mark

Former Member
0 Kudos

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'.

manigram
Active Participant
0 Kudos

Hi,

I tried this but only meta data is opened not file.

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

What do you mean by only meta data? You have to double click the note to open it, it takes some time to open though. Afterwards, it would be displayed in your SAP GUI as a PDF and you can save it into your local.

Regards,

Mark