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: 

Case statement - Range

Former Member
0 Kudos
3,646

I case statements can i give a range

eg:

Case my_field.

when GE 'a' and LE 'l'

do something.

when others.

endcase.

6 REPLIES 6

Former Member
0 Kudos
742

I don't think you can use GE and LT to compare characters, but give it a try and see if it works!

former_member181962
Active Contributor
0 Kudos
742

No.

Former Member
0 Kudos
742

It does not work, I tried is there something I am missing in the syntax.

0 Kudos
742

No, I don't think you're missing anything, it just doesn't work like that.

Try explaining what you're trying to achieve and maybe we can help you.

0 Kudos
742

here are the details

I have to have to write the names of people who name start with 'A' to 'F' in col 10 and 'G' to 'L' on col 20 and rest in col 30.

I take move the first charcter of name in

Data: f_char type c.

than I am using case statement

Case f_char

when GE 'A' and LE 'F'

perform write-10para.

'

'

'

endcase.

Former Member
0 Kudos
742

Hi Ram..

You cannot have a range but u can put a list of values seperated by or..

DATA : val TYPE i.

val = 1.

CASE val.

WHEN '1' or '10'.

WRITE : '1to 10'.

when others.

write : ' others'.

ENDCASE.