‎2005 Aug 18 1:36 PM
Hello All,
Can anyone tell me which is alternate option for select query <b>For all entries in [itab]</b> where ...
Regards,
Dilip
‎2005 Aug 18 1:43 PM
‎2005 Aug 18 1:43 PM
‎2005 Aug 18 1:43 PM
Hi,
try :
Loop at itab.
select (single) a1 a2 .. from dbtab
where key1 = itab-f1
and key2 = itab-f2
..
endloop.
Andreas
‎2005 Aug 18 1:54 PM
Hi Dilip,
Do you have a performance issue when using For all entries? Please keep in mind that you must check whether the internal table contains some entries. If it is not, then it will select all the records from the table.
For example.
IF NOT ITAB[] IS INITIAL.
SELECT....FROM DBTAB
FOR ALL ENTRIES IN ITAB
WHERE....
ENDIF.
‎2005 Aug 18 1:57 PM
Hi, the most scenario for me to use 'For all entrie' is as following:
If several table combine in a join select, maybe it will be poor on performance. So we need to split the join select into several single select. Then after first select, we can prepare the result in a internal table, and use it in another select as 'For all entries in [itab]'.
E.G. as following:
original:
select *
into ....
from mseg
inner join in mkpf .....
where mkpfMBLNR = msegMBLNR.
it is slow, so we change it
select MBLNR
into table itab
from mkpf.
select *
into ....
from mseg
for all entries in itab
where MBLNR = itab~MBLNR.
Another fact is that the where use 'For all entries in', if the itab is very big, the whole select statement will be compiled and explained to be many pieces of select statements, and sent to DB layer.
So if the 'For all entries in' itab is too large, the select will be slow too.
Hope it will be helpful.
Thanks a lot
‎2005 Aug 18 2:10 PM
Hi ,
Follow the following steps before using FOR ALL ENTRIES -
1) Check internal table that it is not empty .
2) If it have entries then SORT the table .
3) Delete duplicate entries from the table .
4) Use any key field in WHERE clouse.
it may help you.
Regards
NK
Message was edited by: Nandkishor Heda