cancel
Showing results for 
Search instead for 
Did you mean: 

Storing Values from Look Up

former_member10771
Active Participant
0 Kudos

Hi All,


My RFC Look up is working fine. I need to store the values returned by the look up in PI. I was thinking of this hash table concept which I read in a few blogs. Can someone please let me know how we can achieve that using hash table concept. For a given input I have array of values for different country codes. How can I store the returned arrray of values using hash table.

Accepted Solutions (0)

Answers (2)

Answers (2)

iaki_vila
Active Contributor
0 Kudos

Hi Amit,

May be I'm wrong but i think you want to use an RFC lookup with different concept that it was created. A RFC/JDBC/etc lookup has its functionality to get parametrization parameters, mainly to avoid to set them in the mapping manually or in case of a larger number of them in the ID. If you want to get data to be stored later, you will need to do an scenario to do this using a bridge or calling for example the JDBC/RFC/etc adapter to store the data in the table that you want to be hashed.

I think,

former_member10771
Active Participant
0 Kudos

Hi Inaki,

Thanks for the response. I am trying the same thing as this blog.

If you could please help me as to how to proceed on the same. I havent used this hash table concept earlier.

iaki_vila
Active Contributor
0 Kudos

Hi Amit,

I think you should first to work with hashtables outside PI, you can try some examples in NWDS or a normal eclipse, later you can try to set the code in PI like a PI java library or to set in the java section in a mapping, all depends what you want. You can try with this example: 10 Example of Hashtable in Java – Java Hashtable Tutorial to start with this.

Regards.

former_member10771
Active Participant
0 Kudos

Thanks Inaki,

I wil go thru the links.. Is there any blog which has the code snippet as to how to data is stored and retrieved which would give me a idea on how to proceed. Till that time I will go thru the link provided.

former_member10771
Active Participant
0 Kudos

Hi Inaki,

I have gone thru the link provided . I will first try to store the value received by the lookup.

Under Attributes and Methods I have declared a global variable

     String globalString[] = new String[];

I am writing this UDF for filling the hash table. I am getting two values as a output from the look up. I am first trying to store them. Please check and let me know if this UDF is correct .i referred some UDF and modified it some what. But I am not getting the values from the RFC . Actually i have array of values.

import java.util.Hashtable;

public void savevalue1(String[] value1,String[] value2,ResultList result,Container container){

Hashtable htvalue1 = new Hashtable();

int Indx = 0;

for (int i = 0 ;i < value1.length ; i++) {

  String strvalue1 = value1<i>.trim();

{

    Object obj = htvalue1.get(strvalue1);

    if (obj == null){

      globalString[Indx++] = strvalue1 ;

      htparam1.put(strvalue1,strvalue1);

    }

  }

}

if (Indx < globalString.length) {

  for (int i = 0;  i < value2.length ; i++) {

    String strvalue2 = value2<i>.trim();

{

      Object obj = htvalue1.get(strvalue2);

      if (obj == null){

        globalString[Indx++] = strvalue2 ;

        htvalue1.put(strvalue2,strvalue2);

      }

    }

}

result.addValue(globalString[0]);

iaki_vila
Active Contributor
0 Kudos

Hi Amit,

Have you checked that you are getting correctly all the values from the RFC lookup?.

I'm a bit confused what kind of hashtable do you want a memory or a DB one?

Regards.

former_member10771
Active Participant
0 Kudos

Hi Inaki,


No the UDF itself is giving errors. I guess its not correct.

iaki_vila
Active Contributor
0 Kudos

Hi Amit.

If you want to use an ABAP table the INSERT functionality will be in ABAP code, you can use a RFC or proxy to do this. What is your whole scenario?, is the scenario receiver the RFC lookup data destination?

Regards.

former_member10771
Active Participant
0 Kudos

Hi Inaki,

As of now we are doing a demo scenario to check how the values returned can be stored in PI. I am doing a single RFC call to send multiple inputs and get multiple outputs in a single call. The data returned from RFC call has to be stored in PI. Can we achieve this using the hash table concept.

former_member10771
Active Participant
0 Kudos

As of now I am only concerned to test how the returned array of values can be stored in PI.

Former Member
0 Kudos

Hi Amit

Are you single stack or dual stack. If you have dual stack, then store the data in ABAP tables as it will more easier.

Why you want to store the response data in PI?

Thanks,

Indra

former_member10771
Active Participant
0 Kudos

Hi ,

I am using single stack .Actually I want the returned values to hold/store in PI so that I can use it later in some other mapping.

Former Member
0 Kudos

Hi Amit

You can try this.

Modify your RFC so that it inserts the response data to a table before retuning them as output.

Then in your new mapping, go for another look up to retrive the data that you have stored previously.

Thanks,

Indra

former_member10771
Active Participant
0 Kudos

Hi Indrajit,


Thanks for your response. I can try on that...But is it not possible to store and retrieive in PI using say hash map or global values something of that sort.

Former Member
0 Kudos

Hi Amit

We can use global variable to store the values. But we can refer those values only within the same mapping but accross all the user defined functions.

You can try to do the same using dynamic configuration. Check the document below

Thanks,

Indra

former_member10771
Active Participant
0 Kudos

THanks Indranil . I am trying to achive something on similar lines using this blog.

Actually the output I am getting is something like this from RFC look up in two fields.

IN INDIA

CH CHINA

HK HONGKONG and so on there are close to 100 values .

I want to store them using some logic like the below blog. Can you please let me know on that

http://wiki.scn.sap.com/wiki/display/Java/Using+Edit+Java+Section+in+Message+Mapping