‎2009 Jun 18 6:49 PM
Hi,
I have written the following select statement:
select name secu from trdir into table it_tab
where name in s_name
and subc eq '1'or subc eq 'I' or subc eq 'F'
and udat in s_date.
I just added this and subc eq '1'or subc eq 'I' or subc eq 'F' and since then the program is taking lot of time... so can you please tell me what wrong I am doing..
Thanks,
Rajeev
‎2009 Jun 18 6:53 PM
that or is ur problem... OR makes different selects and merge the data...
try to put those ORs in between '(' ')'
also
try to remove the OR and use subc in ('1','I' ,'F')
also try not puting subc in the select and fillter them after the select.
see which one makes ur performace better
Edited by: soumya prakash mishra on Jun 18, 2009 8:02 PM
‎2009 Jun 18 6:53 PM
that or is ur problem... OR makes different selects and merge the data...
try to put those ORs in between '(' ')'
also
try to remove the OR and use subc in ('1','I' ,'F')
also try not puting subc in the select and fillter them after the select.
see which one makes ur performace better
Edited by: soumya prakash mishra on Jun 18, 2009 8:02 PM
‎2009 Jun 18 7:02 PM
Rajeev,
Your Select statement is ambiguous which might be causing the delay.
I have written the following select statement:
select name secu from trdir into table it_tab
where name in s_name
and subc eq '1'or subc eq 'I' or subc eq 'F'
and udat in s_date.
Try modifying the query as follows and check.
SELECT name
secu
INTO TABLE it_tab
FROM trdir
WHERE name IN s_name
AND ( subc EQ '1' OR
subc EQ 'I' OR
subc EQ 'F' )
AND udat IN s_date.
It's recommended that whenever you use a combination of AND and OR clause to set the precedence of execution brackets should be used.
Regards,
Gajendra
‎2009 Jun 18 7:28 PM
Hi Gajendra,
It didn't help... rather it's giving me an error that field subc EQ '1' OR subc EQ 'I' or subc EQ 'F' is unknown, it is neither in one of the specified tables nor defined by a data statament.
‎2009 Jun 18 8:01 PM
Rajeev,
I have tested this snippet in my test environment and it works fine for me. Try to copy paste the code as it is in your program and see. Make sure that you a space between the openning bracket "(" bracket and field SUBC and a space between 'F' and closing bracket ")" the way I have it in my snippet.
Regards,
Gajendra
‎2009 Jun 18 7:51 PM
Hi Rajeev,
Try following select statement.
ranges: r_subc for trdir-subc.
r_subc-option = 'EQ'.
r_subc-sign = 'I'.
r_subc-low = '1'.
append r_subc.
clear r_subc-low.
r_subc-low = 'I'.
append r_subc.
clear r_subc-low.
r_subc-low = 'F'.
append r_subc.
clear r_subc-low.
select name
secu
subc -
Add this field in it_tab as well
from trdir
into table it_tab
where name in s_name
and udat in s_date.
if sy-subrc eq 0.
delete it_tab where subc not in r_subc.
endif.
Regards,
Anil Salekar