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

Help with a select

Former Member
0 Likes
1,042

I know this is a dumb question but I can't figure out why this select statement gives me a syntax error:

SELECT mblnr budat mjahr from mkpf INTO CORRESPONDING FIELDS OF table it_docnum
     WHERE budat IN s_budat.
ENDSELECT.     

Regards,

Davis

1 ACCEPTED SOLUTION
Read only

suresh_datti
Active Contributor
0 Likes
1,022

drop the endselect.. you don't need it with inTO table option.

SELECT mblnr budat mjahr from mkpf INTO CORRESPONDING FIELDS OF table it_docnum

WHERE budat IN s_budat.

is enough.

~Suresh

11 REPLIES 11
Read only

suresh_datti
Active Contributor
0 Likes
1,023

drop the endselect.. you don't need it with inTO table option.

SELECT mblnr budat mjahr from mkpf INTO CORRESPONDING FIELDS OF table it_docnum

WHERE budat IN s_budat.

is enough.

~Suresh

Read only

Former Member
0 Likes
1,022

hi,

No need of <b>ENDSELECT</b> as you are passing into internal tbale by saying <b>into table</b>.

Regards,

Sailaja.

Read only

Former Member
0 Likes
1,022

hi Davis,

remove ENDSELECT statment ..

Regards,

Santosh

Read only

Former Member
0 Likes
1,022

Thanks to all for your help. When do you use an endselect?

Regards,

Davis

Read only

0 Likes
1,022

When you are <u>not</u> selecting the records using the primary key and you are <u>not</u> moving the selected records into an internal table in one single shot by using INTO TABLE option.

Read only

0 Likes
1,022
Read only

Former Member
0 Likes
1,022

Hi

If you want to keep endselet then remove table keywod in select stmnt

Thanks

Read only

Former Member
0 Likes
1,022

hi Davis,

When you are passing records into an internal table by using INTO TABLE or

when you are using SELECT SINGLE , then there is no need of ENDSELECT.

Regards,

Sailaja.

Read only

SantoshKallem
Active Contributor
0 Likes
1,022

one more is,

better avoid <b>into corresponding fields</b>

for that the order of field in internal table and select statement must be same.

data: begin of it_docnum occurs 0,

mblnr like mkpf-mblnr,

budat like mkpf-budat,

mjahr like mkpf-mjahr,

end of it_docnum.

SELECT mblnr

budat

mjahr

from mkpf INTO table it_docnum

WHERE budat IN s_budat.

Read only

0 Likes
1,022

Thanks a lot Santhosh, that answers the question of why I wasn't getting any records! I would love to reward you points for this but I'm all out for this question.

Thanks again!

Davis

Read only

Former Member
0 Likes
1,022

Thanks a lot to everybody for all of your help! I apologize for the dumb, easy question.

Davis