<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
&nbsp;<BR>
Hi Paul<BR>
&nbsp;<BR>
Thanks for&nbsp;your reply,&nbsp;you're right and I've just realised that this workflow does have subworkflows!!<BR>
&nbsp;<BR>
---------<BR>
So Im thinking.<BR>
&nbsp;<BR>
I take the top workitem that I have,&nbsp;<BR>
select from table swwwihead to&nbsp;find the child workitems of type F, (there seem to be just two subworkflows started here always)<BR>
save these as the new 'top' work items in an internal table<BR>
&nbsp;<BR>
select from swwwihead again for the first of the new work items (the new top work item)<BR>
take the last entry of the list output type 'W' to represent the last dialog work item<BR>
save this workitem nr<BR>
&nbsp;<BR>
repeat the above&nbsp;step for the next 'top' work item of the parallel branch for the other subworkflow, and save this work item nr<BR>
&nbsp;<BR>
run the below function module 'SAP_WAPI_WORKITEM_RECIPIENTS' to get the user/s for each derived work item<BR>
------------------<BR>
&nbsp;<BR>
I would have to repeat this for potentially hundreds of line items just before an alv list is output.<BR>
&nbsp;<BR>
Is there a better way?<BR>
&nbsp;<BR>
Best Regards<BR>
Sunni<BR>
&nbsp;<BR>
&nbsp;<BR>&nbsp;<BR>&gt; Subject: RE: AW: AW: Getting current agent (name) from workflow work item<BR>&gt; To: sap-wug@mit.edu<BR>&gt; From: Paul.Bakker@osr.treasury.qld.gov.au<BR>&gt; Date: Wed, 27 Jan 2010 07:59:37 +1000<BR>&gt; <BR>&gt; Sunni,<BR>&gt; <BR>&gt; I think there's a problem with your concept of 'last workitem'.<BR>&gt; <BR>&gt; A workflow can, of course, have multiple dialog workitems active at once<BR>&gt; (e.g. in parallel branches).<BR>&gt; Which one would you then want the details of?<BR>&gt; <BR>&gt; cheers<BR>&gt; Paul<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; Shoaib Mirza <BR>&gt; &lt;shoaib_mirza@hot <BR>&gt; mail.com&gt; To <BR>&gt; Sent by: &lt;sap-wug@mit.edu&gt; <BR>&gt; sap-wug-bounces@m cc <BR>&gt; it.edu <BR>&gt; Subject <BR>&gt; RE: AW: AW: Getting current agent <BR>&gt; 27/01/2010 07:37 (name) from workflow work item <BR>&gt; AM <BR>&gt; <BR>&gt; <BR>&gt; Please respond to <BR>&gt; "SAP Workflow <BR>&gt; Users' Group" <BR>&gt; &lt;sap-wug@mit.edu&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; Hi<BR>&gt; <BR>&gt; This doesn't seem to work, or are we missing something in the code.<BR>&gt; This gives the details of the top level workflow item. I can not see the<BR>&gt; latest work item being processed in the workflow.<BR>&gt; <BR>&gt; Any ideas how to get this information?<BR>&gt; <BR>&gt; Thanks<BR>&gt; Sunni<BR>&gt; <BR>&gt; From: Benjamin.Koeb@comlineag.de<BR>&gt; To: sap-wug@mit.edu<BR>&gt; Date: Tue, 26 Jan 2010 20:22:00 +0100<BR>&gt; Subject: AW: AW: Getting current agent (name) from workflow work item<BR>&gt; <BR>&gt; Hi Sunni,<BR>&gt; <BR>&gt; that’s no problem, if you have the ‘top’ workitem, just select swwwihead<BR>&gt; with ‘where’-clause: WI_CHCKWI = your_top_wi_id<BR>&gt; Try this select statement:<BR>&gt; SELECT SINGLE * FROM SWWWIHEAD into wa_SWWWIHEAD<BR>&gt; WHERE WI_CHCKWI = lv_top_wi_id<BR>&gt; AND wi_type = 'W'<BR>&gt; AND ( WI_STAT = 'READY' or WI_STAT = 'STARTED' ).<BR>&gt; You should get the actual workitem, with this information you can call the<BR>&gt; function module.<BR>&gt; <BR>&gt; Hope that helps…<BR>&gt; <BR>&gt; Benny<BR>&gt; <BR>&gt; Von: sap-wug-bounces@mit.edu [mailto:sap-wug-bounces@mit.edu] Im Auftrag<BR>&gt; von Shoaib Mirza<BR>&gt; Gesendet: Dienstag, 26. Januar 2010 18:17<BR>&gt; An: sap-wug@mit.edu<BR>&gt; Betreff: RE: AW: Getting current agent (name) from workflow work item<BR>&gt; <BR>&gt; Hi<BR>&gt; <BR>&gt; Thanks for that, but my issue is that I don't have the work item id of the<BR>&gt; current task. I only have the 'top' work item id of the workflow. That<BR>&gt; does not have any agents.<BR>&gt; <BR>&gt; So I need to go down the workflow to the final workitem and get the agents<BR>&gt; from that. (Maybe then I can use the function below to get the agents)<BR>&gt; <BR>&gt; Any ideas how I can do that.<BR>&gt; <BR>&gt; Kind Regards<BR>&gt; Sunni<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; From: Benjamin.Koeb@comlineag.de<BR>&gt; To: sap-wug@mit.edu<BR>&gt; Date: Tue, 26 Jan 2010 17:51:09 +0100<BR>&gt; Subject: AW: Getting current agent (name) from workflow work item<BR>&gt; Hi Sunni,<BR>&gt; <BR>&gt; you can read the actual (Workitem status = started) agent from table<BR>&gt; SWWWIHEAD-WI_AAGENT with key = WI_ID. This works fine for workitems with<BR>&gt; status = started, if the status = ready the field wi_aagent is empty! For<BR>&gt; workitems with status ready, try to use function module<BR>&gt; SAP_WAPI_WORKITEM_RECIPIENTS:<BR>&gt; <BR>&gt; CALL FUNCTION 'SAP_WAPI_WORKITEM_RECIPIENTS'<BR>&gt; EXPORTING<BR>&gt; workitem_id = lv_wi_id<BR>&gt; tables<BR>&gt; recipients = it_recipients.<BR>&gt; <BR>&gt; That’s my way, maybe there are better ones?<BR>&gt; <BR>&gt; Regards,<BR>&gt; <BR>&gt; Benny<BR>&gt; <BR>&gt; Von: sap-wug-bounces@mit.edu [mailto:sap-wug-bounces@mit.edu] Im Auftrag<BR>&gt; von Shoaib Mirza<BR>&gt; Gesendet: Dienstag, 26. Januar 2010 17:37<BR>&gt; An: sap-wug@mit.edu<BR>&gt; Betreff: Getting current agent (name) from workflow work item<BR>&gt; <BR>&gt; Hi<BR>&gt; <BR>&gt; Please can you let me know how I would go about getting the current agent<BR>&gt; of a workflow from the workitem id of the workflow. I looked for a wapi<BR>&gt; but could not find one suitable.<BR>&gt; <BR>&gt; Kindest Regards<BR>&gt; Sunni<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; Do you have a story that started on Hotmail? Tell us now<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; Got a cool Hotmail story? Tell us now<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; Not got a Hotmail account? Sign-up now - Free<BR>&gt; _______________________________________________<BR>&gt; SAP-WUG mailing list<BR>&gt; SAP-WUG@mit.edu<BR>&gt; http://mailman.mit.edu/mailman/listinfo/sap-wug<BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; ******************************************************************************************************************************************************<BR>&gt; <BR>&gt; Only an individual or entity who is intended to be a recipient of this e-mail may access or use the information contained in this e-mail or any of its attachments. Opinions contained in this e-mail or any of its attachments do not necessarily reflect the opinions of Queensland Treasury.<BR>&gt; <BR>&gt; The contents of this e-mail and any attachments are confidential and may be legally privileged and the subject of copyright. If you have received this e-mail in error, please notify Queensland Treasury immediately and erase all copies of the e-mail and the attachments. Queensland Treasury uses virus scanning software. However, it is not liable for viruses present in this e-mail or in any attachment. <BR>&gt; <BR>&gt; ******************************************************************************************************************************************************<BR>&gt; <BR>&gt; <BR>&gt; _______________________________________________<BR>&gt; SAP-WUG mailing list<BR>&gt; SAP-WUG@mit.edu<BR>&gt; http://mailman.mit.edu/mailman/listinfo/sap-wug<BR>                                               <br /><hr />Got a cool Hotmail story? <a href='http://clk.atdmt.com/UKM/go/195013117/direct/01/' target='_new'>Tell us now</a></body>
</html>