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

disabling checkboxes

Former Member
0 Likes
1,293

Hi all,

In my selection screen there are four check boxes ,can anybody suugest me any way so that if user click on any one check box then the selection field of other checkboxes get disabled.

thanks in advance.

12 REPLIES 12
Read only

former_member156446
Active Contributor
0 Likes
1,270

Hi check the forum for loop at screen, there you can find the solution...

you will be using at selection screen event and loop at structure SCREEN.

Read only

Former Member
0 Likes
1,270

Hi,

And how will you enable them again ? Why dont you use Radiobutton isntead of checkbox. your requirement will be solved easily.

regards,

Advait

Edited by: Advait Gode on Nov 21, 2008 2:19 PM

Read only

0 Likes
1,270

Is there no way to to use group keyword in check boxes as used by radio buttons..

Read only

0 Likes
1,270

as far as I know there is not option for checkboxes like groups for radio buttons.

but you can give a same Modif ID for all the checkboxes.

Read only

0 Likes
1,270

No, there is no way to assign a Group to Checkboxes. However if you insist to use use checkbox instead of radiobuttons, you will have to program this in AT SELECTION-SCREEN event by assigning a user command to each check box so that it triggers a PAI and there you can check which check box was selected and uncehck the rest of the checkboxes.


PARAMETERS : chk_1 AS CHECKBOX USER-COMMAND usr1.
PARAMETERS : chk_2 AS CHECKBOX USER-COMMAND usr2.
PARAMETERS : chk_3 AS CHECKBOX USER-COMMAND usr3.
PARAMETERS : chk_4 AS CHECKBOX USER-COMMAND usr4.


AT SELECTION-SCREEN.

  CASE sy-ucomm.
    WHEN 'USR1'.
      CLEAR : chk_2, chk_3, chk_4.
    WHEN 'USR2'.
      CLEAR : chk_1, chk_3, chk_4.
    WHEN 'USR3'.
      CLEAR : chk_1, chk_2, chk_4.
    WHEN 'USR4'.
      CLEAR : chk_1, chk_2, chk_3.
  ENDCASE.

But I would still recommend you use radiobutton

regards,

Advait

Edited by: Advait Gode on Nov 21, 2008 3:24 PM

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,270

does it mean, that only one checkbox can be selected at a time? than why don't you use radiobuttons (instead of checkboxes)? The funcionality you need will come automatically...

Read only

Former Member
0 Likes
1,270

use AT SELECTION-SCREEN on output.

event

and by using

loop at screen .

modify screen.

endloop.

and by using screen structure you can achieve it.

Read only

Former Member
0 Likes
1,270

Here i am giving sample code of radio buttons.similate same for your requirement

selection-screen begin of block b2 with frame title text-002.

parameters : r1 radiobutton group g1 user-command sd.

parameters : r2 radiobutton group g1 .

parameters : r3 radiobutton group g1 .

selection-screen end of block b2.

selection-screen begin of block b3 with frame title text-007.

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

PARAMETERS:p_file(90) modif id bbb.

SELECTION-SCREEN END OF BLOCK b1.

selection-screen end of block b3.

AT SELECTION-SCREEN OUTPUT.

IF r3 = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'BBB'.

screen-input = '1'.

screen-active = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

endif.

Read only

former_member404244
Active Contributor
0 Likes
1,270

Hi,

Advait is correct..use radiobuttons instead...have a look at the below sample code..

IF p_pserv IS INITIAL.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'P_PFILE1'.

screen-input = 0.

MODIFY SCREEN.

WHEN 'P_PFILE2'.

screen-input = 0.

MODIFY SCREEN.

WHEN 'P_ERRFL1'.

screen-input = 0.

MODIFY SCREEN.

WHEN 'P_ERRFL2'.

screen-input = 0.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'P_AFILE1'.

screen-input = 0.

MODIFY SCREEN.

WHEN 'P_AFILE2'.

screen-input = 0.

MODIFY SCREEN.

WHEN 'P_AERFL1'.

screen-input = 0.

MODIFY SCREEN.

WHEN 'P_AERFL2'.

screen-input = 0.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

ENDIF.

Regards,

Nagaraj

Read only

Former Member
0 Likes
1,270

Find below code for similar scenario for radio buttons... Change code accordingly for checkbox...

REPORT Z_SDN_TEST_1 message-id zz.

----


  • S E L E C T I O N S C R E E N

----


SELECTION-SCREEN BEGIN OF BLOCK FILE WITH FRAME TITLE TEXT-000.

SELECTION-SCREEN : BEGIN OF LINE.

PARAMETERS: RB_APPN RADIOBUTTON GROUP RAD1 DEFAULT 'X' USER-COMMAND RAD.

SELECTION-SCREEN COMMENT 3(25) TEXT-030.

PARAMETERS: RB_PRTN RADIOBUTTON GROUP RAD1.

SELECTION-SCREEN COMMENT 32(20) TEXT-031.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN END OF BLOCK FILE.

----


  • A T S E L E C T I O N - S C R E E N O U T P U T

----


AT SELECTION-SCREEN OUTPUT.

PERFORM F_MODIFY_SCREEN.

&----


*& Form F_MODIFY_SCREEN

&----


  • text

----


FORM F_MODIFY_SCREEN .

*-- For Output Options

IF RB_PRTN = 'X'.

LOOP AT SCREEN.

IF SCREEN-NAME = 'RB_APPN' .

SCREEN-OUTPUT = 1.

SCREEN-INPUT = 0.

SCREEN-ACTIVE = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

IF RB_APPN = 'X'.

LOOP AT SCREEN.

IF SCREEN-NAME = 'RB_PRTN' .

SCREEN-OUTPUT = 1.

SCREEN-INPUT = 0.

SCREEN-ACTIVE = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Read only

Former Member
0 Likes
1,270

REPORT ZSRK_074 .

PARAMETER : P_CH1 AS CHECKBOX,

P_CH2 AS CHECKBOX,

P_CH3 AS CHECKBOX,

P_CH4 AS CHECKBOX.

AT SELECTION-SCREEN OUTPUT.

IF P_CH1 EQ 'X'.

PERFORM DISABLE_CHECKBOX USING 'P_CH2'

'P_CH3'

'P_CH4'.

ELSEIF P_CH2 EQ 'X'.

PERFORM DISABLE_CHECKBOX USING 'P_CH1'

'P_CH3'

'P_CH4'.

ELSEIF P_CH3 EQ 'X'.

PERFORM DISABLE_CHECKBOX USING 'P_CH1'

'P_CH2'

'P_CH4'.

ELSEIF P_CH4 EQ 'X'.

PERFORM DISABLE_CHECKBOX USING 'P_CH1'

'P_CH2'

'P_CH3'.

ENDIF.

&----


*& Form DISABLE_CHECKBOX

&----


  • text

----


  • -->P_P_CH2 text

  • -->P_P_CH3 text

  • -->P_P_CH4 text

----


FORM DISABLE_CHECKBOX USING CH1

CH2

CH3.

LOOP AT SCREEN.

IF SCREEN-NAME CS CH1 OR SCREEN-NAME CS CH2 OR SCREEN-NAME CS CH3 .

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDFORM. " DISABLE_CHECKBOX

Read only

Former Member
0 Likes
1,270

Hello,

Its better to use radio buttons rather than going for the check boxes.

Regards,

Vivek