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: 

Comparing three variables through IF Statement

radhushankar
Participant
0 Kudos

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

JozsefSzikszai
Active Contributor
0 Kudos

hi,

you'll need 3 separate comparisons:

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

hope this helps

ec

5 REPLIES 5

JozsefSzikszai
Active Contributor
0 Kudos

hi,

you'll need 3 separate comparisons:

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

hope this helps

ec

Subhankar
Active Contributor
0 Kudos

HI Please check it.

data: f1 type char01.

f1 = 'z'.

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

write: 'delete test.'.

endif.

former_member188685
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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.

0 Kudos

or how about

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