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

Error with select statement

Former Member
0 Likes
660

Hi All,

I am getting the error 'Comma without preceding colon (after SELECT ?).' with the following select statement. Can someone help me with the error.

select single actdate_from actdate_to

into ( lv_actdate_from, lv_actdate_to )

from zsdcoop

where kunnr = wa-kunnr and pfnum = wa-pfnum.

if ( lv_actdate_from NE wa-actdate_from ) or ( lv_actdate_to NE wa-actdate_to ).

wa-block = 'X'.

Endif.

Thanks,

Veni.

1 ACCEPTED SOLUTION
Read only

amit_khare
Active Contributor
0 Likes
626

Remove the spaces after & before brackets.

select single actdate_from actdate_to

into (lv_actdate_from, lv_actdate_to)

from zsdcoop

where kunnr = wa-kunnr and pfnum = wa-pfnum

4 REPLIES 4
Read only

Former Member
0 Likes
626
if  lv_actdate_from NE wa-actdate_from  or 
 lv_actdate_to NE wa-actdate_to .
wa-block = 'X'.
Endif.
Read only

amit_khare
Active Contributor
0 Likes
627

Remove the spaces after & before brackets.

select single actdate_from actdate_to

into (lv_actdate_from, lv_actdate_to)

from zsdcoop

where kunnr = wa-kunnr and pfnum = wa-pfnum

Read only

suresh_datti
Active Contributor
0 Likes
626

>

> select single actdate_from actdate_to

> into (lv_actdate_from, lv_actdate_to)

> from zsdcoop

> where kunnr = wa-kunnr and pfnum = wa-pfnum.

> Veni.

you could have tried it yourself.

~Suresh

Read only

Former Member
0 Likes
626

Typically, on statements like this, you want to use AND instead of OR. Google "truth tables" for a detailed explanation of why.

if ( lv_actdate_from NE wa-actdate_from ) or ( lv_actdate_to NE wa-actdate_to ).
wa-block = 'X'.

Should probably be:

if ( lv_actdate_from NE wa-actdate_from ) AND ( lv_actdate_to NE wa-actdate_to ).
wa-block = 'X'.