Application Development and Automation 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: 
Read only

Disable radiobutton

Former Member
0 Likes
9,034

Hi,

I have to desactivate a radio button defined like this :

SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-T10.
PARAMETERS P_MATNR TYPE MARC-MATNR .
SELECTION-SCREEN:BEGIN OF BLOCK B2 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS  P_RB1 RADIOBUTTON GROUP GR1 USER-COMMAND CMD DEFAULT 'X'.
             SELECTION-SCREEN COMMENT (50) TEXT-010 FOR FIELD P_RB1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS   P_RB2 RADIOBUTTON GROUP GR1.
             SELECTION-SCREEN COMMENT (50) TEXT-011 FOR FIELD P_RB1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.
SELECTION-SCREEN END OF BLOCK B1.


And when I want to desactivate , the script goes well but I receive a dump


FORM DISABLE_BR USING BR TYPE CHAR5.

LOOP AT SCREEN.
IF SCREEN-NAME EQ BR.
   SCREEN-INPUT = 0.
   MODIFY SCREEN.
   EXIT.
ENDIF.
ENDLOOP.
ENDFORM.     

Help me please

Thank you

1 ACCEPTED SOLUTION
Read only

anubhab
Active Participant
0 Likes
4,065

Hi Sam,

     Why don't you simply put your logic for disabling the radio button in AT SELECTION-SCREEN OUTPUT event. Even after that, if you are facing issue again, please remove EXIT command.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE t1.

PARAMETERS: r1 radiobutton group GR USER-COMMAND ucom,

                      r2 radiobutton group GR.

PARAMETERS: p_ort01 radiobutton group GR.

SELECTION-SCREEN: END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.

  IF r2 = 'X'.

    LOOP at screen.

      IF screen-name = 'P_ORT01'.

        screen-input = 0.

        MODIFY screen.

      ENDIF.

    ENDLOOP.

  ENDIF.

NOTE: If you are using USER_COMMAND, it should be the first element of the screen, and preferably a radio button.

Regards,

Anubhab

7 REPLIES 7
Read only

Former Member
0 Likes
4,065

Please remove the EXIT option and excute

Read only

0 Likes
4,065

I don't think that EXIT is the problem.

I have just Add  P_RB1 = 'X'.       P_RB2 = ''. before calling  PERFORM DISABLE_BR USING 'P_RB2'


The problem now is that it doesn't make the radio button desactivated gray 😕

Read only

0 Likes
4,065

What is your purpose, usually radiobuttons are input enable and other dependant fields are displayed/hidden depending on their values, can you explain your exact requirement ?

Regards,

Raymond

Read only

anubhab
Active Participant
0 Likes
4,066

Hi Sam,

     Why don't you simply put your logic for disabling the radio button in AT SELECTION-SCREEN OUTPUT event. Even after that, if you are facing issue again, please remove EXIT command.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE t1.

PARAMETERS: r1 radiobutton group GR USER-COMMAND ucom,

                      r2 radiobutton group GR.

PARAMETERS: p_ort01 radiobutton group GR.

SELECTION-SCREEN: END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.

  IF r2 = 'X'.

    LOOP at screen.

      IF screen-name = 'P_ORT01'.

        screen-input = 0.

        MODIFY screen.

      ENDIF.

    ENDLOOP.

  ENDIF.

NOTE: If you are using USER_COMMAND, it should be the first element of the screen, and preferably a radio button.

Regards,

Anubhab

Read only

Former Member
0 Likes
4,065

I have to valuate a the number that the user has entrer before desactivate a radio button ..So the AT SELECTION-SCREEN OUTPUT event   doesn't work for me


Thank you

Read only

bernat_loscos
Explorer
0 Likes
4,065

Hi Sam,

You can try this code:

AT SELECTION-SCREEN OUTPUT.
   PERFORM disable_br USING 'P_RB1'. "Indicate the name of your field


FORM disable_br USING br TYPE char5.
   LOOP AT SCREEN.
     IF screen-name EQ br.
       screen-input = 0.
       MODIFY SCREEN.
     ENDIF.
   ENDLOOP.
ENDFORM



Regards !!

Read only

Former Member
0 Likes
4,065

see following demo report:

Selection screen with radio buttons

report ztest .

TABLES: vbak, ltak.

DATA:

err_sw.

PARAMETERS: rb1 RADIOBUTTON GROUP rb1 USER-COMMAND sel DEFAULT 'X'.

PARAMETERS: rb2 RADIOBUTTON GROUP rb1.

SELECTION-SCREEN: SKIP 1.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.

SELECT-OPTIONS: s_auart FOR vbak-auart DEFAULT 'ZRE'

NO INTERVALS MODIF ID rb1.

SELECT-OPTIONS: s_date FOR vbak-erdat MODIF ID rb1.

SELECTION-SCREEN: END OF BLOCK b1.

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.

SELECT-OPTIONS: s_tanum FOR ltak-tanum MODIF ID rb2.

SELECT-OPTIONS: s_bdatu FOR ltak-bdatu MODIF ID rb2.

SELECTION-SCREEN: END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

IF rb1 = 'X'.

PERFORM hide_rb2_options.

ELSE.

PERFORM hide_rb1_options.

ENDIF.

INITIALIZATION.

START-OF-SELECTION.

CLEAR err_sw.

IF rb1 = 'X'.

IF s_auart IS INITIAL

OR s_date IS INITIAL.

MESSAGE i208(00) WITH 'Required field not entered'.

err_sw = 'X'.

ENDIF.

ELSE.

IF s_tanum IS INITIAL

OR s_bdatu IS INITIAL.

MESSAGE i208(00) WITH 'Required field not entered'.

err_sw = 'X'.

ENDIF.

ENDIF.

CHECK err_sw NE 'X'.

WRITE:/ 'Hi!'.

*&---------------------------------------------------------------------*

*& Form hide_rb2_options

*&---------------------------------------------------------------------*

FORM hide_rb2_options.

LOOP AT SCREEN.

CASE screen-group1.

WHEN 'RB1'.

screen-active = 1.

MODIFY SCREEN.

WHEN 'RB2'.

screen-active = 0.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

ENDFORM. " hide_rb2_options

*&---------------------------------------------------------------------*

*& Form hide_rb1_options

*&---------------------------------------------------------------------*

FORM hide_rb1_options.

LOOP AT SCREEN.

CASE screen-group1.

WHEN 'RB2'.

screen-active = 1.

MODIFY SCREEN.

WHEN 'RB1'.

screen-active = 0.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

ENDFORM. " hide_rb1_options