2007 Jul 20 11:22 AM
what is innerjoin & for all entries?
which one is used in which position,explain plzzzzzzzzzzzzzzzzz.
explain advantages & disadvantages?
2007 Jul 20 11:24 AM
hi,
follow these links for knowing the difference between For all entries and joins.
http://www.erpgenie.com/abap/performance.htm#For%20all%20entries
http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912
1. INNER JOIN
DBTAB1 <----
> DBTAB2
It is used to JOIN two DATABASE tables
having some COMMON fields.
To Impove the perfomance of program you can use for all entries instead of your inner join...This is always preferable..But before make a check and make sure that your internal table is not empty.
2. Whereas
For All Entries,
DBTAB1 <----
> ITAB1
is not at all related to two DATABASE tables.
It is related to INTERNAL table.
3. If we want to fetch data
from some DBTABLE1
but we want to fetch
for only some records
which are contained in some internal table,
then we use for alll entries.
*----
1. simple example of for all entries.
2. NOTE THAT
In for all entries,
it is NOT necessary to use TWO DBTABLES.
(as against JOIN)
3. use this program (just copy paste)
it will fetch data
from T001
FOR ONLY TWO COMPANIES (as mentioned in itab)
FOR ALL ENTRIES is an effective way of doing away with using JOIN on two tables.
You can check the below code -
SELECT BUKRS BELNR GJAHR AUGDT
FROM BSEG
INTO TABLE I_BSEG
WHERE BUKRS = ....
SELECT BUKRS BELNR BLART BLDAT
FROM BKPF
INTO TABLE I_BKPF
FOR ALL ENTRIES IN I_BSEG
WHERE BUKRS = I_BSEG-BUKRS
AND BELNR = I_BSEG-BELNR
AND BLDAT IN SO_BLDAT
Advantages:
1) For all entries avoids inner join & so the performance increases.
2) For specified values in 1 itab, if you to fetch values from other table you can use it.
3) Use of select stmt in loop is gets avoided, as u can use read statement on the the new itab.
http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ForAllEntries.asp
2007 Jul 20 11:24 AM
hi,
follow these links for knowing the difference between For all entries and joins.
http://www.erpgenie.com/abap/performance.htm#For%20all%20entries
http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912
1. INNER JOIN
DBTAB1 <----
> DBTAB2
It is used to JOIN two DATABASE tables
having some COMMON fields.
To Impove the perfomance of program you can use for all entries instead of your inner join...This is always preferable..But before make a check and make sure that your internal table is not empty.
2. Whereas
For All Entries,
DBTAB1 <----
> ITAB1
is not at all related to two DATABASE tables.
It is related to INTERNAL table.
3. If we want to fetch data
from some DBTABLE1
but we want to fetch
for only some records
which are contained in some internal table,
then we use for alll entries.
*----
1. simple example of for all entries.
2. NOTE THAT
In for all entries,
it is NOT necessary to use TWO DBTABLES.
(as against JOIN)
3. use this program (just copy paste)
it will fetch data
from T001
FOR ONLY TWO COMPANIES (as mentioned in itab)
FOR ALL ENTRIES is an effective way of doing away with using JOIN on two tables.
You can check the below code -
SELECT BUKRS BELNR GJAHR AUGDT
FROM BSEG
INTO TABLE I_BSEG
WHERE BUKRS = ....
SELECT BUKRS BELNR BLART BLDAT
FROM BKPF
INTO TABLE I_BKPF
FOR ALL ENTRIES IN I_BSEG
WHERE BUKRS = I_BSEG-BUKRS
AND BELNR = I_BSEG-BELNR
AND BLDAT IN SO_BLDAT
Advantages:
1) For all entries avoids inner join & so the performance increases.
2) For specified values in 1 itab, if you to fetch values from other table you can use it.
3) Use of select stmt in loop is gets avoided, as u can use read statement on the the new itab.
http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ForAllEntries.asp