Skip to Content
author's profile photo Former Member
Former Member

Get Workitem container data in ABAP OO

Hello!

I have some problem in workflow by using ABAP OO.

I have a class whith method display in current workitem.

In this method how can get container data like wiid etc.?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jul 07, 2008 at 12:49 PM

    Hello Paul,

    to pass container elements from the task to the object method, you first create new importing parameters in the class method's definition, e.g. i_WI_ID (importing, type SWWWHEAD-WI_ID).

    When you're back at the task definition, you'll create a binding on the method call (there's a button for this next to the method's name). All importing/exporting parameters will appear here. As the source for the importing parameter i_WI_ID you choose &_WORKITEM.WORKITEMID& (the element _WorkItem refers to the current workflow step itself).

    The same thing applies for any other container element that you'll need.

    It's not a good idea to bypass this designed functionality, by looking for the work item-ID via a backdoor to retrieve the container from there, as it's not obvious anymore, what a method needs in order to function correctly. This is a "Don't".

    Best wishes,

    Florin

    Add a comment
    10|10000 characters needed characters exceeded

    • In this case you could only use, what's either available in the work item container or what the business object (here: WORKITEM) provides.

      As you need a whole bunch of information, it will be best to read it from the database within the .Display-Method, but I would suggest, that you use the structure/table SWWWIHEAD (which is mostly similar to SWWLHEAD structure).

      You'd do it this way:

      METHOD Display.
         DATA: l_workitem_header     TYPE swwwihead.
         SELECT SINGLE * FROM swwwihead
                         INTO l_workitem_header
                         WHERE wi_id = i_wi_id.
         IF sy-subrc <> 0.
            "Something is wrong here, as the work item is not valid
            "... do some exception handling there or end method with message,
            "such as MESSAGE S....
            EXIT.
         ENDIF.
         "... Detailed data of current workitem is now
         "... in struct l_workitem_header
      ENDMETHOD.

  • author's profile photo Former Member
    Former Member
    Posted on Jul 07, 2008 at 11:06 AM

    Hi,

    Just give the wi_id (or whatever you need from the container) as an input parameter for the method. Or did I misunderstood something obvious?

    Regards,

    Karri

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 07, 2008 at 11:02 AM

    Hi ,

    try

    WI_ID TYPE SWW_WIID,

    Declare your type which includes and then declare itable of it.

    use worklist like SWR_WIHDR,

    in your declaration fetch value in it and to proces uae itable.

    To retrive value in worklist use Functn:-->'SAP_WAPI_WORKITEMS_TO_OBJECT'.

    Hope It Will be useful to you.

    Thx.

    Regards,

    Purvesh Patel.

    Worklflow Admin,

    ADANI GROUP.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 07, 2008 at 11:09 AM

    You can use standard FM like SAP_WAPI_READ_CONTAINER

    Thanks

    Arghadip

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.