Skip to Content

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

Start GP process on CAF webservice call

Hi all,

I've got the following scenario:

a supplier-system offers a webservice (out of CAF application service) for customers to transmit an order. when the customer calls this webservice a BusinessObject "order" will be created in the backend. That's already working fine.

In the next step a guided procedure "order execution process" should be started automatically, when the business object "order" is created.

How can I do this second step?

Best regards

Philipp

replied

Hi Philipp,

You can simply achieve this by creating a webservice out of one of CAF methods. Remember to set the dependency on caf/eu/gp/api dc.

Your code should look something like this

try {
			
			IUser user 
				= UMFactory.getUserFactory().getUserByLogonID("HotlineClerk");
			
			IGPUserContext userContext 
				= GPContextFactory.getContextManager().createUserContext(user);
			
			IGPProcess processTemplate 
				= GPProcessFactory.getDesigntimeManager().getActiveTemplate(
	            		"1AFD4E81C02A11DC9300001185E7B75E", userContext);
			
			IGPRuntimeManager rtm 
				= GPProcessFactory.getRuntimeManager();
			
			IGPStructure params 
				= GPStructureFactory.getStructure(processTemplate.getInputParameters());
	
			
				params.setAttributeValue("Set_A", SelectOne);
			
			params.setAttributeValue("Set_B", SelectTwo);
			params.setAttributeValue("Set_C", SelectThree);
			params.setAttributeValue("Set_D", SelectFour);
			params.setAttributeValue("Set_E", SelectFive);
			params.setAttributeValue("Set_F", SelectSix);
			params.setAttributeValue("ServiceRequestID", ServiceRequestId);
			params.setAttributeValue("CustomerID", CustomerId);
			
			IGPProcessRoleInstanceList roles = rtm.createProcessRoleInstanceList();
			
			IGPProcessInstance prInstance 
				= rtm.startProcess(	processTemplate, 
								"Send Customer Feedback", 
								"Send Customer Feedback",
								user, 
								roles, 
								params, 
								user);		
		
		} catch (Exception e) {
			// TODO Auto-generated catch block
			return false; 
		}

Hope this helps,

Ashutosh

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