Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

XI - Dynamically Determine System Details in User Functions


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


// 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" );



Any ideas gratefully accepted.

Former Member
Not what you were looking for? View more on this topic or Ask a question