Skip to Content
0
Former Member
Mar 12, 2007 at 04:18 PM

Is there any significant difference?

38 Views

these are my programs that demonstrate radio button. there are 2 versions and they have the same output and they are all working fine. I am just wondering why on version 1 (I got this pattern from a tutorial) I have to create sy-ucomm many times. On version 2, it looks more simple. I just want to know if version 1 has advantage/disadvantage over version 2 and vice versa. newbie here. <b>Thanks for the help. </b>

====================================

Code version 1

====================================

data: rb1(1), rb2(1), rb3(1), field1(10).
data: ok_code type sy-ucomm,
      save_ok type sy-ucomm.

initialization.
save_ok = ok_code.
clear ok_code.

start-of-selection.
  set screen 0100.

module pai input.
  case save_ok.
      when 'RADIO'.
          if RB1 = 'X'.
              field1 = 'option 1'.
          elseif RB2 = 'X'.
              field1 = 'option 2'.
          else.
              field1 = 'option 3'.
          endif.
  endcase.

  case sy-ucomm.
    when 'BTNEXIT'.
      leave program.
  endcase.
endmodule.

====================================

Code version 2

====================================

data: rb1(1), rb2(1), rb3(1), field1(10).

start-of-selection.
  set screen 0100.

module pai input.
  case sy-ucomm.
    when 'BTNEXIT'.
      leave program.
    when 'RADIO'.
          if RB1 = 'X'.
              field1 = 'option 1'.
          elseif RB2 = 'X'.
              field1 = 'option 2'.
          else.
              field1 = 'option 3'.
          endif.
  endcase.
endmodule.