Skip to Content

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

Terminating Process programatically

Hi All,

Im working on NWDS 7.1 and EP CE 7.1.

Im trying to terminate a process programatically on click of a button.

I have used following code:

public void stopProcess( java.sql.Date startDate, java.sql.Date endDate ) {

//@@begin stopProcess()

IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();

try {

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.getSAPUser();

IGPProcessInstanceInfo[] instanceInfo = rtm.getRunningInstances(0, startDate, endDate, user);

for(int i=0;i<=instanceInfo.length;i++)

{

String instanceId = instanceInfo<i>.getProcessInstanceID();

IGPProcessInstance instance = rtm.getProcessInstance(instanceId, user);

rtm.stopProcess(instance, user);

}

} catch (WDUMException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (GPEngineException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (GPInvocationException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

//@@end

}

Here im facing array out of bound exception in the highlighted piece of code.

There is no processInstanceInfo being retrieved by IGPProcessInstanceInfo[] instanceInfo = rtm.getRunningInstances(0, startDate, endDate, user);.

Its returning no values to the array, as array size is coming '0'.

The date parameters that are being passed are system date in both 'startDate' and 'endDate'.

Please guide where i may be going wrong.

Thanks and Regards,

Sakshi

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