cancel
Showing results for 
Search instead for 
Did you mean: 

How to trigger the same gp process once again pogrammatically

Former Member
0 Kudos

Hi

I have aGP process implemented in Webdynpro.

After the completion of this process, itshould automatically trigger the same GP process once again.

It should happen from the webdynpro coding.

Can anybody help me.

thnaks

Smitha

Accepted Solutions (1)

Accepted Solutions (1)

rupambhatta
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Smitha,

Please go through [this|http://help.sap.com/saphelp_nw04s/helpdata/en/43/fcdf77fc6510b3e10000000a11466f/content.htm]. It explains how to Start and Terminate Processes Using the GP API step by step.

Regards,

Rupam

Former Member
0 Kudos

Hi Rupam

thanks for the reply

When I tried to create the process using GP API the process is creating in Background. For me , after the completion of one process , automatically next should trigger and the corresponding view should be visible for the user.

Process is triggering using GP API but, the view is not visible to user.

Please help me

Thanks

Smitha

former_member4529
Active Contributor
0 Kudos

Hi Smitha,

For your requirement you need to use portal navigation to navigate to the GP process instantiation iView instead of using navigation plugs. Refer the following blog on how to create the GP process instantiation iView:

[How To Present Your GP Processes To The End User|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5974] [original link is broken] [original link is broken] [original link is broken];

Then from your web dynpro application use the portal navigation API to navigate to this iView. Refer the following blog for the portal navigation API:

[How To Open Running GP Processes from Web Dynpro Applications|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/6241] [original link is broken] [original link is broken] [original link is broken];

Use the following API to navigate to the iView:

WDPortalNavigation.navigateAbsolute("ROLES://portal_content/dipankar/java_sap_com_cafeugpuirt_com_sap_caf_eu_gp_ui_inst", WDPortalNavigationMode.SHOW_HEADERLESS_PORTAL, WDPortalNavigationHistoryMode.NO_DUPLICATIONS, "process.template.id=A7A896EFADF811DBC0640016353AC84F&process.autostart=t");

Hope this helps.

Thanks,

Dipankar

Former Member
0 Kudos

Dear Dipankar ,

Sorry for this delay. Today Only, I could try your suggestion .

Anyway I'm really thankful to you.

It is working fine,. After completing one process, I am able to trigger a new process through coding and instantiation view is also coming correctly.

Thanks a lot

Regards

Smitha

Answers (1)

Answers (1)

former_member4529
Active Contributor
0 Kudos

Hi,

I can't understand what you mean by "a GP process implemented in Webdynpro". Do you mean a Web Dynpro callable object implemented using GP interface? If you want to start a new process instance before completing the running process instance you can use either of the two options:

1) Use Start Process callable object which will trigger the new process instance if used anywhere in your process template. Before this CO use a Business Logic CO to check the parameter which will determine whether this is the first or the second run. Set the resultstate target of the decision action to the start process CO if it's the first run.

2) Use the GP API or the Web Service from the last CO or a new background action CO to start a new instance of the process. Use the decision/business logic CO as in the previous case.

Thanks,

Dipankar

Former Member
0 Kudos

Hi Dipankar,

Thanks for the reply.

That is what I meant-A WD CO implementing GP interface.

I tried like: I have given this coding just before

executionContext.processingComplete();

IGPProcess process = null;

try

{

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser tl_user = wdUser.getSAPUser();

//wdComponentAPI.getMessageManager().reportSuccess("current user is : " + tl_user.getFirstName());

IGPUserContext userContext = GPContextFactory.getContextManager().createUserContext(tl_user);//, user.getLocale());

process =GPProcessFactory.getDesigntimeManager().getActiveTemplate("EB0B28E08B6011DBB1BE00145EB416E0",userContext);

IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();

IGPProcessRoleInstanceList roles = rtm.createProcessRoleInstanceList();

int rolenum = process.getRoleInfoCount();

IGPProcessRoleInstance roleInstance=null;

for (int i = 0; i < rolenum; i++)

{

if(i==1)

{

roleInstance = roles.createProcessRoleInstance(process.getRoleInfo(i).getRoleName());

roleInstance.addUser(tl_user);

roles.addProcessRoleInstance(roleInstance);

}

}

IGPStructure params = null;

params = GPStructureFactory.getStructure(process.getInputParameters());

IGPProcessInstance prInstance = rtm.startProcess(process,"register1211","This process has been started using the GP public API",tl_user,roles,params,tl_user);

IGPCallableObject s;

wdComponentAPI.getMessageManager().reportSuccess("triggered");

}

catch(Exception e)

{

wdComponentAPI.getMessageManager().reportSuccess("excep"+e);

}

This starts a new process, in background.

That means..

suppose

I am in "Smitha''s login.

I initiated a process from GP runtime.

I selected the Approver and submitted the WD View and called processingComplete();(Before that I gave the above section of code also).

it is showing the message "Action is to be processed by "Approver"

It is not giving the vew again to submit new process. But the process is started. it is available in "smitha's" worklist.

I think u got my problem.

In otherwords my requirement is.. after completion/ of one action, the screen should refresh to start a new GP process.

Now 'm able to start a process. But execute method of first callabject 'm unable to call now?

How to start a callable object.

please help me out

thanks

smitha

Former Member
0 Kudos

Hi Dipankar,

I tried , what you had told also.

I created one "Initiate Process" CO.

In my first action, on submission, I set the result state to next action.

Along with it should start a new process Instance.

But for my first action I can set only one result state. is it?

Other wise I should be able to set 2 result states ..1 to resume the existing process. and the other to start "initiate Process CO".

is it possible?

Please help

thanks

smitha