Skip to Content
0
Former Member
Oct 10, 2014 at 09:20 AM

Enable/Disable radiobutton with condition

2271 Views


Hi all,

I have to set two radiobuttons (session and ctu) that are disabled/enabled by other two radiobutton (p_rad1 --> session and ctu are disable; p_rad2 --> session and ctu are enable).

In the window where I've to set these parameters if I change from radiobutton p_rad1 to p_rad2 and then i change from p_rad2 to p_rad1 my program dump.

This is my code:

SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE text-000.
PARAMETERS: pa_file TYPE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK one.

SELECTION-SCREEN BEGIN OF BLOCK two WITH FRAME TITLE text-001.
PARAMETERS: p_rad1 RADIOBUTTON GROUP g DEFAULT 'X' USER-COMMAND BUT,
p_rad2 RADIOBUTTON GROUP g.
SELECTION-SCREEN END OF BLOCK two.

SELECTION-SCREEN BEGIN OF BLOCK three WITH FRAME TITLE text-004.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS session RADIOBUTTON GROUP ctu MODIF ID b1. "create session
SELECTION-SCREEN COMMENT 3(20) text-s07 FOR FIELD session.
SELECTION-SCREEN POSITION 45.
PARAMETERS ctu RADIOBUTTON GROUP ctu MODIF ID b2. "call transaction
SELECTION-SCREEN COMMENT 48(20) text-s08 FOR FIELD ctu.
SELECTION-SCREEN END OF LINE.

AT SELECTION-SCREEN.

IF pa_file IS INITIAL.
MESSAGE e000(su) WITH text-001.
ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_file.

CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = '*'
mode = 'O'
title = text-002
IMPORTING
filename = pa_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN. "PROVA 1
IF p_rad1 = 'X'.
IF screen-name = 'SESSION'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
IF screen-name = 'CTU'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ELSEIF p_rad2 = 'X'.
IF screen-name = 'SESSION'.
screen-input = '1'.
MODIFY SCREEN.
ENDIF.
IF screen-name = 'CTU'.
screen-input = '1'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.

And another problem of my program is that before I can select the radiobutton I've to upload a file, I can't do it at last.

Thank you all.

Regards,

Andrea