Application Development 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: 

Wrong logical expression

Former Member
0 Kudos
119

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

Former Member
0 Kudos
63

Sometimes ABAP sux.

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

Sorry, I expect my answer was "helpful"

4 REPLIES 4

Former Member
0 Kudos
64

Sometimes ABAP sux.

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

Sorry, I expect my answer was "helpful"

0 Kudos
63

Thanks Sergi,

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

Former Member
0 Kudos
63

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

0 Kudos
63

Hi Aparna,

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