2006 Aug 30 11:28 AM
When we use FOR ALL ENTRIES in a select statement having joins, does control goes to Database everytime
for each entry in internal table?
When we use FOR ALL ENTRIES in a select statement having joins, does control goes to Database everytime
for each entry in internal table?
2006 Aug 30 11:33 AM
Hi,
We use the for all entries to fetch the data based on already fetched data which might be present in the another internal table ...and for those records only we need to find another records...it will read DB table ..
To avoid this just fetch all required data and then based on condition use READ from itab.
2006 Aug 30 11:51 AM
NO .. it hits the db only once.. if there is a performance hit, it might be due to your join.. is it a complex join?
Anyway,this is what SAP's docu says.."SELECT ... FOR ALL ENTRIES IN itab WHERE cond returns the union of the solution sets of all SELECT statements that would result if you wrote a separate statement for each line of the internal table "
~Suresh
2006 Aug 30 11:53 AM
Hi,
Inner join selects a record and checks for
matches with each entry in internal table by
hitting database.
Check if internal is not empty to avoid
performance problem and alao delete
sort internal table by deleting duplicate keys
Regards,
Amole
2006 Aug 30 12:04 PM
hi
good
Outer join can be created using this addition to the where clause in a select statement. It speeds up the performance tremendously, but the cons of using this variation are listed below
Duplicates are automatically removed from the resulting data set. Hence care should be taken that the unique key of the detail line items should be given in the select statement.
If the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination table. Hence it is advisable to check before-hand that the first table is not empty.
If the table on which the For All Entries IN clause is based is very large, the performance will go down instead of improving. Hence attempt should be made to keep the table size to a moderate level.
Not Recommended
Loop at int_cntry.
Select single * from zfligh into int_fligh
where cntry = int_cntry-cntry.
Append int_fligh.
Endloop.
Recommended
Select * from zfligh appending table int_fligh
For all entries in int_cntry
Where cntry = int_cntry-cntry.
thanks
mrutyun
2006 Aug 30 12:05 PM
Yes, internally the control goes to DB to fetch the records for each entry in the internal table. But please note for ABAP code it is executed as a single statement you would not see that looping in debug etc.
2006 Aug 30 12:08 PM