01-29-2008 10:27 AM
Hi Friends,
I need some information about for all entries. what does this function do exactly?
Thanks in advance,
chandu
01-29-2008 10:41 AM
Hi
We can use FOR ALL ENTRIES to replace the Inner Joins in order to fetch data from 2 or more tables.
FOR ALL ENTRIES improves the performance over Inner Joins
Narendra
01-29-2008 10:31 AM
Hi
Use of FOR ALL Entries
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
1. 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.
2. 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.
3. 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,
Usha
01-29-2008 10:33 AM
hi,
i would like to explain it using exmaple:
select matnr
from mara
into table itab1.
select maktx
from makt
into table itab2
for all entries in itab1
where matnr = itab1-matnr.
in the above case for all the matnr-material values fetched in table itab1 corresponding material descriptions will be fetched in itab2.
reward points.
01-29-2008 10:33 AM
SELECT .. FOR ALL ENTRIES was created in OPEN SQL at a time when it was not yet possible to perform database JOINs (this was not supported for all SAP-approved DBMS). The connection between the inner and outer database tables is
created in ABAP. If you want to replace nested SELECT statements with FOR ALL ENTRIES, this only eliminates the nesting and its disadvantages partially. In general,you bundle the inner SELECT statements into packages, for example, of 5 statements each. This reduces the transfer effort required and avoids identical SQL statements. The access sequence is defined in the ABAP coding, like for nested SELECT statements. As mentioned above, if you use FOR ALL ENTRIES, you have to make sure that the driving table is not initial and does not contain any duplicate entries. As in the case of nested SELECT statements, the decision of whether an INNER JOIN or OUTER JOIN is performed is also made in the ABAP program for SELECT ..FOR ALL ENTRIES. If you want to read large data volumes, you should only use
FOR ALL ENTRIES in exceptional cases.
01-29-2008 10:33 AM
for all entries is used for populating detail data in internal table by checking if entries exist in header table without writing
select ....endselect.
this is better considering performance tuning.
Use of FOR ALL Entries
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
1. 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.
2. 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.
3. 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.
reward helpful replies,
kushagra
01-29-2008 10:39 AM
Hi,
'FOR ALL ENTRIES IN' is used to compare one internal table fields with the database table.
Based on the already populated internal table fields (Taken from DB table 1), if u need to take record from some other Databsse table (DB table 2), u can compare this internal table and DB table using this FOR ALL ENTRIES IN statement.
see the following code...
SELECT pernr subty begda endda stell plans orgeh
FROM pa0001 INTO TABLE int_smpinput
WHERE pernr IN s_pernr AND
begda LE p_date AND
endda GE p_date.
Here I'm taking many fields from PA0001 and its populated in int_smpinput internal table
select pernr ebeln zzkonnr from pa0315
into corresponding fields of table int_0315
for all entries in int_smpinput
where pernr = int_smpinput-pernr.
Here i'm taking many field from PA0315 based on the already populated internal table int_smpinput. Here the PERNR present in this internal table is compared with PA0315-PERNR.
Only those PERNR's present in the internal table are taken from PA0315.
Hope it helps u to understand..
Reward points if helpfull
Cheers,
Shanthi.
01-29-2008 10:41 AM
Hi
We can use FOR ALL ENTRIES to replace the Inner Joins in order to fetch data from 2 or more tables.
FOR ALL ENTRIES improves the performance over Inner Joins
Narendra