‎2010 Sep 20 11:04 AM
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
‎2010 Sep 20 11:32 AM
‎2010 Sep 20 11:36 AM
Hi,
First select return me the 'Higher level item' (ie WI_CHCKWI)
and second one will retrun me the data (ie i need to evaluate the status depending on some tasks) corresponding to that higher level item (ie WI_CHCKWI).
Regards,
Darshana
‎2010 Sep 20 11:46 AM
select data into table IT_TAB
from SWWWIHEAD
where WI_RH_TASK = 'TS90000007' &
WI_STAT = u2018COMPLETEDu2019 &
WI_AED = date entered on selection screen
If you pass WI_CHCKWI to WI_CHCKWI in second select statement you will get same info.
The table will return the required data for you. Just check it . If my understanding is correct, I am sure you don't require 2nd select.
‎2010 Sep 20 11:55 AM
Hi,
I need the second select also,Please look at the query again .
Regards,
Darshana
‎2010 Sep 20 12:11 PM
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
‎2010 Sep 20 1: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?
‎2010 Sep 20 1:44 PM
‎2010 Sep 21 2: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
‎2010 Sep 21 3: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