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

Multiple conditions in if statement.

Former Member
0 Likes
35,409

Hello,

I have a problem with multiple selections in an if statment.

The code below is not working. Anyone who knows how to wright it? Can i somehow use () because OR is not working for the same "field".

if p0001-plans ne '99999999'

AND p0000-stat2 EQ '3'

AND p0001-vdsk1 EQ 'IT'

<i> AND p0001-persg EQ '1' <b>or</b>

p0001-persg EQ 'T'

AND p0001-bukrs EQ 'FR46' <b>or</b>

p0001-bukrs EQ 'GB21' <b>or</b>

p0001-bukrs EQ 'PL05' <b>or</b>

p0001-bukrs EQ 'BE06' <b>or</b>

p0001-bukrs EQ 'US22'</i>

endif

/ Claes

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
10,265

Claes,

Use it like this.

if p0001-plans ne '99999999'

AND p0000-stat2 EQ '3'

AND p0001-vdsk1 EQ 'IT'

AND ( p0001-persg EQ '1' or

p0001-persg EQ 'T' )

AND ( p0001-bukrs EQ 'FR46' or

p0001-bukrs EQ 'GB21' or

p0001-bukrs EQ 'PL05' or

p0001-bukrs EQ 'BE06' or

p0001-bukrs EQ 'US22')

This shuld work.

Regards,

Ravi

Note :Please reward the posts that help you.

Hello,

I have a problem with multiple selections in an if statment.

The code below is not working. Anyone who knows how to wright it? Can i somehow use () because OR is not working for the same "field".

if p0001-plans ne '99999999'

AND p0000-stat2 EQ '3'

AND p0001-vdsk1 EQ 'IT'

<i> AND p0001-persg EQ '1' <b>or</b>

p0001-persg EQ 'T'

AND p0001-bukrs EQ 'FR46' <b>or</b>

p0001-bukrs EQ 'GB21' <b>or</b>

p0001-bukrs EQ 'PL05' <b>or</b>

p0001-bukrs EQ 'BE06' <b>or</b>

p0001-bukrs EQ 'US22'</i>

endif

/ Claes

3 REPLIES 3
Read only

Former Member
0 Likes
10,266

Claes,

Use it like this.

if p0001-plans ne '99999999'

AND p0000-stat2 EQ '3'

AND p0001-vdsk1 EQ 'IT'

AND ( p0001-persg EQ '1' or

p0001-persg EQ 'T' )

AND ( p0001-bukrs EQ 'FR46' or

p0001-bukrs EQ 'GB21' or

p0001-bukrs EQ 'PL05' or

p0001-bukrs EQ 'BE06' or

p0001-bukrs EQ 'US22')

This shuld work.

Regards,

Ravi

Note :Please reward the posts that help you.

Read only

Former Member
0 Likes
10,265

Try followings.

> if p0001-plans ne '99999999'

> AND p0000-stat2 EQ '3'

> AND p0001-vdsk1 EQ 'IT'

> AND ( p0001-persg EQ '1' or

> p0001-persg EQ 'T' )

> AND ( p0001-bukrs EQ 'FR46' or

> p0001-bukrs EQ 'GB21' or

> p0001-bukrs EQ 'PL05' or

> p0001-bukrs EQ 'BE06' or

> p0001-bukrs EQ 'US22' )

> endif

>

Good Luck..

Read only

andreas_mann3
Active Contributor
0 Likes
10,265

Hi,

try that:

IF p0001-plans NE '99999999'
AND p0000-stat2 EQ '3'
AND p0001-vdsk1 EQ 'IT'
AND ( p0001-persg EQ '1' OR
p0001-persg EQ 'T' )
AND  ( p0001-bukrs EQ 'FR46' OR
p0001-bukrs EQ 'GB21' OR
p0001-bukrs EQ 'PL05' OR
p0001-bukrs EQ 'BE06' OR
p0001-bukrs EQ 'US22' ).
ENDIF .

Andreas