Skip to Content
author's profile photo Former Member
Former Member

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

9 Answers

  • Best Answer
    Posted on Sep 29, 2008 at 03:20 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2008 at 09:26 PM

    Philipp,

    You can start process by four ways:

    1) Guided Procedures API: http://help.sap.com/saphelp_nw04s/helpdata/en/43/fcdf77fc6510b3e10000000a11466f/content.htm

    2) Runtime User Interface

    3) Calling an URL: Go to Guided Procedures -> Design Time -> Open your Process -> Instantiation tab -> Check Process Started Automatically -> Check include default parameters and click in Generate Instantiate URL

    4) Web Services ( http://<host>:<port>/wsnavigator )

    Best Regards,

    Pedro Nunes

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 01, 2008 at 08:37 AM

    Hi,

    what do you mean with "Remember to set the dependency on caf/eu/gp/api dc." ?

    Best regards

    Philipp

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 01, 2008 at 08:49 AM

    Please can you describe me how to do this?

    In my Application Service - tab "dependency" - i could not find a way to add it.

    Thank you

    Philipp

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 01, 2008 at 10:01 AM

    Thank you for you help.

    Unfortunately the first step doesn't work.

    In the folder \eclipse\plugins\com.sap.tc.ap_2.0.1.071030132333\comp\CAF\DCs\sap.com\caf\ don't exists the folder "eu". So i created the structure eu\gp manually. Then I copied all the files like in the blog shown.

    But if I insert the testcode the NWDS still tells me "com.sap.caf.eu cannot be resolved for a type".

    What is missing?

    Regards

    Philipp

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2008 at 07:42 AM

    Good morning,

    thanks für you help, i am going to try it this week.

    Feedback will be posted.

    Best regards

    Philipp

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 01, 2008 at 12:51 PM

    Thank you ... i got one step closer. since adding the jar no errors occure in the code-view, but when i build my application i receive errors of the following kind

    [javac] ERROR: C:\...\modeled\appsrv\administrateorder\administrateOrderBeanImpl.java:5: package com.sap.caf.eu.gp.context.api does not exist
    [javac] ERROR: import com.sap.caf.eu.gp.context.api.GPContextFactory;
    

    ... but the jar is set in the EJBModule.

    I'm sorry, but I don't understand whats going wrong.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2008 at 01:15 PM

    well I could solve the last failure on my own.

    the reason was a dublicate entry of the GP API because of my step posted on Oct 1, 2008 12:01 PM.

    So the API exists in CAF and in GP-CORE.

    In a clean installation of CE 7.1 SR5 only the one in the GP-CORE exists, so I have now set the dependency of my ejbmodule to this one.

    The generation, implementation AND build works fine, BUT on deploy the ear gets the following error:

    UPDATE

    the "following error" just appears if you forget to active "Runtime, Deploytime" in the dependency-properties.

    i changed this an now i'm able to deploy my project. the caf-webservice is available und runs.

    (so i deleted the error trace of this post)

    only point: the process hasn't been initiated, so i'll have a look on my code again.

    thanks a lot for helping me setting up the API in NWDS!!

    Best regards

    Philipp

    Edited by: Philipp Heinemann on Oct 7, 2008 4:07 PM

    Edited by: Philipp Heinemann on Oct 7, 2008 4:12 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2008 at 02:28 PM

    Hi guys,

    i used you code example again, obviously copied better than the last time 😉 and NOW IT IS WORKING!

    Ashutosh, thanks a lot for your good and patient help!

    Best regards

    Philipp

    --- QUESTION ANSWERED ---

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.