cancel
Showing results for 
Search instead for 
Did you mean: 

How to use SAP_WAPI_WORKITEM_COMPLETE

Former Member
0 Kudos

Hello workflow gurus,

I have a little problem with my workflow. In first task i start an abap class which calls my abap program. This program starts a webserivce which is validating some data of the workflow container. After using the program i want to go to the next task/workitem. In the moment the workitem is still incomplete after finishing my program. So i have to trigger an event which completes the actual workitem an triggers the next one. I thought of using 'SAP_WAPI_WORKITEM_COMPLETE'. Is this right?

Here is the code of the FM.

CALL FUNCTION 'SAP_WAPI_WORKITEM_COMPLETE'

EXPORTING

workitem_id =

  • ACTUAL_AGENT = SY-UNAME

  • LANGUAGE = SY-LANGU.

  • SET_OBSOLET = ' '

  • DO_COMMIT = 'X'

  • DO_CALLBACK_IN_BACKGROUND = 'X'

  • IFS_XML_CONTAINER =

IMPORTING

  • RETURN_CODE =

  • NEW_STATUS =

  • TABLES

  • SIMPLE_CONTAINER =

  • MESSAGE_LINES =

  • MESSAGE_STRUCT =

Which of the parameters i have to fill and what data i have to use for? What shall i set for the workitem_ID?

Please help me.

Many greeting

Sebastian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sebastin,

Main purpose of the FM to complete Workitem in portal(Example only).

Workitem id is mandatory.

Basic system information is needed for this fm,

Thanks and Regards,

Ragavendran

Former Member
0 Kudos

Thank you!

What basic system information do you need? I will give them to you.

Where do i get the workitem id. And how to get them in my abap class which calls my report?

Former Member
0 Kudos

Hi,

You can use this FM SAP_WAPI_WORKITEMS_TO_OBJECT to find work items for your object key...

Search this forum for sample code if you find it difficult to write code using this...

Regards

Gautam

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

One additional hint: If you are able to call the function properly and it seems to return a success message, but still it doesn't get status COMPLETED, it doesn't mean that the function is not working or your code is bad. It seems that sometimes you need to call this function two times in a row in order to change the status to completed.

Regards,

Karri

bpawanchand
Active Contributor
0 Kudos

Hi,

As you have mentioned that the work item opens a web service. What I would suggest is that instead of completing task by using SAP_WAPI_WORKITEM_COMPLETE try to create a task of the web service you said by using transaction WF_EXTSRV.. once you created a task use this task in the worklfow by replacing the current dialog work item. and by using SAP_WAPI_CREATE_EVENT try to raise event of BOR WEBSERVICE event COMPLETE. for this also you need to pass the work item ID .

Otherwise what I would suggest with your current workflow design is try to create a parameter as work item Id and import this work item Id into the application and pass this to the function module which you want to use SAP_WAPI_WORKITEM_COMPLETE.

Also populate the container elements to the task container based on its value you can decide whether it is approved or rejected.

Regards

Pavan