cancel
Showing results for 
Search instead for 
Did you mean: 

Call JCO.ParameterList.setActive() only once?

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (0)