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

Checkbox disable

Former Member
0 Likes
2,664

Hi Experts,

How can i disable checkbox when i click on another check box and vise-versa.

Regards.

AADI.

Edited by: Alvaro Tejada Galindo on Apr 25, 2008 5:35 PM

11 REPLIES 11
Read only

former_member210123
Active Participant
0 Likes
1,550

example

there are two check boxes.

at selection screen output

if chek_1 = 'X'.

check_2 = ' '.

endif.

Read only

0 Likes
1,550

Hi,

see there are 4 check boxes on the selection screen.

3 comes in one selection-screen and 1 in another selection-screen.

when i check any one of the 3 checkboxes the other one in another selection-screen has to be disabled but it should be visible to the user.

regards,

aadi

Read only

rahul_kamble2
Participant
0 Likes
1,550

Is it compulsory to use Check Box? you can use Radiobutton instead...let me know if the requirement is to use only CheckBox.

Read only

0 Likes
1,550

Hi,

Yes its compulsary to use checkboxes.

regards,

aadi

Read only

0 Likes
1,550

try below code in test program. it works.

REPORT zrhk_test.

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

PARAMETERS:c1 AS CHECKBOX USER-COMMAND c1,

c2 AS CHECKBOX USER-COMMAND c2,

c3 AS CHECKBOX USER-COMMAND c3.

SELECTION-SCREEN END OF BLOCK b1.

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

PARAMETERS:c4 AS CHECKBOX USER-COMMAND c4.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

IF c1 = 'X'.

LOOP AT SCREEN.

IF screen-name = 'C2'

OR screen-name = 'C3'

OR screen-name = 'C4'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF c2 = 'X'.

LOOP AT SCREEN.

IF screen-name = 'C1'

OR screen-name = 'C3'

OR screen-name = 'C4'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF c3 = 'X'.

LOOP AT SCREEN.

IF screen-name = 'C1'

OR screen-name = 'C2'

OR screen-name = 'C4'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF c4 = 'X'.

LOOP AT SCREEN.

IF screen-name = 'C1'

OR screen-name = 'C2'

OR screen-name = 'C3'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Read only

Former Member
0 Likes
1,550

Hi,

see this code.


PARAMETERS:c1 as CHECKBOX USER-COMMAND ucom,
c2 AS CHECKBOX.

AT SELECTION-SCREEN OUTPUT.
  IF c1 = 'X'.
    LOOP AT SCREEN.
      IF screen-name = 'C2'.
        screen-input = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

rgds,

bharat.

Read only

0 Likes
1,550

Hi Bharat Kalagara

its working but see i will explain u clearly.

here with ur example c1 checkbox i have taken 3 checkboxes on one selection-screen and for c2 i have taken 1 checkbox on another selection-screen.

c1---- 3 checkboxes

c2----- 1 checkbox

when i click on any one checkbox in c1 the checkbox in c2 selection-screen has to be disabled and when i click on c2 checkbox all the 3 checkboxes in c1 has to be disabled.

so please let me as soon as possible.

reagrds,

aadi

Read only

0 Likes
1,550

Hi ad,

try this short examples. It works with checkboxes.

SELECTION-SCREEN: BEGIN OF BLOCK A01 WITH FRAME TITLE T_A01.

PARAMETERS: P1 AS CHECKBOX DEFAULT 'X' USER-COMMAND F1 MODIF ID DI1.

PARAMETERS: P2 AS CHECKBOX USER-COMMAND F1 MODIF ID DI1.

PARAMETERS: P3 AS CHECKBOX USER-COMMAND F1 MODIF ID DI1.

SELECTION-SCREEN: END OF BLOCK A01.

SELECTION-SCREEN: BEGIN OF BLOCK A02 WITH FRAME TITLE T_A02.

PARAMETERS: P4 AS CHECKBOX USER-COMMAND F1 MODIF ID DI2.

SELECTION-SCREEN: END OF BLOCK A02.

*

AT SELECTION-SCREEN OUTPUT.

*

IF P1 = 'X' OR P2 = 'X' OR P3 = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 EQ 'DI2'.

SCREEN-ACTIVE = '0'.

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

P4 = SPACE.

ELSE.

LOOP AT SCREEN.

IF SCREEN-GROUP1 EQ 'DI2'.

SCREEN-ACTIVE = '1'.

SCREEN-INPUT = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

*

IF P4 = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 EQ 'DI1'.

SCREEN-ACTIVE = '0'.

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

P1 = SPACE.

P2 = SPACE.

P3 = SPACE.

ELSE.

LOOP AT SCREEN.

IF SCREEN-GROUP1 EQ 'DI1'.

SCREEN-ACTIVE = '1'.

SCREEN-INPUT = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

*

INITIALIZATION.

*

T_A01 = 'First Input'.

T_A02 = 'Second Input'.

*

Hope it helps.

Regards, Dietere

Read only

Former Member
0 Likes
1,550

Hi ,

Go through this report surelt it will help you.

report zcheckbox.

parameters: p_cat8 as checkbox user-command chk.

parameters: p_lifnr type lfa1-lifnr modif id chk.

parameters: p_belnr type bsak-belnr modif id chk.

at selection-screen output.

if p_cat8 ne 'X'."p_cat8 = space.

loop at screen.

if screen-group1 = 'CHK'.

screen-input = '0'.

modify screen.

endif.

endloop.

endif.

at selection-screen.

check sy-ucomm 'CHK'.

if p_cat8 = 'X'.

if p_lifnr is initial.

message e001(00) with 'Please fill in the LIFNR field'.

endif.

if p_belnr is initial.

message e001(00) with 'Please fill in the BELNR field'.

endif.

endif.

Regards,

Raj.

Read only

Former Member
0 Likes
1,550

hii

u can use different facility of modify statement.

if box = 'X'.

MODIFY LINE sy-lilli FIELD VALUE box

FIELD FORMAT box INPUT OFF.

it will make checkbox inpu disable.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Apr 25, 2008 5:36 PM

Read only

Former Member
0 Likes
1,550

Hi,

Use the below code.

PARAMETERS: CHK1 AS CHECKBOX USER-COMMAND RUSR,

CHK2 AS CHECKBOX USER-COMMAND RUSR.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF CHK1 = 'X'.

IF SCREEN-NAME = 'CHK2'.

SCREEN-INPUT = 0.

ENDIF.

ELSEIF CHK2 = 'X'.

IF SCREEN-NAME = 'CHK1'.

SCREEN-INPUT = 0.

ENDIF.

ENDIF.

MODIFY SCREEN.

ENDLOOP.