An idea on how to attack back at 'runaway' general tasks
Michael Pokraka
wug.replies at workflowconnections.com
Tue May 10 13:05:54 EDT 2005
Ah, no apologies necessary, that was a joke in reply to Mark's 'tricks up your
sleeve' comment!
Your contribution is much appreciated, and I'm with Mark on that one that even
old muppets can learn new tricks :-)
Cheers
Mike
--- Tedde Taege <ttaege at nebraska.edu> wrote:
> Good to hear from the experts! Accept my apology for misinterpreting your
> request.
>
> The redirect that Mark was interested in happens after the login user has
> been determined to have valid work items.
> At that point, we call transaction SO01. Sample code shown below.
>
> DATA: wi_tab LIKE swwwlhead OCCURS 0 WITH HEADER LINE.
> DATA: wl_user_tab LIKE swhactor OCCURS 0 WITH HEADER LINE.
> DATA: lcount TYPE i.
> DATA: wl_subrc TYPE sysubrc.
>
> CALL FUNCTION 'SWR_WL_CREATE' "get user's worklist
> EXPORTING
> language = sy-langu "system language
> user = sy-uname "user logged on
> TABLES
> worklist = wi_tab
> EXCEPTIONS
> orginfo_not_found = 1
> OTHERS = 2
> .
> LOOP AT wi_tab.
> * check for runaway WIs - general tasks w/ no agent assigned
> CALL FUNCTION 'RH_WI_AGENTS_GET' "get agents for work items
> EXPORTING
> act_wi_id = wi_tab-wi_id
> TABLES
> wi_agent_list = wl_user_tab
> EXCEPTIONS
> no_active_plvar = 1
> no_agent_found = 2
> general_task = 3
> background_task = 4
> OTHERS = 5.
>
> IF sy-subrc = 3. "no specific agent(s) found
> * runaway WIs need to be reserved by someone
> * Reserve WI to static user ID until alternative found
> DATA: wl_agent TYPE sy-uname VALUE 'JOHNDOE'.
> CALL FUNCTION 'SAP_WAPI_RESERVE_WORKITEM'
> EXPORTING
> workitem_id = wi_tab-wi_id
> actual_agent = wl_agent
> do_commit = 'X'
> IMPORTING
> return_code = wl_subrc
> .
> * Remove the General Task WI from logon user's list
> DELETE wi_tab INDEX sy-tabix.
>
> ***** NOTIFY WF ADMINISTRATORS OF WI *****
> IF wl_subrc = 0. "WI was successfully reserved
> <<<insert some kind of e-mail communicaton process here>>>
> ENDIF.
> ENDIF.
> ENDLOOP.
>
> DESCRIBE TABLE wi_tab LINES lcount.
> * Only process transaction when workitems are present
> IF lcount > 0.
> * shows SAP Office Inbox
> CALL TRANSACTION 'SO01'.
> ENDIF.
>
>
>
More information about the SAP-WUG
mailing list