cancel
Showing results for 
Search instead for 
Did you mean: 

Execute Dialog Workitem from program - No desicion step

0 Kudos

Hi all,

I'm facing the following problem:

Existing workflow has a parallel step, depending on decision step before

Left lane: Activitiy Workitem starting dialog task in SAP-GUI

Right Lane: Activity Workitem starting Webflow in Webdynpro

The new challenge is now to "exceute" the workitem by RFC.

Getting the data and additional information out out of the workitem by reading the object key in the container and pass the data to remote user is no problem. To write back the remote users relevant container values (decision, amount..) is also no problem with SAP_WAPI_WRITE_CONTAINER. Updating the business data out of the users "remote input" is no problem, too. But I don't know how to execute the WI after the RFC logic has run and workflow goes on and find next step depending on the new container values.

To clearify this a little bit. The RFC should bypass the business logic which is in the method of the workflow task as usual. I tried with SAP_WAPI_SET_WORKITEM_COMPLETD but this stops the workflow at this point.

Any suggestions appreciated,

Hans

Accepted Solutions (0)

Answers (5)

Answers (5)

pokrakam
Active Contributor

Personally I would model this in a third branch with a custom wait step - 1 of 2 fork with the decision step in parallel. Then send the results via an event to the wait step and it will cancel the decision work item. Easier to build, clearer in the log, and much easier to troubleshoot.

former_member186746
Active Contributor

I'll upvote this answer. Using wait for event steps provide more control and from the workflow point of view you don't care where the event is coming from, RFC, Transaction, another workflow, etc.

Kind regards, Rob Dielemans

0 Kudos

Hi Pavan,

yes it is a asynchronous task. And firing Completed-Event is only useful after instance is registered (Sweinst). Yet the problem occurs while registering because it's a Dialog task and shortdump is raised if I try to register in background.

Kind regards

Hans

bpawanchand
Active Contributor
0 Kudos

Hi,

I had to reopen this thread cause the solution doesn't work in background, What I want to do is bypassing a dialog workitem with program logic. 

If your dialog workitem is a copy of the decision step or decision step iteself then I think you can try below steps

  1. Get the Dialog woritem ID and and pass the workitem ID along with the decision to SAP_WAPI_DECISION_COMPLETE.
  2. Also make sure before calling the above mentioned function module update the workitem container.

As you mentioned that your one of the branch is using a WEBSERVICE BOR then this task will be for sure a asynchrounous task. In this case you have to trigger the terminating event COMPLETED of the business object. I hope you maintained a terminating event for the task.

Thanks,

Pavan

0 Kudos

Hi Rob,

I had to reopen this thread cause the solution doesn't work in background, What I want to do is bypassing a dialog workitem with program logic. Your solution works if I start my program in foreground, when I execute the workitem via program with SAP_WAPI_EXECUTE_WORKITEM the event is registered and browser opens for webflow task which doesn't bother me for testing. Fireing the event afterwards works fine but the problem now is that program should work in background and there a shortdump occurs when task is trying to open webflow because there is no frontend connection. Is there any workaround for that, you know ?

Kind regards, Hans-Juergen

former_member186746
Active Contributor
0 Kudos

Hi,

If the dialog workitem is an asynchronous one, you can just simply use sap_wapi_create_event to trigger one of the terminating events.

Kind regards, Rob Dielemans

0 Kudos

Hi Rob,

thank you I tried that before but I had used the wrong object key. For object type WEBSERVICE I had to use the workitem id. After your post I tried again and found the solution.

Kind regards, Hans