Skip to Content
0
Former Member
Dec 24, 2007 at 01:29 PM

performance of Select using between and in

21 Views

Hi all,

I have the select statement as follows.

SELECT matnr wkgbtr kstar FROM coep INTO wa_wkgbtr1

WHERE kokrs = 'KBX'

AND perio = v_period

AND parob1 = v_con_pkosa

AND gjahr = v_gjahr

AND ( kstar >= '0000003200' AND kstar <= '0000003299' OR

kstar = '0000003100' OR

kstar = '0000043002' OR

kstar = '0000001100' OR

kstar = '0000043011' OR

kstar = '0000041001' OR

kstar = '0000041011' OR

kstar = '0000041021' OR

kstar = '0000043021' OR

kstar = '0000044631' OR

kstar = '0000041501' OR

kstar = '0000041502'

).

can we use Between and IN operators to improve its performance.

as I have used it as below

SELECT matnr wkgbtr kstar FROM coep INTO TABLE it_wkgbtr1

FOR ALL ENTRIES IN IT_TEMP

WHERE kokrs = it_temp-kokrs

AND perio = it_temp-perio

AND gjahr = it_temp-gjahr

AND parob1 = it_temp-parob1

AND kstar BETWEEN '0000003200' AND '0000003299' OR

kstar IN ('0000003100','0000043002','0000001100','0000043011','0000041001','0000041011','0000041021','0000043021','0000044631','0000041501','0000041502').

but it is taking very long time. Can anybody please fine tune the select sttement.

Thanks in advance