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: 

select with join

Former Member
0 Kudos

<b>I have itab structure</b>

data: begin of itab3 occurs 0,

adrnr like adrc-addrnumber,

name1 like adrc-name1,

address1 like adrc-street,

address2 like adrc-str_suppl1,

city like adrc-city1,

state like adrc-region,

zip like adrc-post_code1,

country like t005t-landx,

countrycode like adrc-country,

telnum like adrc-tel_number,

end of itab3,

wa_itab3 like itab3.

I want to select the records and put them into the itab3. But as you can see I have adrc and t005t tables and they are joined on adrc-country = t005t-land1

I want to do something like this

select addrnumber name1 street str_suppl1 city1 region post_code1 country countrycode tel_number from adrc into table itab3

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


select addrnumber name1 street str_suppl1 city1 region post_code1 country countrycode tel_number 
from adrc inner join t005t on adrc~country = t005t~land1 
into table itab3 
for all entries in itab1 
where adrc~addrnumber = itab1-adrnr 
  and t005t~spras = sy-langu.

Regards,

Ferry Lianto

4 REPLIES 4

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


select addrnumber name1 street str_suppl1 city1 region post_code1 country countrycode tel_number 
from adrc inner join t005t on adrc~country = t005t~land1 
into table itab3 
for all entries in itab1 
where adrc~addrnumber = itab1-adrnr 
  and t005t~spras = sy-langu.

Regards,

Ferry Lianto

Former Member
0 Kudos

Hi Megan,

Yes, as per ferry just try with this one also.

select a~addrnumber

a~name1

a~street

a~str_suppl1

a~city1

a~region

a~post_code1

a~country

a~ countrycode

a~tel_number

from adrc as a inner join t005t as t

on acountry = tland1

into table itab3 for all entries in itab1

where a~addrnumber = itab1-adrnr

and t~spras = sy-langu.

If itab3[] is initial.

message : e001(zsd) with 'NO DATA'.

endif.

Hope this helps you. Reply for queries.

Regards,

Kumar.

Former Member
0 Kudos

Hi

try this out.

select aaddrnumber aname1 astreet astr_suppl1 acity1 aregion apost_code1 acountry acountrycode atel_number into corresponding fields of table itab3 from adrc as a

inner join t005t as t on acountry = tland1 .

Hope it helps..

Award marks if it helps

Former Member
0 Kudos

Megan,

select aaddrnumber aname1 a~address1

astreet astr_suppl1 a~city1

aregion apost_code1 a~country

acountrycode atel_number

from adrc as a inner join t005t as b on acountry = bland1

into table itab3

for all entries in itab1

where adrc~addrnumber = itab1-adrnr

and b~spras = sy-langu.

Pls. reward for all useful ans.