AW: AW: Getting current agent (name) from workflow work item

Sample, Rick Rick.Sample at graybar.com
Tue Jan 26 17:17:13 EST 2010


Was just ready to hit reply with that same line of info! 

Yes, need to know "which" task to get agent. No canned FM is going to
decide that for you. 
Fork A or Fork B...?

I would suggest adding a ZLAST_AGAENT container in the WF Template.
Stuff it 
with <whatever UID> on the return from task W/Actual Agent. Will always
be one! 
And would need a TABLE container for all the possible ZCURRENT_AGENT. 

Or just grab ONE of the agents per below and send to the template.
ZCURRENT_AGENT.

In at least one WF I have, it was easier to just create a container
(table type) and 
stuff it (append) with ZLAST_AGENT after every task for a log. This was
an approval WF so 
helped with WF Admin type to quickly view list in order. 



Rick Sample | Office (314) 573-5822 | Mobile (314) 952-2273 |
rick.sample at graybar.com
www.graybar.com - Graybar Works to Your Advantage


-----Original Message-----
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Paul.Bakker at osr.treasury.qld.gov.au
Sent: Tuesday, January 26, 2010 4:00 PM
To: SAP Workflow Users' Group
Subject: RE: AW: AW: Getting current agent (name) from workflow work
item

Sunni,

I think there's a problem with your concept of 'last workitem'.

A workflow can, of course, have multiple dialog workitems active at once
(e.g. in parallel branches).
Which one would you then want the details of?

cheers
Paul



 

             Shoaib Mirza

             <shoaib_mirza at hot

             mail.com>
To 
             Sent by:                  <sap-wug at mit.edu>

             sap-wug-bounces at m
cc 
             it.edu

 
Subject 
                                       RE: AW: AW: Getting current agent

             27/01/2010 07:37          (name) from workflow work item

             AM

 

 

             Please respond to

               "SAP Workflow

               Users' Group"

             <sap-wug at mit.edu>

 

 






Hi

This doesn't seem to work, or are we missing something in the code.
This gives the details of the top level workflow item.  I can not see
the
latest work item being processed in the workflow.

Any ideas how to get this information?

Thanks
Sunni

From: Benjamin.Koeb at comlineag.de
To: sap-wug at mit.edu
Date: Tue, 26 Jan 2010 20:22:00 +0100
Subject: AW: AW: Getting current agent (name) from workflow work item

Hi Sunni,

that's no problem, if you have the 'top' workitem, just select swwwihead
with 'where'-clause:  WI_CHCKWI = your_top_wi_id
Try this select statement:
  SELECT SINGLE * FROM SWWWIHEAD into wa_SWWWIHEAD
    WHERE WI_CHCKWI = lv_top_wi_id
    AND wi_type = 'W'
    AND ( WI_STAT = 'READY' or WI_STAT = 'STARTED' ).
You should get the actual workitem, with this information you can call
the
function module.

Hope that helps...

Benny

Von: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] Im Auftrag
von Shoaib Mirza
Gesendet: Dienstag, 26. Januar 2010 18:17
An: sap-wug at mit.edu
Betreff: RE: AW: Getting current agent (name) from workflow work item

Hi

Thanks for that, but my issue is that I don't have the work item id of
the
current task.  I only have the 'top' work item id of the workflow.  That
does not have any agents.

So I need to go down the workflow to the final workitem and get the
agents
from that.  (Maybe then I can use the function below to get the agents)

Any ideas how I can do that.

Kind Regards
Sunni




From: Benjamin.Koeb at comlineag.de
To: sap-wug at mit.edu
Date: Tue, 26 Jan 2010 17:51:09 +0100
Subject: AW: Getting current agent (name) from workflow work item
Hi Sunni,

you can read the actual (Workitem status = started) agent from table
SWWWIHEAD-WI_AAGENT with key = WI_ID. This works fine for workitems with
status = started, if the status = ready the field wi_aagent is empty!
For
workitems with status ready, try to use function module
SAP_WAPI_WORKITEM_RECIPIENTS:

CALL FUNCTION 'SAP_WAPI_WORKITEM_RECIPIENTS'
        EXPORTING
          workitem_id                = lv_wi_id
        tables
          recipients                 = it_recipients.

That's my way, maybe there are better ones?

Regards,

Benny

Von: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] Im Auftrag
von Shoaib Mirza
Gesendet: Dienstag, 26. Januar 2010 17:37
An: sap-wug at mit.edu
Betreff: Getting current agent (name) from workflow work item

Hi

Please can you let me know how I would go about getting the current
agent
of a workflow from the workitem id of the workflow.  I looked for a wapi
but could not find one suitable.

Kindest Regards
Sunni





More information about the SAP-WUG mailing list