Skip to Content
avatar image
Former Member

RFC Look Up Global Variable

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Nov 19, 2014 at 07:02 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • If the output of the RFCLookup goes to the target field, why do you even need global variable?

      It should be like this:

      RFCLookup --> Target Field

      Really not sure what you are trying to achieve.

  • Nov 19, 2014 at 07:03 AM

    Hi Vinoth,

    Have you checked this document Sharing data between two message mappings through Dynamic Configuration?

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 19, 2014 at 12:52 PM

    Hi,

    If you want to use the variable in the same mapping you can do this graphically also.

    SAP PI 7.1 Mapping Enhancements Series: Using Graphical Variable

    Hope it may help in different approach.

    In Java Code you may check How to use Global Variable in SAP PI Mapping

    Suman

    Add comment
    10|10000 characters needed characters exceeded