on 12-11-2007 5:38 PM
In a loop construct where I am calling a JCO.Function over and over again, do I need to call setActive() on the export parameter list and the table parameter list only once to render unnecessary parameters inactive or do I have to do it on each iteration? Please refer to the code example below:
void processFunction(JCO.Client connection, String fxName) {
JCO.Function fx = createFx(fxName); // some helper method
JCO.ParameterList epl = fx.getExportParameterList();
JCO.ParameterList tpl = fx.getTableParameterList();
deactivateExportParameters(epl); // Deactive here?
deactivateTableParameters(tpl); // Deactive here?
for (int i = 0; i < count; i++) {
deactivateExportParameters(epl); // or here?
deactivateTableParameters(tpl); // or here?
setImportParameters(fx); // helper method
connection.execute(fx);
processResults(fx); // helper method
}
}
The methods deactivateExportParameters() and deactivateTableParameters() both
call JCO.ParameterList.setActive() to inactivate export parameters or table parameters
based on whether they are referred to after the JCO.Function is executed.
Thanks in advance.
Message was edited by:
Jim OHearn
Message was edited by:
Jim OHearn
Message was edited by:
Jim OHearn
Hi Jim,
the setActive method needs to be called only once. It is fired when the Function is created (either called from the Repository or created anew).
When you want to use the function, call the setActive method before the for loop. If you had been actually creating the functions inside the loop, then you need to call the setActive method also in the loop.
For e.g -
JCO.Function fx;
ParameterList tableParamList;
for(int looper = 0; looper < 10; looper++)
{
fx = createFunction("BAPI_NAME");
tableParamList = fx.getTableParamList();
tableParamList.setActive(false, "TABLE_NAME");
}
Bye,
Sameer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.