Skip to Content
author's profile photo Former Member
Former Member

XI - Dynamically Determine System Details in User Functions

Hello.

Does anybody know how to dynamically determine the logon information for the statement JCO.Client mConnection = JCO.createClient() from a user defined function in XI?

Within a mapping I have written a user defined function to call a function module on ECC but as the system details are 'hard-coded' the incorrect system is called once the interface is promoted from the DEV system. I am not able to modify the user function code for each system as we transport the interfaces between systems which are locked and as such code the builder objects cannot be modified . I desperately need a method of determining which logon details should be used and I would prefer the solution to be within the user defined function.

User defined function code:

JCO.Repository mRepository;

// Change the logon information to your own system/user

JCO.Client mConnection = JCO.createClient(

"300", // SAP client

"pi_jco_rfc", // userid

"ecd4adrt", // password

"EN", // language

"adrp560dev1", // host name

"10" ); // system number

// connect to SAP

mConnection.connect();

// create repository

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

// Create function

JCO.Function function = null;

IFunctionTemplate ft = mRepository.getFunctionTemplate("ZPI_DETERMINE_STORE_FROM_SITE");

function = ft.getFunction();

// Obtain parameter list for function

JCO.ParameterList input = function.getImportParameterList();

// Pass function parameters

input.setValue( site[0] , "IM_WERKS" );

mConnection.execute( function );

String ret = function.getExportParameterList().getString( "EX_VLFKZ" );

mConnection.disconnect();

result.addValue(ret);

Any ideas gratefully accepted.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Nov 14, 2007 at 06:58 AM

    HI Darren,

    I'd suggest you to put a properties file in your XI server. This file will have values for the Username and password. When you move the changes to production, all you need to do is to change the values in the file...

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.