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: 

can we use FOR ALL ENTRIES in INNER JOIN?

Former Member
0 Kudos
4,423

Hi Abapers,

Can we use FOR ALL ENTRIES while using INNER JOIN?

The issue is as below:

SELECT *

FROM DBTAB1 as A INNER JOIN DBTAB2 as B

FOR ALL ENTRIES IN ITAB WHERE --> some conditions

Just want to know can we use this query?

Thanks,

Hemal

1 ACCEPTED SOLUTION

Former Member
0 Kudos
335

Hi,

Defnately you can as

select a~field1

a~field2

b~field3

c~field4

from tab1 as a inner join tab2 as b

on afield1 = bfield1

for all entries in i_tab3

into i_tab4 where

a~field5 = some parameter.

regards.

7 REPLIES 7

Former Member
0 Kudos
335

SELECT *

FROM DBTAB1 as A INNER JOIN DBTAB2 as B

FOR ALL ENTRIES IN ITAB WHERE --> some conditions

instead

use

select * from DBTAB1 into itab1 where on selection screen condition

if sy-subrc = 0 .

select *from dbtab2 where field1 in itab1-field1

just check there should be itab1 fields in where conditions

Hope it helps

SuhaSaha
Advisor
Advisor
0 Kudos
335

Hello,

Did you try writing this query & then ask. You will find a barrage of answers telling you "Yes, definitely you can", what i like is that you should give a try before posting the question.

@Bhanu: This is not what the OP has asked in the query. Plz read the post carefully before posting irrelevant answers

No hard feelings.

BR,

Suhas

Edited by: Suhas Saha on Mar 5, 2009 9:32 AM

keerthy_k
Advisor
Advisor
0 Kudos
335

Hi,

U can use FOR ALL ENTRIES in inner join. But if u can create separate internal tables for all the database tables and fetchig like below..will be good..

select from dbtable1 into itab1 where condition

if itab1 is not initial.

select from dbtable2 into itab2

for all entries in itab1

where condition.

endif.

if itab2 is not initial.

select from dbtable3 into itab3

for all entries in itab2

where condition.

endif.....

Hope this is helpful.

Keerthi

Former Member
0 Kudos
335

yes we can use for all entries in joins but better we can use those statements separatly.

Former Member
0 Kudos
336

Hi,

Defnately you can as

select a~field1

a~field2

b~field3

c~field4

from tab1 as a inner join tab2 as b

on afield1 = bfield1

for all entries in i_tab3

into i_tab4 where

a~field5 = some parameter.

regards.

Former Member
0 Kudos
335

Hi some correction,

if not i_tab3 is initial.

select a~field1

a~field2

b~field3

c~field4

from tab1 as a inner join tab2 as b

on afield1 = bfield1

for all entries in i_tab3

into i_tab4 where

a~field5 = some parameter.

endif.

regards,

Former Member
0 Kudos
335

Phaneenra you were absolutely right...Thanks Dude

Edited by: HEMAL SHAH on Mar 5, 2009 10:10 AM