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

Wrong logical expression

Former Member
0 Likes
717

Hi,

The following code is wrong and I want to know if it's possible to correct it without using another variable:

IF var1 < ( sy-datum + 15 ).

var2 = 1.

ELSEIF var1 > ( sy-datum + 15 ) AND var1 < ( sy-datum + 30 ).

var2 = 2.

ENDIF.

The ABAP syntax checking doesn't allow the logical expression with the "+"... Is not possible or simply I don't know how to do that?

I know that I can do something like that:

var3 = sy-datum + 15.

But I don't want that solution if it's possible

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
661

Sometimes ABAP sux.

Inside an if statement, you can use only logical expressions.

Sorry, I expect my answer was "helpful"

4 REPLIES 4
Read only

Former Member
0 Likes
662

Sometimes ABAP sux.

Inside an if statement, you can use only logical expressions.

Sorry, I expect my answer was "helpful"

Read only

0 Likes
661

Thanks Sergi,

Yes, your answer is helpful, it confirmed my suspects about that's not possible in abap...

Read only

Former Member
0 Likes
661

You have to store Sy-datum + 15 in a different variable.

and then use it in the logical expression.

For older version of SAP this is the only option. I thing the newest version of netweaver allows you to do what you want to do

Edited by: Aparna Shekhar on May 19, 2008 1:05 PM

Read only

0 Likes
661

Hi Aparna,

I'm programming in a SAP 6.2 Version and it doesn't allow to do that yet.