Get runtime workitem ID

Kjetil Kilhavn kjetilk at statoil.com
Wed Jan 5 03:23:27 EST 2005


I think the message below contains the answer to your question. I used it
myself to find out if a method is called from a work item

* 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    = 2.
IF syst-subrc = 0.
  LOOP AT t_requester
       ASSIGNING <requester>
       WHERE objtype = 'WORKITEM'.
    l_workitem = <requester>-objkey.
  ENDLOOP.
ENDIF.
--
Kjetil Kilhavn

----- Forwarded by Kjetil Kilhavn on 05.01.2005 09:19 -----
                                                                                                                                                     
                    Michael Pokraka                                                                                                                  
                    <workflow at quirky.me.        To:     SAP-WUG at MITVMA.MIT.EDU                                                                       
                    uk>                         cc:     (bcc: Kjetil Kilhavn)                                                                        
                    Sent by: SAP                Subject:     Re: Can an attribute know it's calling workflow?                                        
                    Workflow                                                                                                                         
                    <Owner-SAP-WUG at MITVM                                                                                                             
                    A.MIT.EDU>                                                                                                                       
                                                                                                                                                     
                                                                                                                                                     
                    27.08.2004 16:47                                                                                                                 
                    Please respond to                                                                                                                
                    "SAP Workflow Users'                                                                                                             
                    Group"                                                                                                                           
                                                                                                                                                     
                                                                                                                                                     




Hi Alon/Darrell,
Interesting, these were the sort of hacks I was hoping for, but alas don't
play nicely in an attribute. I also found SWO_QUERY_REQUESTER, which - like
SWE_WI_GET_FROM_REQUESTER - gets its info from memory (under different
id's).
However the swo_%invoke at least told me why it won't work: The requester
in
the case of an attribute is the object itself, which kinda makes sense.
(Unless I'm missing something?). Argh, so close and yet so far.

Interestingly enough, the attribute gets invoked twice during the running
of
the workflow (once at startup, and once at container operation), so that
counters any performance hit I was trying to avoid. This is a bit of a
performance-intensive bit of code. I thought attributes were only evaluated
on an as-needed basis...? Oh, well.. method it is.

Thanks both for your input, it's fun to go digging around the internals on
occasion, but now Friday becons and I am getting too thirsty for this.

Cheers & happy weekend.
Mike

Heath, Darrell L. wrote:
> Alon's suggestion is probably best but I have referred to SWO_%INVOKE to
> get the requestor, then read the workitem (I know, it's not WAPI way
> ...).
>
>   requester = swo_%invoke-requester.
>   workitemid =  requester-objkey.
>
>   call function 'SWL_WI_READ'
>        exporting
>             wi_id         = workitemid
>         :
>         :
>
> Good luck, I know I had fun working on this one!
> Darrell
>
> -----Original Message-----
> From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU] On Behalf Of
> Alon Raskin
> Sent: Friday, August 27, 2004 8:41 AM
> To: SAP-WUG at MITVMA.MIT.EDU
> Subject: Re: Can an attribute know it's calling workflow?
>
> try this FM SWE_WI_GET_FROM_REQUESTER
>
> I have never tried it from an attribute but definitely works in methods.
>
> Let us know how you get on.
>
> Alon
> -----Original message-----
> From: Michael Pokraka workflow at quirky.me.uk
> Date: Fri, 27 Aug 2004 23:35:04 +1000
> To: SAP-WUG at MITVMA.MIT.EDU
> Subject: Can an attribute know it's calling workflow?
>
>
>  > Greetings all ye knowledgeable people,
>>
>> Simple one: Can an attribute somehow find out which workflow (if any)
> is
>> calling it?
>> There's nothing obvious I can find, so I don't hold much hope but
> perhaps
>> someone has a sneaky workaround?
>>
>> I know, easy to do in a method and I'll probably end up doing that,
> but a> n
>> attribute would be a bit neater for various reasons.
>>
>> Cheers
>> Mike
>
>



                                                                                                                                                   
                    "Caillet, Eric"                                                                                                                
                    <Eric.Caillet at LOGI        To:     "'SAP-WUG at MITVMA.MIT.EDU'" <SAP-WUG at MITVMA.MIT.EDU>                                          
                    CACMG.COM>                cc:     (bcc: Kjetil Kilhavn)                                                                        
                    Sent by:                  Subject:     Get runtime workitem ID                                                                 
                    sap-wug-bounces at mi                                                                                                             
                    t.edu                                                                                                                          
                                                                                                                                                   
                                                                                                                                                   
                    04.01.2005 17:57                                                                                                               
                    Please respond to                                                                                                              
                    "SAP Workflow                                                                                                                  
                    Users' Group"                                                                                                                  
                                                                                                                                                   
                                                                                                                                                   




Hi all,

i need to get the runtime workitem ID in my task because i want to save it
in customer table but i don't know how do get this.

Thanks
Eric

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
_______________________________________________
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.



More information about the SAP-WUG mailing list