on 04-29-2009 4:28 PM
Hello,
I need to apply an RFC Lookup which delivers a boolean flag back (true or false). This RFC lookup should be used for different target fields.
Is there a way to execute the RFC lookup just once and then store the result in an internediate variable that I can use for all futher checks for different target fields?
If this is not possible and I have to apply the RFC lookup for all necessary target fields is it then executed for each target field ? This is exactly what I want to avoid in order not to slow down performance.
The input parameter (=source field value) would be the same.
Thank you for your advice!
Hi Florian,
This is very much possible.
Firstly use this RFC lookup in the first node mapping.
Then you can define Global variables using the EDIT JAVA SECTIONS part of the message mapping.
Then use getparameter and set parameter java functions to get the stored value and use it elsewhere in the mapping.
To store values in global variable
container.getGlobalContainer ().setParameter ("str", FIELDNAME);
To get the value already stored in global variable.
String myStr = (String) container.getGlobalContainer().getParameter ("str");
Regards,
Ravi Kanth Talagana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Exactly.
Here is a UDF example I have that you could adapt to your needs.
Set
public String setCounter(String a,String b,Container container){
/* Store values in global datacontainer
a: mapping value and return valueparameter
b: name for stored value parameter
*/
GlobalContainer myGlobalContainer;
myGlobalContainer = container.getGlobalContainer();
myGlobalContainer.setParameter(b.toUpperCase(), a);
return a;
}
Get
public String getCounter(String a,Container container){
//write your code here
GlobalContainer gc = container.getGlobalContainer();
if (gc.getParameter(a) != null) {
return String.valueOf(gc.getParameter(a));
} else {
return "1";
}
}
Thanks a lot for the helpful answer.
However we use version 7.1 could it be that the EDIT JAVA SECTION is not available there anymore?
One more question concerning the usage of the proposed UDF. Would I use the first node as a "dummy" to call the RFC lookup and afterwards storing the value in the container (by using the set UDF) and in subsequent target field mappings I would use the the get UDF to retrieve the value?
Thank you again for your additional help
Hi
You dont need to use any global variables.
I had a similar issue where i had an RFC lookup which was made through a JCO call and written in a UDF,and my RFC was returning more than 1 output for diffferent output nodes, but had to use the same RFC lookup
What i did was i input a constant along with the same common input node with and the the name being (For EG : output1)
and in the lookup code i checked for the input constant, if its equal to output1, i return the desired output, else i check for output2, if equal i send the output.
this way i am using only the code once,
hope this helps
thanks
SG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.