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: 

pls help in this code

Former Member
0 Kudos

Hi All,

please let me know, if this code is right ??

I want to select data and move to ind fields,

data : w_post_code1 like adrc-post_code1,

w_post_code2 like adrc-post_code2.

SELECT single POST_CODE1 POST_CODE2 INTO

( w_post_code1 w_post_code2 ) from adrc

WHERE ADDRNUMBER eq s_adrnr .

endselect.

thank you.

madhu

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


DATA: W_POST_CODE1 LIKE ADRC-POST_CODE1,
      W_POST_CODE2 LIKE ADRC-POST_CODE2.
                                                                        
SELECT SINGLE POST_CODE1 POST_CODE2 INTO
(W_POST_CODE1, W_POST_CODE2) FROM ADRC
WHERE ADDRNUMBER EQ S_ADRNR .
                                                                                WRITE:  W_POST_CODE1,  W_POST_CODE2.

Regards,

Ferry Lianto

6 REPLIES 6

Former Member
0 Kudos

When you are using SELECT SINGLE, ENDSELECT is not required, please remove that.

JozsefSzikszai
Active Contributor
0 Kudos

hi Madhu,

this: ( w_post_code1 w_post_code2 )

should be: (w_post_code1, w_post_code2)

(i. e. no spaces with brackets and comma between the fields)

and you don't need ENDSELECT with SELECT SINGLE

ec

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


DATA: W_POST_CODE1 LIKE ADRC-POST_CODE1,
      W_POST_CODE2 LIKE ADRC-POST_CODE2.
                                                                        
SELECT SINGLE POST_CODE1 POST_CODE2 INTO
(W_POST_CODE1, W_POST_CODE2) FROM ADRC
WHERE ADDRNUMBER EQ S_ADRNR .
                                                                                WRITE:  W_POST_CODE1,  W_POST_CODE2.

Regards,

Ferry Lianto

0 Kudos

Thank you all,

I got it now,

I was doinh 2 mistakes,

1) giving spaces between brackets

2) not using comma between 2 variables

3) using end select.

So got now. Thank you

i will close thread by alooting points .

thank you

madhu

Former Member
0 Kudos

Please use the ABAP Syntax checker before posting questions on the forum.

Ctrl+F2 would have given you the solution faster.

0 Kudos

I've worked on SAP which was slower than an average internet connection...