Skip to Content

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

Unable to start process via GP API in which group is exposed as input

Hi,

I am not been able to start process using GP API for the particular senario.

I created Process at design time.

In this process I mapped parameters to a group and exposed this group, So that input is required for initiating the process.

Now I want to initiate this process via GP API.

I got sucess in starting processes which takes parameters as inputs or which does not need any inputs, but i was not been able to start process where group is exposed.

it's giving me GP INVOCATION Exception.

Please Help ASAP

Regards,

Pratik

Former Member
Former Member replied

Pratik,

I try to simulate with scenario described by you and I got success with my test.

Follow my java code:

	public boolean initiateProcessSDN () { 
		boolean ret = false;
		try {
		
			IUser user = UMFactory.getUserFactory().getUserByLogonID("uces");
			IGPUserContext userContext = GPContextFactory.getContextManager().createUserContext(user);
			IGPProcess processTemplate 
				= GPProcessFactory.getDesigntimeManager().getActiveTemplate(
						"8DC0B411957D11DDB7910017F2EBE4A5", userContext);
			
			IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();
			IGPStructure params	= GPStructureFactory.getStructure(processTemplate.getInputParameters());
				
			params.setAttributeValue("NameGroup", "Pedro");
			params.setAttributeValue("AddressGroup", "XPTO");
			
			IGPProcessRoleInstanceList roles = rtm.createProcessRoleInstanceList();
			
			IGPProcessInstance prInstance 
				= rtm.startProcess(	processTemplate, 
								"Test 1", 
								"Test 2",
								user, 
								roles, 
								params, 
								user);
			ret = true;
			} catch (Exception ex) {
				ret = false;
			}
		return ret;
	}

Print screen about my GP design:

Callable Object with 4 parameters

http://img530.imageshack.us/img530/16/sdngpgroup001bt5.jpg

Action grouping CO parameters into 2 groups

http://img147.imageshack.us/img147/2006/sdngpgroup002xy3.jpg

Process reflecting these groups as input parameters

http://img147.imageshack.us/img147/9184/sdngpgroup003pp0.jpg

Process started by java code above

http://img530.imageshack.us/img530/8833/sdngpgroup004no4.jpg

Best Regards,

Pedro Nunes

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