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: 

query

Former Member
0 Kudos
76

I have two query like this

Query1.

SELECT SINGLE adrnr

INTO addr FROM lfa1

WHERE sortl = it_behdr-zzchanumber.

SELECT SINGLE name1 name2 name3 street house_num1 str_suppl1

str_suppl2 city1 post_code1

INTO (w_cname1, w_cname2, w_cname3, w_cstreet,w_chouse_num1,

w_cstr_suppl1, w_cstr_suppl2, w_ccity1, w_cpost_code1)

FROM adrc

WHERE addrnumber = addr.

Query2

SELECT SINGLE adrnr

INTO addr FROM Kna1

WHERE kunnr = it_behdr-kunnr.

SELECT SINGLE name1 name2 name3 street house_num1 str_suppl1

str_suppl2 city1 post_code1

INTO (w_cname1, w_cname2, w_cname3, w_cstreet,w_chouse_num1,

w_cstr_suppl1, w_cstr_suppl2, w_ccity1, w_cpost_code1)

FROM adrc

WHERE addrnumber = addr.

*************************************************

In these i need help like this,

In second query for customer the variables should have to change , Please do this.

Thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos
54

Query2

SELECT SINGLE adrnr

INTO addr FROM Kna1

WHERE kunnr = it_behdr-kunnr.

SELECT SINGLE name1 name2 name3 street house_num1 str_suppl1

str_suppl2 city1 post_code1

INTO (w_cname1, w_cname2, w_cname3, w_cstreet,w_chouse_num1,

w_cstr_suppl1, w_cstr_suppl2, w_ccity1, w_cpost_code1)

FROM adrc

WHERE addrnumber = <b>addr-adrnr</b>.

CLOSE DUPLICATE THREADS AWARDING POINTS.....

null

3 REPLIES 3

Former Member
0 Kudos
54

Hi Ali,

Change the query as follows as you need to get of the customer. Use ADRNR of ADDR to get the address of the customer from KNA1.

SELECT SINGLE name1 name2 name3 street house_num1 str_suppl1

str_suppl2 city1 post_code1

INTO (w_cname1, w_cname2, w_cname3, w_cstreet,w_chouse_num1,

w_cstr_suppl1, w_cstr_suppl2, w_ccity1, w_cpost_code1)

FROM adrc

WHERE addrnumber = <b>addr-ADRNR</b>.

Thanks,

Vinay

Former Member
0 Kudos
55

Query2

SELECT SINGLE adrnr

INTO addr FROM Kna1

WHERE kunnr = it_behdr-kunnr.

SELECT SINGLE name1 name2 name3 street house_num1 str_suppl1

str_suppl2 city1 post_code1

INTO (w_cname1, w_cname2, w_cname3, w_cstreet,w_chouse_num1,

w_cstr_suppl1, w_cstr_suppl2, w_ccity1, w_cpost_code1)

FROM adrc

WHERE addrnumber = <b>addr-adrnr</b>.

CLOSE DUPLICATE THREADS AWARDING POINTS.....

null

Former Member
0 Kudos
54

Hi..

Try this..

Create One internnal table..(itab)

For this fields..

w_cname1, w_cname2, w_cname3, w_cstreet,w_chouse_num1,

w_cstr_suppl1, w_cstr_suppl2, w_ccity1, w_cpost_code1

named as itab..

Then write ur first query ..

SELECT SINGLE name1 name2 name3 street house_num1 str_suppl1

str_suppl2 city1 post_code1

INTO corresponding fields of table itab FROM adrc

WHERE addrnumber = addr.

Then write the second query ..

SELECT SINGLE name1 name2 name3 street house_num1 str_suppl1

str_suppl2 city1 post_code1

APPENDING CORRESPONDING FIELDS OF TABLE itab FROM adrc

WHERE addrnumber = addr.

Hope this will helps..

Reward all useful answers.

Regards

Bala..