cancel
Showing results for 
Search instead for 
Did you mean: 

Help on Lookup API

Former Member
0 Kudos

Hi,

While I was searching for stuff on Lookup API, I came across the two good blogs talking about different ways to do Lookups.

RFC Look up -

RFC lookup with communication channel -

But I couldnt find an answer for the below questions.Would appreciate if anyone can let me know,

1) Which method has a good performance - Lookup using JCo or Lookup using RFC adapter(using communication channel)

2) Is there any guideline to decide between JCo and RFC adapter method.

2) If I am using the JCo method to do the lookup, how can I provide the connection details(host,username,password) at runtime.

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

1) Which method has a good performance - Lookup using JCo or Lookup using RFC adapter(using communication channel)

~~~~~~~~~~

SAP came up with the lookup API to eliminate the JCo calls. So the lookup API sure sud have a better performance.

2) If I am using the JCo method to do the lookup, how can I provide the connection details(host,username,password) at runtime.

- refer the blog. It has a snippet of a jco call.

Former Member
0 Kudos

I think he is asking as to how we can pass the values dynamically using JCO.

Try creating a .properties file and store it in each instance of XI in a specific folder and code the JCO as follows.

try {
                properties = new Properties();
                properties.load(new FileInputStream(("/usr/sap/properties/xiprop.properties")));

                client = properties.getProperty("jco.client.client");
                user = properties.getProperty("jco.client.user");
                passwd = properties.getProperty("jco.client.passwd");
                ashost = properties.getProperty("jco.client.ashost");
                sysnr = properties.getProperty("jco.client.sysnr");

                // Change the logon information to your own system/user
                mConnection = JCO.createClient(client, user, passwd, "EN", ashost, sysnr );

                // connect to SAP
                mConnection.connect();

                // create repository
                mRepository = new JCO.Repository( "SAPLookup", mConnection );

                // Create function
                JCO.Function function = null;

                //write your code here
                IFunctionTemplate ft = mRepository.getFunctionTemplate("FunctionModuleName");
                function = ft.getFunction();
                // Obtain parameter list for function
                JCO.ParameterList input = function.getImportParameterList();
                // Pass function parameters
                input.setValue( a , "importValuetoFM" );

                mConnection.execute( function );
                ret = function.getExportParameterList().getString( "exportValueofFM" );

        } catch (Exception e) {
                e.printStackTrace();
                //Disconnect the connection

        } finally {
                if (mConnection != null) {
                                try {
                                                mConnection.disconnect();

                                        } catch (Exception ex) {
                                                ex.printStackTrace();
                                        }
                        }
        }

return ret;

BR

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Prior to SP-13 in XI, the lookup was database dependent. but from SP-13 SAP introduce Lookup API's that are totally database independent.

Using RFC call for lookup is simple and recommended. If I am not wrong in Jco call your username and password is visible too..anyhow..RFC lookup is best instead of Jco call.

Thanks

Farooq