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

Comparing three variables through IF Statement

radhushankar
Participant
0 Likes
2,585

Hi all

I want to comapare like this.

if f1 = 'x' or 'Y' or 'z'.

delete test.

endif.

But i am getting error , can any one tel me how to do this??

Thanks in Advanc

1 ACCEPTED SOLUTION
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,224

hi,

you'll need 3 separate comparisons:

IF f1 = 'X'
OR f1 = 'y'
OR f1 = 'z'.
...

hope this helps

ec

5 REPLIES 5
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,225

hi,

you'll need 3 separate comparisons:

IF f1 = 'X'
OR f1 = 'y'
OR f1 = 'z'.
...

hope this helps

ec

Read only

Subhankar
Active Contributor
0 Likes
1,224

HI Please check it.

data: f1 type char01.

f1 = 'z'.

if f1 = 'x' or f1 = 'Y' or f1 = 'z'.

write: 'delete test.'.

endif.

Read only

Former Member
0 Likes
1,224

if f1 = 'x' or 'Y' or 'z'.

delete test.

endif.

you can do this

if     f1 = 'x' 
   or f1 = 'Y'
   or f1 = 'z'.
    delete test.
endif.

Read only

Former Member
0 Likes
1,224

here's one more:


data: 
matcher type ref to cl_abap_matcher,
input type string value 'Y'.

matcher = cl_abap_matcher=>create( 
    pattern = 'x|Y|z' 
    ignore_case = ''
    text = input ).

if matcher->match( ) = 'X'.
  write: / 'delete thread'.
endif.

Read only

0 Likes
1,223

or how about

if f1 co 'xYz'.
  write: / 'burp'.
endif.