Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

Expensive SQL Statement

Former Member
0 Kudos

Hi Guys,

I have just received an email from our basis team where they said I am using an expensive SQL statement.

There is a loop on a table of people with the following statement

SELECT * FROM catsdb INTO TABLE w_cats

WHERE arbid EQ i_data-arbid

AND raufpl EQ i_data-aufpl

AND raplzl EQ i_data-aplzl

AND workdate IN s_wdate

AND status EQ '30'.

Is it me or is this the quickest way possible??

Can anyone think of a better way to do this??

Thanks Experts


Active Contributor
0 Kudos

First of all, did you ever hear about indices? Please check whether there is an index (SE11) with has fields of your WHERE-condition.

=> if this is not the case the it will be slow, until an index is created.

Second, change the LOOP into a FOR ALL ENTRIES, don't forget to check whether the itab is initial.

Active Contributor
0 Kudos