I am completing the workitem form webdynpro application using 'SAP_WAPI_WOKRITEM_COMPLETE'. Its completing the workitem, but the workflow is set to error.
Dialog WI created: No errors
WI processing completed: NO errors
Result Processing: Error during result processing of Work item XXXX
Find_next_nodes_WIM: Error when defining successor for node XXXXXX.
Background: Workflow sends two parallel workitems to UWL from workflow (dynamic parallel processing, not fork). Clicking on workitem in UWL launches webdynpro application. Clicking on a certain button inside the webdynpro application would call SAP_WAPI_WORKITEM_COMPLETE function module to complete the workitem.
Please guide me on this, I could not get why the workflow is going to error.
As you said that when ever in UWL , workitem is executed , WD application is launched and then after taking decision, you are trying to complete the workitem, so I think you might be using a Decision task rather a simple standard task, right? then you should not use the FM SAP_WAPI_WORKITEM_COMPLETE but ,need to use SAP_WAPI_DECISION_COMPLETE by passing the decision key as 0001 for Approve and 0002 for Reject and 0003 for Review
And can you please confirm that, are you trying to use multi-line container element to generate parallel branches. so if you are using, then make sure the nummber entries and the number of forks created are one and the same.
As pavan suggested, I am already setting commit work as X in the function module.
Yes, I am using mutiline element for parallel branches and number of branches created are same as number of lines in container element.
Secondly, I am not using decision task, its a custom webdynpro application linked to the standard task.
I am able to resolve the issue.
Solution that worked: I have changed the task to be synchronus and activated the step executed outcome in workflow.
However I had a reason why I actually used the asynchronus task - Actually before UWL, we were using business workplace and if I use asynchronus task, as soon as I execute the workitem, the webdynpro application opens up and without the user taking any action on the workitem, the workitem status is set to complete and the workitem is deleted from the inbox. I overcame this by making the task asynchronus and putting a terminating event in the task.
Now in UWL, the workitem is not being delted even after making the task synchronus - can anyone throw some thoughts on this behavior of the workflow.