Skip to Content
-1

Issue with SAP_WAPI_FORWARD_WORKITEM in sap workflow

Jun 12, 2017 at 09:45 AM

113

avatar image
Hi Exprets,
I am using function module SAP_WAPI_FORWARD_WORKITEM to forward a work item from one user to another. I am getting return code as 2 . please let me know if I am missing any thing

SELECT wi_id wi_type wi_stat
FROM swwwihead
INTO TABLE i_wi_head
WHERE wi_id IN s_wi_id.

IF sy-subrc IS INITIAL.

v_oldus = p_oldus.
v_newus = p_newus.

* Forward the work item to the requred user
LOOP AT i_wi_head INTO w_wi_head.
CALL FUNCTION 'SAP_WAPI_FORWARD_WORKITEM'
EXPORTING
workitem_id = w_wi_head-wi_id
user_id = v_newus
language = sy-langu
do_commit = 'X'
current_user = v_oldus
IMPORTING
return_code = v_return
new_status = v_status.
v_oldus is the user id pf work item sender and v_newus is the id of the workitem receiver.
thanks,
rg
10 |10000 characters needed characters left characters exceeded

Please use appropriate formatting when posting plain text.

As you previously posted this question all in plain text, and now again all in code format, it seems to me you are not familiar with formatting. Here's how it works:

Select a piece of text by clicking and dragging the mouse over it. Then click one of the format buttons above.

e.g. I selected this line and clicked "B" for bold.

And if you have a piece of code, select the code and click the "code" button to format only the code. Remember to select only the code, not the text above or below. I have done this with the below piece of code.

data(today) = sy-datum.
data(next_week) = today + 7. while today < next_week. wait up to 1 day. today = day + 1. endwhile.

It makes it much easier to read what is code and what is information. It is also considered polite to make your question easy to read and understand, and provides more incentive for people to read your post.

0
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Anand Sagar Sethi Jun 12, 2017 at 01:24 PM
1

Here is a snap shot of how to do..

first of all make sure your work item is correct.. to be sure about work item, go in to swi1 and pick the ID whose work item type is dialog step. (SWI1 screen shote )

go to Se37

type the FM SAP_WAPI_FORWARD_WORKITEM

in User ID table fill it as below

and execute.

Results in Message lines:

Enjoy!

I think now you know very well how to write the same in the code

Anand


capture.jpg (22.2 kB)
capture.jpg (52.4 kB)
capture.jpg (29.3 kB)
capture.jpg (69.2 kB)
capture.jpg (41.1 kB)
Share
10 |10000 characters needed characters left characters exceeded
Suman Pradhan Jun 12, 2017 at 11:00 AM
0

Hi Ramya,

PFB the description for the return codes. You can read the table message_lines to get info about the workitem.

2 Work item cannot be forwarded.

3 No agents for forwarding specified during call

900 System error: method must not be used in the current context

999 An unknown error occurred.

Alternatively you can use the FM "SAP_WAPI_AGENTS_CHANGE".It also forwards the work item .

Share
10 |10000 characters needed characters left characters exceeded
Anjan Paul Jun 12, 2017 at 12:40 PM
0

Hi,

Please check the workitem status , is it in Ready status or not.

Return code 2 means, its can not be forwarded

Show 1 Share
10 |10000 characters needed characters left characters exceeded

thanks for your reply yes you are correct the user id does not exist.. how to check if the work item can be forwarded to otehr userr in test mode.

rg

0