Object attachments
Kjetil Kilhavn
KJETILK at statoil.com
Tue Sep 12 02:28:30 EDT 2006
Sorry I haven't replied earlier, it's been busy (still is... but sometimes a coder needs a break!)
To get the work item ID, you can use the following code (at least in 4.6C):
* Started from work item?
DATA: t_requester TYPE STANDARD TABLE OF swotobjid,
l_workitem TYPE swwwihead-wi_id.
FIELD-SYMBOLS: <requester> LIKE LINE OF t_requester.
CALL FUNCTION 'SWO_QUERY_REQUESTER'
TABLES
requester = t_requester
EXCEPTIONS
not_found = 1
OTHERS = 99.
IF syst-subrc = 0.
LOOP AT t_requester
ASSIGNING <requester>
WHERE objtype = 'WORKITEM'.
l_workitem = <requester>-objkey.
ENDLOOP.
ENDIF.
I use this when I want to determine if a method is being executed from a workitem or in some other way (typically to test a method), but you should be able to then either look the task up directly in SWWWIHEAD (this is of course NOT recommended) or by using a WAPI method or the object type workitem (... actually not). If you just want the task type the WAPI function SAP_WAPI_GET_HEADER is probably your easiest solution. There you get SWR_WIHDR-WI_RH_TASK which answers your question.
The problem with the other suggested solution (binding) may be that the binding occurs before the work item has been formed (committed to the database). I had that problem when I wanted to set a latest end deadline depending on work item creation time.
--
Kjetil Kilhavn, Statoil OFT GBS BAS DEV SAP
________________________________
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf Of Márton Zsolt
Sent: 11. september 2006 10:47
To: SAP Workflow Users' Group
Subject: Object attachments
Hi Teage,
I made those connections (import parameter in my custom method, binding in the standard task, etc) but I still can't get the task id, if I use my method as a default method for my business object.
Double clicking on the attachment, the mentioned container element is not filled. I can't get any information about the task container.
What I'm doing wrong?
Thanks, zsolt
________________________________
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf Of Tedde Taege
Sent: Friday, September 08, 2006 4:55 PM
To: SAP Workflow Users' Group
Subject: RE: Object attachments in a decision step
Inside of your workflow, you should have the element _Workitem. The _Workitem element is a business object of type flowitem. It has a wealth of information. To access it inside of your task, you need to bind it from the workflow into the standard task... The import parameter of business object method must be set up to accept the attribute from the standard task. You will need to create an import parameter of type business object Flowitem.
After you make these connections, then you should be able to get object inside of your method from the task container, instantiate it, and access its attributes.
-------------------------------------------------------------------------------------
Tedde Taege
University of Nebraska Computing Services Network
SAP Development 402 472-7544
Márton Zsolt <Zsolt.Marton at t-systems.co.hu>
Sent by: sap-wug-bounces at mit.edu
09/08/2006 09:43 AM
Please respond to
"SAP Workflow Users' Group" <sap-wug at mit.edu>
To
"SAP Workflow Users' Group" <sap-wug at mit.edu>
cc
Subject
RE: Object attachments in a decision step
Hi all,
We are in 5.0.
I'm using a custom method as a default method for a business object. I have to use the workflow id (or the task id ) in my method. Is this possible, to get this information (WS.....) ?
I tried the following abap code
swc_get_element container '_Workitem' workingwi.
swc_get_property workingwi 'WorkitemTask' task.
but, the task is empty.
Thanks
Zsolt
_______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu
http://mailman.mit.edu/mailman/listinfo/sap-wug
-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20060912/d8409118/attachment.htm
More information about the SAP-WUG
mailing list