Application Development and Automation 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: 
Read only

pls help in this code

Former Member
0 Likes
886

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
Read only

ferry_lianto
Active Contributor
0 Likes
859

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
Read only

Former Member
0 Likes
859

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

Read only

JozsefSzikszai
Active Contributor
0 Likes
859

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

Read only

ferry_lianto
Active Contributor
0 Likes
860

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

Read only

0 Likes
859

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

Read only

Former Member
0 Likes
859

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

Ctrl+F2 would have given you the solution faster.

Read only

0 Likes
859

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