10-30-2007 10:30 AM
10-30-2007 10:33 AM
hi,
cehck the below links
http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ForAllEntries.asp
http://www.sap-img.com/abap/usage-of-for-all-entries-in-select-statement.htm
rewrad if helpful.
Regards,
nagaraj
10-30-2007 10:33 AM
Hi Sekhar,
for ex: you have itab1 and itab2, if you need to fetch the data from dbtable into itab2 by comparing itab1 values you can use for all entries statement.
<b>Reward points for helpful answers</b>
Satish
10-30-2007 10:34 AM
Hi,
You can use it like this:
SELECT * FROM header INTO TABLE lt_headers WHERE ...
SELECT * FROM positions
INTO TABLE lt_positions
FOR ALL ENTRIES IN lt_headers
WHERE positions-key EQ lt_headers-key.
The advantage is that you have only <b>one</b> SELECT statement for the positions table resulting in better performance than the ABAP "old style" programming of looping through the headers table and selecting the positions one-by-one.
Hope this helps (please reward me if it does).
Regards, Joerg
10-30-2007 10:34 AM
for all entries used to select your values from another internal table which matches the where condition criteria.
for ex:
select * from makt into table it_makt for all entries in it_mara
where matnr = it_mara-matnr.
Reward points if its helpful
Regards,
Vimal
10-30-2007 10:35 AM
Hi,
If you want to fetch data from a database table based on the data present in internal table,u can use for all enteries addition in the select statement.
Reward if useful.
Regards
Shibin
10-30-2007 10:35 AM
Hi
you have 5 entries in header table. For example consider you are having 5 sales orders in ITAB.
Now you want to select all the itams belong to those 5 sales order. you can loop at ITAB and for each sales order you can SELECT item data. But that is not efficient.
So we can use FOR ALL ENTRIES..
SELECT *
FROM VBAP
INTO table t_vbap
FOR ALL ENTRIES IN ITAB
WHERE vbeln EQ itab-vbeln.
it will fecth all the items belong to 5 sales orders.
10-30-2007 10:35 AM
u can feacth the data from internal tables and performance wise also it is good.u can join cluster and tranparent tables.
10-30-2007 10:36 AM
Hi,
We use FOR ALL ENTRIES in a SELECT statement when we want to select data from the second table for each and every record in the first table.
ex:
select vbeln
erdat
ernam
vdatu
angdt
bnddt
vsbed
kunnr
from vbak
into corresponding fields of table i_vbak
where vbeln in sorange.
select vbeln
posnr
matnr
arktx
kwmeng
vrkme
waerk
netpr
netwr
from vbap
into corresponding fields of table i_vbap
for all entries in i_vbak
where vbeln = i_vbak-vbeln.
10-30-2007 10:38 AM
Hello,
select * from <table> into itab for all entries in <stucture/internal table> where <condition>
this will select & display entries from <table> for only those entries present in <stucture/internal table>
10-30-2007 10:38 AM
Hi,
This is the answer to your question :-
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 replacing the symbol itab-f with the corresponding value of component f in the WHERE condition.Duplicates are discarded from the result set. If the internal table itab does not contain any entries, the system treats the statement as though there were no WHERE cond condition, and selects all records (in the current client).
Thanks & Regards
Jitendra