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.
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