on 11-19-2014 6:43 AM
Hi,
I have done a RFC look up to fetch values from ECC . I am successfully getting the values in the RFC response. I want to know how I can store or hold these values in SAP Pi using global variable. Can anyone please help with the UDF logic for the same. Below is the sample UDF I have written but I am not sure how I can use the same after the RFC output to hold the values.Any inputs would be appreciated.
I am currently getting the data in XML in the ITEM field. Please help on how to store the values in global variable.
DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey keySource = DynamicConfigurationKey.create("http:\\www.test.com\\RFClookup","ITEM");
if (conf != null) {
conf.put(keySource, var1);
}
return var1;
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vinoth,
Welcome to SCN!
Can you elaborate on what you want to do with the values after storing them?
If you want to use them within the same message mapping, then you don't need to use Dynamic Configuration in your UDF. Once approach is by storing them as key-value pairs in the GlobalContainer object, the values stored in GlobalContainter can be retrieve back in any other UDFs of the same message mapping.
Alternatively, you can also just declare attributes directly in the message mapping in the "Functions" tab under "Attributes and Methods" section. You can add Java declarations like below there:-
private String[] items;
After your RFC Lookup call, you can store them into the attribute via UDF, example below with rfcOutput declared as a parameter for a UDF of Queue type.
items = rfcOutput;
When you want to access the values, you can just use another UDF and look through the values
for (int i = 0; i < items.length; i++) {
// do something here
}
Rgds
Eng Swee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eng Swee,
Thanks for the response. Currently I want it to store so that it can be used in other mappings.
I have three values in output which now as per your suggestion I have added under attributes.
private String[] items;
priivate String[] companycode;
private String[] location;
Can you please tell me how i can store them via UDF. Some sample code so that i can modify it accordingly.
Hi Vinoth
If you want to store them for subsequent mapping steps, you need to follow Inaki's suggestion below. The approach I mentioned above is only for storing/retrieving withing the same message mapping execution.
Do note that even with Inaki's suggestions, the values are only available during runtime processing of a message. Once processing has completed, the values are no longer available, as they are not persistent.
Rgds
Eng Swee
Hi Vinoth
If your RFCLookup has 3 output values, then create a queue-type UDF with 3 input parameters of type String.
Let say the name of your 3 input parameters are input1, input2, input3, then the UDF is very simple:-
items = input1;
companycode = input2;
location = input3;
In your message mapping, map the 3 output of the RFCLookup into the 3 input of the UDF.
Rgds
Eng Swee
Hi Vinoth
One more clairification how to put this value in a single variable after declaration.
What variable are you refering to - a variable declared in the Java section Attributes & Methods, or a graphical variable?
How do you intend to use this variable?
What is your actual goal anyway - after fetching the values from ECC via RFCLookup, what is the end use for the values? Why do you want to store them in global variables, and how will the global variables be finally used?
Rgds
Eng Swee
Hi Eng Swee,
I am referring to the variable declaration under Java.
a=item;
b=ZSOURCE;
c=ZTARGET;
This is what I have done in UDF. After declaring this values under Attributes.
Now I am passing this to the output of RFC.
RFC Look UP - > UDF - > Target Field. I am not getting any values here after passing this UDF. So wanted to know if I need to add anything more in UDF.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.