An idea on how to attack back at 'runaway' general tasks
Tedde Taege
ttaege at nebraska.edu
Tue May 10 12:01:43 EDT 2005
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.
Michael Pokraka <wug.replies at workflowconnections.com>
05/10/2005 08:44 AM
Indeed, it's the quiet ones that you've got to watch out for!
Just thought I might throw in another variation of the same theme: The
same
check on RH_WI_AGENTS_GET can also be done if the client happens to run a
custom RSWUWFML. Neither method is foolproof as they rely on nobody
reserving
the item in between runs/logons, but having used the RSWUWFML it seemed to
catch most of them.
Cheers
Mike
--- Mark Pyc <mark.pyc at gmail.com> wrote:
G'day Tedde,
This is a new one on me! How many more tricks do you have up your sleeve?
The usage I liked was where in log-on exit you check if a user has
newWorkitems and if so redirect them to the business workplace as
theirstart
transaction. This is much nicer than setting the businessworkplace as the
standard log in transaction statically as it only applies to those who
have
work to do.
Same exit I presume? How do you set the business workplace as the first
screen?
Have fun,Mark
On 5/9/05, Tedde Taege <ttaege at nebraska.edu> wrote:
At the urging of workflow gurus Mark P. & Mike P., I am posting an idea
that was included in my presentation at ASUG.
I have been burnt by general tasks that get sent into everyone's workflow>
inbox. Here is a way that lowers the exposure from a runaway general task
by checking for general tasks as each user logs into the system.
In user exit EXIT_SAPLSUSF_001 - ZXUSRU01 (function group XUSR) which
executes at user login:
• Retrieve work list for user (function SWR_WL_CREATE)
• Check agents assigned for work items (function RH_WI_AGENTS_GET)
• Reserve general task work items to a specific ID (i.e. workflow>
administrator) (function SAP_WAPI_RESERVE_WORKITEM)
• Upon a successful reservation, notify workflow administration
about the work item
Use caution with this exit because if you mess up here, then your users
might not able to log into the system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20050510/f4dbc8a6/attachment.htm
More information about the SAP-WUG
mailing list