Skip to Content
avatar image
Former Member

Radio button event.

Hello guys,

I have a question regarding radiobutton event.

I have created a group of 4 radiobuttons and sucessfully linked them in screen painter so there can be only one selected.

But I would like to know if it's possible to generate an event where I could insert some code, when I change the selected radio button?

I found on this forum that when you create a group of radiobutton by code, you can give a name to this group. And then use the event "At Selection-Screen on Radiobutton Group XXX" but how can I define the name of the group when creating the radiobuttons in the screen painter?

Thank you for your help.

Olivier.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Oct 12, 2010 at 02:10 PM

    Hi,

    Try to assign Fcode for your radio button, then implement in user_command module. More information please check sample report DEMO_DYNPRO_CHECK_RADIO.

    Thanks,

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 12, 2010 at 02:43 PM

    Hi Joskin,

    simply create radio button group, and then there is option to add FctCode for this group.

    Then you can switch ok_code in PAI of given screen and check when ok_code = fctcode ...

    you need also define variables for radio buttons as follows:

    DATA: ok_code type syucomm.
    DATA: rb_1 type c,
          rb_2 type c,
          rb_3 type c,
          rb_4 type c.
    

    then in PAI (selected rb is marked with 'X'):

    CASE ok_code.
        WHEN 'RADIO'.   "this is FctCode for our radio button group
          IF rb_1 IS NOT INITIAL.
            ...
          ELSEIF rb_2 IS NOT INITIAL.
            ...
          ELSEIF rb_3 IS NOT INITIAL.
            ...
          ELSEIF rb4 IS NOT INITIAL.
            ...
          ENDIF.
      ENDCASE.
    

    Edited by: Matus Misak on Oct 12, 2010 4:44 PM

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 12, 2010 at 03:19 PM

    Check this,

    Create a subscreen sub1 in screen 100. Then execute it

    Report test.
    SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
    PARAMETERS : r1 radiobutton group A user-command abc,
               r2 radiobutton group A .
    SELECTION-SCREEN END OF SCREEN 300 .
    
    CALL SCREEN 100 .
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    module STATUS_0100 output.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
    break-point.
    endmodule.                 " STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *&      Module  USER_COMMAND_0100  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    module USER_COMMAND_0100 input.
    Break-point.
    endmodule.                 " USER_COMMAND_0100  INPUT
    

    In flow logic

    PROCESS BEFORE OUTPUT.
      MODULE status_0100.
      CALL SUBSCREEN sub1 INCLUDING sy-repid '0300'.
    PROCESS AFTER INPUT.
      MODULE user_command_0100.
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 12, 2010 at 04:09 PM

    the same example that keshav posted in selection-screen would be like this:

    PARAMETERS : r1 radiobutton group A user-command abc,
                            r2 radiobutton group A .
    
    at selection-screen on radiobutton group A.
    break-point.
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 12, 2010 at 05:03 PM

    Hi Olivier,

    You can do this by assigning USER-COMMAND extension to first radiobutton and then use AT SELECTIO-SCREEN ON RADIOBUTTON GROUP event.

    Try this code.

    TABLES : SSCRFIELDS.
    PARAMETERS : a RADIOBUTTON GROUP rd1 USER-COMMAND RCOMMAND,
                 b RADIOBUTTON GROUP rd1 ,
                 c RADIOBUTTON GROUP rd1 .
    
    at SELECTION-SCREEN ON RADIOBUTTON GROUP RD1.
    IF SSCRFIELDS-UCOMM = 'RCOMMAND'.
    "your code
    ENDIF.
    

    Thanks,

    Anmol.

    Add comment
    10|10000 characters needed characters exceeded