Skip to Content

It is not a new one. It is a old hack with a new dress. Can we do RFC mapping lookups with a single crazy piece? Yes. You can. Did you know about RFC_READ_TABLE? It is not a new one but I added XI flavour to RFC_READ_TABLE by re-dressing it as a re-usable lookup API.

SAP XI being existent more often in a typical SAP landscape we need to deal more with SAP systems in real-time. It is obvious for any XI developers that this lookups are very common in any XI projects. We used to write user defined functions and JCO wrapper classes and create custom RFC’s for lookups. Why do it every time on every project? Can we perform RFC lookups using the same standard RFC template provided by SAP?

I am going to demonstrate this exercise using a JCO instead of mapping lookup API’s since we are working still on SP12.I cant really wait until the server is upgraded to the next patch for elucidating the idea. May be am afraid someone else might come up before me. Idea can be extended to the RFC mapping lookup API’s also!

Let me describe the behaviour of RFC_READ_TABLE.
Functionality: It consumes the table name and filters that are used to fetch data from any SAP ABAP DD tables and produces the result set dynamically.
Input Parameters:
QUERY_TABLE-ABAP Table Name
OPTIONS-filters (WHERE CLAUSES)
Output Parameters:
FIELDS-ABAP Table Structure
DATA-ABAP Table Data

Instance: I want to fetch all the error ID’s for the mapping category using the table SXMSSYERR (XI: System Error Codes). Let us test the RFC in the SE37 transaction code of SAP XI. Table Structure: SXMSSYERR
 SXMSSYERR  Structure
Input:QUERY_TABLE- SXMSSYERR
DBtableName
OPTIONS-CATEGORY = ‘Mapping’
Filter
Output:FIELDS- SXMSSYERR structure
 SXMSSYERR Field List
DATA- Value table with CATEGORY and ID (error Ids).
valueSet of a lookup

Look at the crazy piece below. Tailor it and use it in any XI project for mapping lookups by just changing the connection parameters. It has to be enhanced for accepting the connection parameters at the runtime when you want to use the sample JCO code for performing RFC lookups across SAP systems.

I am going to show a sample mapping in XI for demonstrating the behaviour. I used a advanced user define function genRFCLookup which takes 4 parameters table name, match field, match value, lookup field. JCO code is wrapped under genRFCLookup.
I demonstrated the mapping behaviour for the same instance that is used for testing the RFC in SE37.
GenericRFCLookup
Source Structure:
MatchCase
Target Structure: (After JCO Call)
valueset of a lookup

Note: This is just a very simple lookup example. XI developers can customise the interface in such a way that can be a single point template and user-friendly for any RFC lookups across various interfaces. It can also be extended to support RFC mapping lookup API’s supported by SP13.

To report this post you need to login first.

10 Comments

You must be Logged on to comment or reply to a post.

    1. Sravya Talanki Post author
      Ya Raj.I know RFC_READ_TABLE is not a new one and it has to be given a touch and your article is very good for any ABAPer’s.For Others we need to abstract the interface..In XI we just need to get the data and generate the mapping target structure.So I dont thing we need an XML Version for this.But it will be very useful when we are integrating SAP with any other product than XI.
      (0) 
    1. Sravya Talanki Post author
      Hi Craig,
      I have a confusion here.
      I can see the RFC in SAP XI and also SAP IS-U.
      We can even copy the source code of this FM in any system which does not have and use it also.
      Iam sorry but I really didnot get “What did you mean by not released for customers?”.Iam confused.
      (0) 
          1. Community User
            “Not released for customer” means that it is not suppossed to be used by the customers.

            OSS Note: 382318

            Symptom
            A problem occurs in function module RFC_READ_TABLE.

            Reason and Prerequisites
            The scope of function module RFC_READ_TABLE is very restricted. E.g., due to the fixed maximum row size only smaller tables can be accessed. There are several data types that cannot be handled, and also there are doubts regarding the Unicode compatibility of the function module.

            However, all this is quite immaterial, because the function is not meant to be publicly used anyway. It was only created to be used as a sample in various training courses, and is clearly flagged as “not released for customer”.

            Solution
            Do not use function module RFC_READ_TABLE in the first place!

            (0) 
            1. Sravya Talanki Post author
              Thanks Craig.
              But when we do a mapping look ups we just read very few records.so I think size is not the problem in this context.
              We can definetly create a wrapper function around and achieve the same functionality using dynamic programming in ABAP.I think unicode might not be a problem here.
              (0) 
              1. Community User
                The main reason I mention this is because as “RFC_READ_TABLE” is actually one of my favorite little FM’s and I used it myself numerous times – as it is “not released for customer use” means that it could up and vanish in a future version.

                So the key here with this FM is the “Solution” part of the OSS Note.

                (0) 
  1. Milan Thaker
    Hey this is a nice way of doing an RFC lookup. The only query I have is regarding SAP Logon. The username and password is revealed in the code. Is there any way we can hide the password?

    (0) 

Leave a Reply