‎2007 Sep 18 5:53 AM
‎2007 Sep 18 5:55 AM
hi
inner joins joins the tables at data base level
but in case of for all entries it joins tables at application level
performance wise it is better to use for all entries
reward for use ful answers
regards
Nagesh.Paruchuri
‎2007 Sep 18 5:59 AM
Hi anil
The different depend on your requirement in the program. in case of all entries , you need to create internal table to keep the data that you query but for inner foin there is no need .this situation depend on you would like to keep the data to use somewhere or not . when you keep the data , you can use its everywhere that you would like and it improve more performance if you have to query data every time that you would like
Regards
Wiboon
‎2007 Sep 18 6:21 AM
hi
good
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.
*******************************8
look another example
what is the use of FOR ALL ENTRIES
1. INNER JOIN
DBTAB1 <----
> DBTAB2
It is used to JOIN two DATABASE tables
having some COMMON fields.
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)
4
REPORT abc.
DATA : BEGIN OF itab OCCURS 0,
bukrs LIKE t001-bukrs,
END OF itab.
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
*----
itab-bukrs = '1000'.
APPEND itab.
itab-bukrs = '1100'.
APPEND itab.
*----
SELECT * FROM t001
INTO TABLE t001
FOR ALL ENTRIES IN itab
WHERE bukrs = itab-bukrs.
*----
LOOP AT t001.
WRITE 😕 t001-bukrs.
ENDLOOP.
thanks
mrutyun^
‎2007 Sep 18 6:26 AM
hi,
Inner join is used when we are fetching data from the DD and from the two table like MARA and MAKT at the same time by applying the join on the field MATNR.
And For All Entries is used when we are merging the two internal table into the third one.
thanks
Dharmishta