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

Syntax error

Former Member
0 Likes
792

Hi All,

I have got an issue, I have written the folowing code and getting this error"<b>Incorrect expression "+" in logical condition."</b>

select ebeln eindt into table it_eket

from eket

for all entries in it_ekpo

where ebeln = it_ekpo-ebeln and

eindt <= syst-datum + 5 .

Can you please help me out....

Rajeev

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
764

Hi,

You have to declare a variable for the date and use that date in your select statement

data: v_date type sydatum.

v_date = sy-datum + 5.

select ebeln eindt into table it_eket

from eket

for all entries in it_ekpo

where ebeln = it_ekpo-ebeln and

eindt <= v_date .

Thanks

naren

7 REPLIES 7
Read only

Former Member
0 Likes
765

Hi,

You have to declare a variable for the date and use that date in your select statement

data: v_date type sydatum.

v_date = sy-datum + 5.

select ebeln eindt into table it_eket

from eket

for all entries in it_ekpo

where ebeln = it_ekpo-ebeln and

eindt <= v_date .

Thanks

naren

Read only

ferry_lianto
Active Contributor
0 Likes
764

Hi,

Please try this.


data: wa_eindt like sy-datum.

wa_eindt = sy-datum + 5.

select ebeln eindt into table it_eket
from eket
for all entries in it_ekpo
where ebeln = it_ekpo-ebeln and
eindt <= wa_eindt.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
764

You cannot use offsets in a WHERE. You'll have to move the value you want into a separate variable.

Rob

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
764

Yea, you can't do that in a SELECT statement. here is a work around.

data: datum type sy-datum.

datum = sy-datum + 5.

select ebeln eindt into table it_eket
from eket
for all entries in it_ekpo
where ebeln = it_ekpo-ebeln and
eindt <= datum.

Regards,

RIch Heilman

Read only

Former Member
0 Likes
764

>>eindt <= syst-datum + 5 .

Try this

this statement wont work. Declare another field as datum

datum1 = syst-datum + 5.

select ebeln eindt into table it_eket
from eket
for all entries in it_ekpo
where ebeln = it_ekpo-ebeln and
eindt <= datum1 .

Regards

Aneesh

Read only

Former Member
0 Likes
764

What are you trying to get with this statement? Are you looking at current date plus 5 days or are you taking the offset of eindt from the 5th position?

I think you want to read all records with eindt less than or equal to current date plus 5 days. Declare another variable of type date and do the calculation before the select statement as below.

data: l_eindt like eket-eindt.

l_eindt = sy-datum + 5.

select ebeln eindt into table it_eket

from eket

for all entries in it_ekpo

where ebeln = it_ekpo-ebeln and

eindt <= l_eindt .

Another suggestion is that you should use EBELP (line item number) also in your internal tables, otherwise you may get incorrect values.

Read only

Former Member
0 Likes
764

Hi you can not use logical expression in this way into select statement....

store the value of the date in temporary variable and then use it..

data : <b>tempdate</b> like syst-datum.

tempdate = syst-datum + 5.

select ebeln eindt into table it_eket

from eket

for all entries in it_ekpo

where ebeln = it_ekpo-ebeln and

eindt <= <b>tempdate</b>.

Thanks & Regards

ilesh 24x7