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

How to gray out other options in a radio button group when one is choosen?

Former Member
0 Kudos

Hi all,

I have a requrement that if i select an option of the radio button the other options must be grayed out .Please help me with this.

SELECTION-SCREEN begin OF line.

PARAMETER:

v_p1 RADIOBUTTON GROUP RD USER-COMMAND onli MODIF ID AB1.

SELECTION-SCREEN :COMMENT 4(60) text-001.

SELECTION-SCREEN end of LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETER:

v_p2 RADIOBUTTON GROUP RD MODIF ID AB2.

SELECTION-SCREEN :COMMENT 4(60) text-002.

SELECTION-SCREEN end of LINE.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF v_p1 = 'X'.

IF SCREEN-GROUP1 = 'AB1'.

SCREEN-INPUT = '0'.

SCREEN-INTENSIFIED = '0'.

MODIFY SCREEN.

ENDIF.

ELSE.

IF v_p2 = 'X'.

IF SCREEN-GROUP1 = 'AB2'.

SCREEN-INPUT = '0'.

SCREEN-INTENSIFIED = '0'.

MODIFY SCREEN.

endif.

ENDIF.

ENDIF.

ENDLOOP.

The above code which i have tried out changes the whole screen and i am not able to understand the user command function .The user command is used to trigger the at selection screen but can we write any code in the function code i.e onli in this case.

Please let me know if there are any radio button parameters or anything to be done for this case.

Thanks in advance.

Mithun

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

Try this code it work i have checked it

SELECTION-SCREEN begin OF line.
PARAMETER:
v_p1 RADIOBUTTON GROUP RD USER-COMMAND on MODIF ID AB1.
SELECTION-SCREEN :COMMENT 4(60) text-001.
SELECTION-SCREEN end of LINE.

SELECTION-SCREEN BEGIN OF LINE.
PARAMETER:
v_p2 RADIOBUTTON GROUP RD MODIF ID AB2.
SELECTION-SCREEN :COMMENT 4(60) text-002.
SELECTION-SCREEN end of LINE.

AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF v_p1 = 'X'.
IF SCREEN-name = 'V_P2'. " Change
SCREEN-INPUT = '0'.
SCREEN-INTENSIFIED = '0'.
MODIFY SCREEN.
ENDIF.

ELSE.
IF v_p2 = 'X'.
IF SCREEN-name = 'V_P1'. " Change
SCREEN-INPUT = '0'.
SCREEN-INTENSIFIED = '0'.
MODIFY SCREEN.
endif.
ENDIF.
ENDIF.
ENDLOOP.

Regards,

Madhukar Shetty

8 REPLIES 8

Former Member
0 Kudos

Hi,

Well i dont see the need to grey out other options for radio button, as they are part of one group.

anyhow according to the property of radio button only one radio button can be selected at a time if they belong to the same group.

0 Kudos

Hi,

Yes , it is true that only one option can be selected in case of radio button , but is it possible to change the format for the selected option or the other remaining options.

thanks,

Mithun

Former Member
0 Kudos

Hi

Please check with screen-active = 0.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETER:

V_P1 RADIOBUTTON GROUP RD USER-COMMAND ONLI MODIF ID AB1.

SELECTION-SCREEN :COMMENT 4(60) TEXT-001.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETER:

V_P2 RADIOBUTTON GROUP RD MODIF ID AB2.

SELECTION-SCREEN :COMMENT 4(60) TEXT-002.

SELECTION-SCREEN END OF LINE.

SELECT-OPTIONS: S1 FOR XXX MODIF ID AB1.

SELECT-OPTIONS: S2 FOR XXX MODIF ID AB2.

AT SELECTION-SCREEN.

IF SY-UCOMM = 'ONLI'.

IF G1 IS INITIAL.

REFRESH S1.

ELSE.

REFRESH S2.

ENDIF.

ELSE.

IF NOT G1 IS INITIAL.

DO CHECK S1.

ELSE.

DO CHECK S2.

ENDIF.

ENDIF

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

CASE SCREEN-GROUP1.

WHEN 'AB1'.

IF V_P1 IS INITIAL.

SCREEN-INPUT = '0'.

SCREEN-INTENSIFIED = '0'.

SCREEN-ACTIVE = '0'.

MODIFY SCREEN.

ENDIF.

WHEN 'AB2'.

IF V_P2 IS INITIAL.

SCREEN-INPUT = '0'.

SCREEN-INTENSIFIED = '0'.

SCREEN-ACTIVE '0'.

MODIFY SCREEN.

ENDIF.

ENDCASE.

ENDLOOP.

Vinodh

Edited by: Vinodh_AN on Nov 19, 2010 6:51 AM

Former Member
0 Kudos

HI,

Try this code it work i have checked it

SELECTION-SCREEN begin OF line.
PARAMETER:
v_p1 RADIOBUTTON GROUP RD USER-COMMAND on MODIF ID AB1.
SELECTION-SCREEN :COMMENT 4(60) text-001.
SELECTION-SCREEN end of LINE.

SELECTION-SCREEN BEGIN OF LINE.
PARAMETER:
v_p2 RADIOBUTTON GROUP RD MODIF ID AB2.
SELECTION-SCREEN :COMMENT 4(60) text-002.
SELECTION-SCREEN end of LINE.

AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF v_p1 = 'X'.
IF SCREEN-name = 'V_P2'. " Change
SCREEN-INPUT = '0'.
SCREEN-INTENSIFIED = '0'.
MODIFY SCREEN.
ENDIF.

ELSE.
IF v_p2 = 'X'.
IF SCREEN-name = 'V_P1'. " Change
SCREEN-INPUT = '0'.
SCREEN-INTENSIFIED = '0'.
MODIFY SCREEN.
endif.
ENDIF.
ENDIF.
ENDLOOP.

Regards,

Madhukar Shetty

0 Kudos

@madhukar

What if I want to re-select 1st option after selecting 2nd option?

0 Kudos

Hi Madhukar,

Thank you, it is working.

thanks ,

mithun

0 Kudos

HI vinod,

Yes i agree with you but This was his requirement .

Regards,

Madhukar Shetty

Former Member
0 Kudos

answered