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.
Showing results for 
Search instead for 
Did you mean: 

case with a select-options

Former Member
0 Kudos


How do I use the CASE statement when the variable is a range (so_mes).

so_mes is defined like a select-options.

i have the next code.

case so_mes-low.

when '01'.

move dobli-wtp01 to oejer.

when '02'.

move dobli-wtp02 to oejer.

when '03'.

move dobli-wtp03 to oejer.

when '04'.

move dobli-wtp04 to oejer.

when '05'.

move dobli-wtp05 to oejer.

when '06'.

move dobli-wtp06 to oejer.

when '07'.

move dobli-wtp07 to oejer.

when '08'.

move dobli-wtp08 to oejer.

when '09'.

move dobli-wtp09 to oejer.

when '10'.

move dobli-wtp10 to oejer.

when '11'.

move dobli-wtp11 to oejer.

when '12'.

move dobli-wtp12 to oejer.

in this case only take the low value. How can I asigned the the high value in the statement CASE?.


Developer Advocate
Developer Advocate
0 Kudos

Not sure that a select-option is the best way to handle this. Are you forcing that the user only inputs single values or are you allow ranges. If you are allowing ranges, not sure that is a good idea.


Rich Heilman

0 Kudos

I would suggest doing something like this. Allow the user to enter only single values in the select-option, then you can loop at the select-option and process accordingly.

report zrich_0001.

* Type pools
type-pools: slis, sscr.

data: char2(2) type c.

select-options: so_mes for char2.

  perform initilization.


  loop at so_mes.

    case so_mes-low.
      when '01'.
*move dobli-wtp01 to oejer.
      when '02'.
*move dobli-wtp02 to oejer.
      when '03'.
*move dobli-wtp03 to oejer.
      when '04'.
*move dobli-wtp04 to oejer.



form initilization.

* Restrict the select options for SO_MES
* to just a date range
  data: selopt   type sscr_ass,
        opt_list type sscr_opt_list,
        restrict type sscr_restrict.

  clear opt_list.
  opt_list-name          = 'EQ'.
  opt_list-options-eq    = 'X'.
  append opt_list to restrict-opt_list_tab.

  clear selopt.
  selopt-kind            = 'S'.
  selopt-name            = 'SO_MES'.
  selopt-sg_main         = 'I'.
  selopt-sg_addy         = ' '.
  selopt-op_main         = 'EQ'.
  selopt-op_addy         = 'EQ'.
  append selopt  to restrict-ass_tab.

            restriction            = restrict
            too_late               = 1
            repeated               = 2
            selopt_without_options = 5
            selopt_without_signs   = 6
            invalid_sign           = 7
            empty_option_list      = 9
            invalid_kind           = 10
            repeated_kind_a        = 11
            others                 = 12.



Rich Heilman

Active Contributor
0 Kudos

your question is not clear.

Do you want to do a 'case' on only the so_mes-high? If so you can code it exactly as for the low.

Or do you want to include both low and high in a 'case'?

Although it syntax checks I don't think you can have something like:

case so_mes.

when '01'.

when '02'.


Why not just use an 'if'?

if '01' in so_mes.

elseif '02' in so_mes.


Please give us more info if I haven't guessed what you are asking properly.

Former Member
0 Kudos

Hi Marisol,

Could you pls explain your question more clearly.

You can very well use so_mes-high in the same way as u have used for so_mes-low.

<b>case so_mes-high.</b>
when '01'.
move dobli-wtp01 to oejer.
when '02'.
move dobli-wtp02 to oejer.
when '03'.
move dobli-wtp03 to oejer.