03-19-2007 9:22 PM
<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
03-19-2007 10:10 PM
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
03-19-2007 10:10 PM
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
03-20-2007 3:52 AM
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.
03-20-2007 4:03 AM
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
03-20-2007 4:41 AM
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.