Skip to Content
avatar image
Former Member

Function module for table SWWWIHEAD

Hello,

I want to use the table SWWWIHEAD (2 times in my program).

The requirment is :

select data (ie WI_CHCKWI,higher level item)

from SWWWIHEAD

where WI_RH_TASK = 'TS90000007' &

WI_STAT = u2018COMPLETEDu2019 &

WI_AED = date entered on selection screen

select data

from SWWWIHEAD

where WI_CHCKWI = WI_CHCKWI-found from above select query.

Please help me with the function module, so that there will not be any performance issues in future.

Thanks in Advance

Regards,

Darshana

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Sep 20, 2010 at 10:32 AM

    1

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      i don't think so there is a FM for the logic you have given, FYI you can check on this SWW_WI* in se37 ,

      if u havent checked. If you find any FM Please do share with us , as iam developing a report on workflow

  • avatar image
    Former Member
    Sep 20, 2010 at 12:37 PM

    If your requirement is to get details of only Superordinate Work Item if it exists, may be after the following select statement you can delete entries from internal table.

    select data into table IT_TAB

    from SWWWIHEAD

    where WI_RH_TASK = 'TS90000007' &

    WI_STAT = u2018COMPLETEDu2019 &

    WI_AED = date entered on selection screen

    Delete it_tab where WI_CHCKWI IS INITIAL. Will it help you?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 20, 2010 at 12:44 PM

    Use

    SAP_WAPI_WORKITEMS_TO_OBJECT

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 21, 2010 at 01:13 PM

    Hi,

    Instead of two select query, just get all the required data in an internal table IT_SWWIHEAD and copied that to a another temporary table IT_TEMP.You can process your logic with the new internal table IT_TEMP. At last instead of second select query you can go and pick the value from main internal table IT_SWWIHEAD.

    Just play with internal table instead of repeated select query

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 21, 2010 at 02:38 PM

    Hello,

    Please, analyse the program RSWUWFML2, find a perform statement select_workitems. In my system it is line 623.

    This program is very efficient as it reads this table to send notifications on e-mail about new work items in users' inboxes.

    Here is the code.

    FORM select_workitems.
    
    * Select those workitems with the correct task, state and creation
    * date and time.
    
    ************************************************************************
    * The select statement encourages one of the database indices          *
    * to be used. Either the task index or the status/type index.          *
    * Tests show that this really does influence the database access       *
    * positively.                                                          *
    * This algorithm will be inefficient when tasks are excluded rather    *
    * than included.                                                       *
    * The combination 'Waiting' and Notification/deadline type             *
    * cannot occur.                                                        *
    ************************************************************************
      IF task_sel[] IS INITIAL.            "No tasks
    *   Use the type/status index.
    
        SELECT wi_id tclass
          INTO CORRESPONDING FIELDS OF TABLE lt_wi_data
          FROM swwwihead
          WHERE
             wi_type = wi_normal       AND
             wi_stat = wi_status_ready AND
             retry_cnt = '0'           AND
    *        note 969538:
             crea_tmp > l_from_tstamp  AND
             crea_tmp <= l_to_tstamp.
    
        SELECT wi_id tclass
          APPENDING CORRESPONDING FIELDS OF TABLE lt_wi_data
          FROM swwwihead
          WHERE
             wi_type = wi_deadline     AND
             wi_stat = wi_status_ready AND
             retry_cnt = '0'           AND
    *        note 969538:
             crea_tmp > l_from_tstamp  AND
             crea_tmp <= l_to_tstamp
    *     note 0000790920
          %_hints
          oracle 'INDEX("&TABLE&" "SWWWIHEAD~C" "SWWWIHEAD^C" "SWWWIHEAD_C" "SWWWIHEAD_C__X")'
          DB2    'USE VALUES FOR OPTIMIZATION'
          DB2    '&SUBSTITUTE VALUES&'. "#EC CI_HINTS
    
    *   no longer select waiting work items
    
      ELSE.
    *   Use the task index.
        SELECT wi_id tclass
          INTO CORRESPONDING FIELDS OF TABLE lt_wi_data
          FROM swwwihead
          WHERE
            wi_rh_task IN task_sel AND
            wi_stat = wi_status_ready AND
            wi_type = wi_normal       AND
    *       note 969538:
            crea_tmp > l_from_tstamp  AND
            crea_tmp <= l_to_tstamp.
    
    *   Add all the deadline items.
        SELECT wi_id tclass
          APPENDING CORRESPONDING FIELDS OF TABLE lt_wi_data
          FROM swwwihead
          WHERE
            wi_stat = wi_status_ready AND
            wi_type = wi_deadline     AND
    *       note 969538:
            crea_tmp > l_from_tstamp  AND
            crea_tmp <= l_to_tstamp
    *   note 0000790920
        %_hints
        oracle 'INDEX("&TABLE&" "SWWWIHEAD~C" "SWWWIHEAD^C" "SWWWIHEAD_C" "SWWWIHEAD_C__X")'
        DB2    'USE VALUES FOR OPTIMIZATION'
        DB2    '&SUBSTITUTE VALUES&'. "#EC CI_HINTS
    
    *   Filter out the deadline items with wrong task
        DATA: l_wi_header LIKE swwwihead.
    
        LOOP AT lt_wi_data.
    
          CLEAR l_wi_header.
          CALL FUNCTION 'SWW_WI_HEADER_READ'
            EXPORTING
              wi_id     = lt_wi_data-wi_id
            IMPORTING
              wi_header = l_wi_header
            EXCEPTIONS
              OTHERS    = 1.
    
          CHECK l_wi_header-wi_type = wi_deadline.
    
          CLEAR swwwihead.
          SELECT SINGLE * FROM swwwihead
                          WHERE wi_id = l_wi_header-wi_chckwi.
    
          IF NOT swwwihead-wi_rh_task IN task_sel.
            DELETE lt_wi_data.
          ENDIF.
        ENDLOOP.
    
      ENDIF.
    
    ENDFORM.                    "select_workitems

    Add comment
    10|10000 characters needed characters exceeded