cancel
Showing results for 
Search instead for 
Did you mean: 

udf for rfc lookup

ralf_zimmerningkat3
Participant
0 Kudos

hi, by using grafic rfc lookup it is possible to have more than on value as the result

so one lookup can return the value for n target fields.

but there is no way to prefent the lookup call even if it is part of an if/else .

i will execute the lookup only if source field has the right value, so i try to use the lookup api in a udf function.

but the problem is that there could by only on return?

Any idea how to fix this?

Is there a way to set the total Inputstream of the lookup to the return string?

regards

ralf

Accepted Solutions (0)

Answers (3)

Answers (3)

stefan_grube
Active Contributor
0 Kudos

> but the problem is that there could by only on return?

>

> Any idea how to fix this?

I assume that you work with PI 7.0, as PI 7.1 allows several output parameters of an UDF.

In PI 7.0 you store the return values in an array or hashtable (which you declare in Java section of the mapping) and define another UDF to read them.

ralf_zimmerningkat3
Participant
0 Kudos

I only know asl result from a udf a string or a resultset if working with the queue.

This is the same in pi 7.0 and 7.1

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Ralf,

What Stefan meant was that you could use multiple resultsets (hence multiple outputs) in your output if you are using PI 7.1 and above.

Regards,

Mark

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

but there is no way to prefent the lookup call even if it is part of an if/else .

Quoting from SAP Note 1090369, ifElse behaves like "value = if (<condition>, <expression1>, <expression2>)". Which means that the three statements are executed and either expression1 or 2 is returned. Since you are using the if/else as a statement, you should use ifS and ifSWithoutElse, in that way, the UDF call is not executed when the input to the UDF is a false.

but the problem is that there could by only on return?

Well you could loop your lookup but this is not best practice. Can you design the RFC such that it would accept multiple values and then return the needed values in one go?

Hope this helps,

Mark

baskar_gopalakrishnan2
Active Contributor
0 Kudos

You can use if without else and check the source element has right value? if so then use rfc graphic lookup function. And output RFC map to various target fields. I feel assigning the multiple return values to many target field is possible. similarly in case of uDF, the output of API colllect it in the list object and parse the objects to assign to diff target fields.