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
119

Send me an example of For all entries with 3 or more tables.

4 REPLIES 4

Former Member
0 Kudos
60

Hi jyotirmoy,

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
60

SELECT anla~bukrs

anla~anln1

anla~anln2

anla~aktiv

anla~deakt

anla~anlue

anlz~kostl

anlz~bdatu

anlz~adatu

INTO CORRESPONDING FIELDS OF TABLE it_anla

FROM anla INNER JOIN anlz

ON anlabukrs EQ anlzbukrs

AND anlaanln1 EQ anlzanln1

AND anlaanln2 EQ anlzanln2

WHERE anla~bukrs IN so_bukrs

AND anla~anln1 IN so_anln1

AND anla~anln2 IN so_anln2

AND anla~deakt IN so_deakt

AND anla~anlue IN so_anlue

AND anla~aktiv IN so_aktiv

AND anlz~kostl IN so_kostl.

if not it_anla[] is initial.

SELECT *

FROM anlc

INTO TABLE it_anlc

FOR ALL ENTRIES IN it_anla

WHERE bukrs EQ it_anla-bukrs

AND anln1 EQ it_anla-anln1

AND anln2 EQ it_anla-anln2

AND gjahr EQ pa_gjahr

AND afabe EQ pa_afabe.

endif.

VB09104
Active Participant
0 Kudos
60

hi,

probabaly you need to join the three database tables into one internal table and then can use that internal table in next select with FOR ALL ENTRIES

SELECT a~matnr

a~berid

a~dismm

a~ausss

a~sobsl

b~berty

INTO TABLE it_mdma_mdlv_mdll

FROM mdma AS a

INNER JOIN mdlv AS b

ON aberid EQ bberid

INNER JOIN mdll AS c

ON bberid EQ cberid

FOR ALL ENTRIES IN it_bomitems

WHERE a~matnr EQ it_bomitems-idnrk

AND a~dispo IN s_cdispo

AND b~berty EQ '3'

AND a~sobsl IN s_csobsl

AND c~lbear IN s_lifnr.

regards,

vikas.

plz reward if helpful

jayakummar
Active Participant
0 Kudos
60

hai,

useing for all entries we can select single table values but we can able to validate previous int table all values.

we need to use 3 int table for 3 db table and finaly do loop at final table move value from int table to final int table and appent final int table....

this is the process to do the for all entries...

it giving better performance becose we dont fetch all value from single select qurey and we populate all values in to final table through source code thats why its giving better performance......

plzz reward if useful..

regards,

jai.m