cancel
Showing results for 
Search instead for 
Did you mean: 

RFC Lookup - Best Approach To Parse Returned Tables

Former Member
0 Kudos

Hi Everyone,

We are doing some RFC Lookups at a header node that are returning tables for all of the items (for performance reasons). I am trying to figure out what the best way to extract the values from the table, which is most of time has more than 1 key column. At the moment I am doing this through DOM, but I have also heard about using arrays, and have even seen an example of using a hashtables with all of the values concatenated together to later parse out using substrings. I'm looking for the best approach to:

1) Store this data as some kind of global object to lookup during the header

2) Search and Parse from the global object during linte items.

As an example, I have the following lines in my table:

Key1,Key2,Value1,Value2,Value3

A,A,1,2,3

A,B,1,2,4

A,C,3,4,2

B,A,2,4,6

And during line item processing I may want to find the value for Key1=A, Key2=C.

Thanks

Peter

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Peter,

There are 2 options. Use DOM parser like you have or use a SAX parser.

If the XML structure ( Response XML strucutre ) is not too large, then using a DOM is a simple and an effective option. But, in case, the Response XML is going to be too big, using SAX would be a better option.

Just remember that DOM loads up the whole strcuture into the memory and so, if it is to big, a memory overflow exception can occur while SAX is a memory less parser, it is a bit more complex and back tracing over your XML tree is not possible.

Regards,

Bhavesh

Former Member
0 Kudos

Hi,

In scenarios wherein you have to import N number of fields and then use them in different fields of different segment. In this case it is better to make one call to the R/3 system at node level and keep the data in the global variable and then use it during mapping rather then making a call at every field level.

The hash structures will help you keep the data structure (table) and can be used repeatedly if required.

Regards

Vijaya

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Peter,

Please take a look at these...

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-code-samples...

/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler

/people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups

/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer

cheers,

Prashanth

P.S Please mark helpful answers