2007 Jul 26 9:29 AM
Hello
I have select options for material and plant (s_matnr and s_plant), and this select statement:
select *
from marc
where matnr IN s_matnr AND
werks IN s_plant.
To improve performance, I would like to obtain before all combinations material-plant, and to reduce the where clause into '=' comparisons.
Any help?
Thanks.
2007 Jul 26 9:36 AM
Hi,
When you use IN it will be converted to simple = and OR statements only.
Why do you want to do the job of the Database optimizer.
Regards,
Sesh
2007 Jul 26 9:32 AM
hi,
You can use parameter inplace of select-options and then use it like this
parameter : s_matnr like mara-matnr,
s_plant like mara-werks.
select *
from marc
where matnr = s_matnr AND
werks = s_plant.
Regards,
Himanshu
2007 Jul 26 9:36 AM
Hi,
When you use IN it will be converted to simple = and OR statements only.
Why do you want to do the job of the Database optimizer.
Regards,
Sesh
2007 Jul 26 9:36 AM
Hi Alberto,
By this way there will be no performance improvement.
If you don't want the use to enter the multipel entries then use PARAMETERS.
or you can try with SELECT OPTIONS with NO- INTERVAL option.
Regards,
Atish
2007 Jul 26 9:47 AM
hi,
selection-screen : begin of block blk1 with frame title text-001.
parameters : p_matnr like marc-matnr,
p_werks like marc-werks.
selection-screen : end of block blk1.
select * from marc where matnr = p_matnr
and werks = p_werks.
Reward with points if helpful.
2007 Jul 26 9:48 AM
Hi,
Is these values mandatory in selection screen? if not make it mandatory.
Otherwise if you pass an empty select option in your where clause, it is going to fetch all the data.
If you want to use single values use parameter otherwise ensure that S_matnr and s_werks are not empty.
2007 Jul 26 9:56 AM
you can use select-options: p_matnr for itab-matnr no-interval.
or
at selction-screen output.
loop at screen.
screen-name = 'p_matnr-high' .
screen-input = 0.
modify screen.
endloop.