cancel
Showing results for 
Search instead for 
Did you mean: 

Graphical Mapping: How to do RFCLookup on a Condition

christian_praus
Explorer
0 Kudos

In Graphical Mapping I want to do a RFC-Lookup using the new buildin RFC-Lookup function. But I want to do the lookup only

if for example field1 in the inputmessage has value "00000", otherwise I could map field1 directly from input to output.

I tried IfWithoutElse and If but that didn't work, the RFCLookup is always executed.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Personally I always use a hashmap to store my lookup values in a UDF when doing an RFC lookup. That way if the same value is required to be looked up, the code firstly checks the hashmap. I find performance can be a lot better (if you have repeating values. If you did this approach all you would need to do is prefill the hashmap with the value(s) you don't want to look up e.g. 0000 = 0000, that way it achieves your result and potential saves on performance.

Andrew

Former Member
0 Kudos

Hi Praus,

can you try with UDF and in UDF write a condition : check the input messge value in first setp , if the value is "00000" then return the same value othersie call your RFC lookup.

Former Member
0 Kudos

Hi Christian,

if the condition is failed, the RFC Lookup will not execute.

when u do the display in message mapping, u will see that there is a output value even the condition is false. but when u do the channel monitor, u will see that only the RFC Lookup execute for the true value.

by the way, when we use RFC lookup, we also do the following steps to reduce RFC Lookup call. it would reduce the server load of performance.

Regards,

Kevin

ralf_zimmerningkat3
Participant
0 Kudos

here i have the same problem

check the queue of function ifS and if show always the same

even i ISF:in1(the candition) ist false in ISF:In0 is the result from tehe rfclookup

the same result si if I use the function if

so there is no difference between if and ifS

checking the communication cannel show that the rfc call always will call.

regards ralf

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi,

try to use below logic

field1---->exists--------------->
                                                   AND----------------      IF THEN ELSE---------------->TARGET
field1-----equals(text)-------->
    constant(0000)

Regards,

Raj

Former Member
0 Kudos

try with ifwith else....function.

first compare input with constant value 0000 if result is true than RFC lookup else map field1 input

thanks

chirag

Edited by: Chirag Gohil on Nov 15, 2011 6:37 PM

christian_praus
Explorer
0 Kudos

High Chirag,

do you mean a mapping like this:

if(equalsS(field1 = '00000') then(RFCLookup) else(source/field1)) -> target/field1

The problem is that RFCLookup is always executed, no matter if equalsS gives TRUE or FALSE.

Former Member
0 Kudos

Hi Christian

Try the ifS block instead of the if one.

Regards,

Giuseppe

baskar_gopalakrishnan2
Active Contributor
0 Kudos

I dont see any difference between if and ifs usage here.



input--------->   1                       rfc lookup --->then
                               equalsS --->  if                              o/p ---->  target field
constant  ----> 2                                                                                
constant---->else


Former Member
0 Kudos

Hi Christian,

just to be sure: Do you use the equalS in Text function (good) ? or Equals in Boolean function (bad) ?

Mickael

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

if(equalsS(field1 = '00000') then(RFCLookup) else(source/field1)) -> target/field1

Use ifS instead of if, the reason for this is with ifS the logic is executed like


if(exp1)
 statement1;
else
 statement2;

instead of


value = if(expression, statement1, statement2);

The second code executes the all statements before returning the correct one (behavior of if in PI), whereas the first code only executes the statement if the expression is correct (behavior of ifs in PI).There is a SAP Note with regards to this, you may want to check on that.

Hope this helps,

Mark

Former Member
0 Kudos

But at the end you wanted to pass either RFC lookup value or input value based on the condition.

Edited by: Chirag Gohil on Nov 16, 2011 3:09 PM

Edited by: Chirag Gohil on Nov 16, 2011 3:09 PM

christian_praus
Explorer
0 Kudos

Hello

and thanks to everybody. I followed Mark's solution and had a look at SAP Note 1090369 but it doesn't work, the RFCLookup is always executed. I'm on PI 7.11.

Regards Christian