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