Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

For all entries

Former Member
0 Kudos

hai ..

what is the use of FOR ALL ENTRIES...

How can i take the value from diff tables into one internal table with out using JOIN... if anybody hav ex prog .. pls send Asap

How can i check the performance for my prog..

thanks and regards ..

raja..

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

It's an option to do the select once.

LOOP AT ITAB.

SELECT SINGLE * FROM MARA APPENDING TABLE T_MARA

WHERE MATNR = ITAB-MATNR.

ENDLOOP.

This selection is processed as many times as records are in ITAB.

You can do once:

SELECT SINGLE * FROM MARA INTO TABLE T_MARA

FOR ALL ENTRIES IN ITAB

WHERE MATNR = ITAB-MATNR.

Max

7 REPLIES 7

Former Member
0 Kudos

Hi

It's an option to do the select once.

LOOP AT ITAB.

SELECT SINGLE * FROM MARA APPENDING TABLE T_MARA

WHERE MATNR = ITAB-MATNR.

ENDLOOP.

This selection is processed as many times as records are in ITAB.

You can do once:

SELECT SINGLE * FROM MARA INTO TABLE T_MARA

FOR ALL ENTRIES IN ITAB

WHERE MATNR = ITAB-MATNR.

Max

Former Member
0 Kudos

you can select data from DB table for all the entries of an int table at a go using select .. for all entries.

to select values from diff tables into an internal table, need to use join in the select statement . else create a DB view joining the DB tables and then access the view in the select statement

Former Member
0 Kudos

hi,

for all entries are used to get the missing data in an internal table form appropraite database table .

for example i_makt with fields matnr mtart spras maktx.

and i have data in table for fields matnr and mtart and now i want to get the description for the material.

now i will use lik

select spras maktx from makt into table i_makt for all entries ini_makt where matnr = i_makt-matnr.

so finally that table contains complete data.

hope it serves ur understanding.

nagaraju.

former_member404244
Active Contributor
0 Kudos

Hi Rajviji,

For all entries is other option for joins.

i will give u an example

select matnr mtart from mara into table it_mara

where matnr in s_matnr.

if not it_mara[] is initial

select matnr werks dispo dismm from marc into table it_marc for all entries in it_mara

where matnr = it_mara-matnr.

endif.

Now the above select query will fetch all the plant and other information basing on the material number.

Regards,

nagaraj

Former Member
0 Kudos

Hi rajviji,

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.

regards,

amit m.

Former Member
0 Kudos

Hello,

FOR ALL entries is other option to JOIN. It also increases the performance.

But you can use thsi keyword only against a DB table and not against another internal table.

Regs,

Venkat

Former Member
0 Kudos

Hi Rajviji,

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.

Hope this helps!

Regards,

Saurabh