2009 Apr 07 6:03 AM
Dear Experts,
My below SELECT command taking a lot of time to execute.
SELECT wid
matl_desc
INTO TABLE open_wid FROM zwb_table
WHERE ( weight2 = 0 OR weight2 IS NULL ).
Table : zwb_table contains around 7 Lacs records. That's why taking a lot of time . I have also Indexed the table zwb_table with field WID & WEIGHT2 . (zwb_table contains only WID as Primary Key Field)
Structure of Internal Table : open_wid ->
wid LIKE zwb_table-wid,
matl_desc LIKE zwb_table-matl_desc,
Please suggest me how to Improve the Performance of the above Select command.
Thanks in Advance
JACK
2009 Apr 07 6:10 AM
Hi Jack,
Try using extracts if there is so much data to deal with.That will improve the performance.
Here is a sample program(ref. from library) for reference.
REPORT demo_extract_extract.
NODES: spfli, sflight.
FIELD-GROUPS: header, flight_info, flight_date.
INSERT: spfli-carrid spfli-connid sflight-fldate
INTO header,
spfli-cityfrom spfli-cityto
INTO flight_info.
START-OF-SELECTION.
GET spfli.
EXTRACT flight_info.
GET sflight.
EXTRACT flight_date.
Much Regards,
Amuktha.
2009 Apr 07 6:15 AM
Hi,
Try by creating Secondary index with needed fields in Ztable. Take care when creating secondary index put the fields in it which are creating primary key value to identifying the records.
2009 Apr 07 6:24 AM
hi ,
Why to use where clause on field where its not a primary key and that too in a ztable ?
just do an open select on this ztable based on the p-key(s) and fetch the data into internal table .
now loop on this internal table and get rid of data where weight 2 is initial . this is simpler .
br,
Vijay.
2009 Apr 07 6:43 AM
try using into corresponding fields of table instead of into table in your select query.
2009 Apr 07 6:58 AM
Hi Jack,
Just declare like this
data : it_itab type table of zwb_table, wa_itab like line of it_itab.
select wid matl_desc from zwb_table into corresponding fields of table it_itab.
Or
*select * from zwb_table into table it_itab.*
Now delete...
Delete Table it_itab where weight2 is initial.
Thanks & regards,
Dileep .C
2009 Apr 07 7:38 AM
Hi Jack,
you are having morethan 7lack records in z table. it is not good practice fetching all the records into internal table and restricting with where clause in loop statement.
I hope you already created secondary index combination of primary key.
check you select query fetching records based on index you have created in ST05.
Refer below link for your program is using index that you have created.
Regards,
Peranandam
Edited by: peranandam chinnathambi on Apr 7, 2009 8:38 AM