05-21-2007 12:13 PM
Hi,
I have two check-boxes pa_abc and pa_def in ALV Grid. If pa_abc is checked, then pa_def should automatically get <b>dis-abled</b> and also should get <b>unchecked</b>.
I have written code for <b>dis-abling</b> pa_def and is working. It is given below.
LOOP AT SCREEN.
IF pa_abc EQ 'X'.
IF screen-name = 'pa_def'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
But, if pa_abc is checked, pa_def should automatically get <b>unchecked</b> too. Kindly, help me to uncheck pa_def. Thanks in advance.
Regards,
Preetha
05-21-2007 12:28 PM
Hi,
Check this sample code.
parameters : p_chk1 as checkbox user-command ABCD default 'X',
p_chk2 as checkbox user-command PQRS.
data: v_clk1 type c value 'X',
v_clk2 type c.
at selection-screen output.
if v_clk1 = 'X'.
p_chk1 = 'X'.
else.
p_chk1 = ' '.
endif.
if v_clk2 = 'X'.
p_chk2 = 'X'.
else.
p_chk2 = ' '.
endif.
at selection-screen.
case sy-ucomm.
when 'ABCD'.
if p_chk1 = 'X'.
v_clk1 = 'X'.
v_clk2 = ' '.
else.
v_clk1 = ' '.
v_clk2 = 'X'.
endif.
when 'PQRS'.
if p_chk2 = 'X'.
v_clk2 = 'X'.
v_clk1 = ' '.
else.
v_clk2 = ' '.
v_clk1 = 'X'.
endif.
endcase.
Regards
Sailaja.
05-21-2007 12:17 PM
Hi Preetha ,
you can get the same functionaity by using Radiobuttons wher you need not write the code for checking and unchecking .
Why d't you try using radio buttons then using checkboxes, as check boxes dunot support your functionality in this kind of casess...
if you need further help , then please respong back ..
Regards,
Ranjita
05-21-2007 12:19 PM
hi preetha....
if cb1 eq 'x'.
clear cb2.
endif.
With regards,
S.Barani
05-21-2007 12:19 PM
LOOP AT SCREEN.
IF screen-name = 'pa_def'.
if pa_abc = 'X'.
screen-input = ' '.
it should be either space of 'X'
MODIFY SCREEN.
ENDIF.
vice versa
ENDLOOP.
05-21-2007 12:28 PM
Hi,
Check this sample code.
parameters : p_chk1 as checkbox user-command ABCD default 'X',
p_chk2 as checkbox user-command PQRS.
data: v_clk1 type c value 'X',
v_clk2 type c.
at selection-screen output.
if v_clk1 = 'X'.
p_chk1 = 'X'.
else.
p_chk1 = ' '.
endif.
if v_clk2 = 'X'.
p_chk2 = 'X'.
else.
p_chk2 = ' '.
endif.
at selection-screen.
case sy-ucomm.
when 'ABCD'.
if p_chk1 = 'X'.
v_clk1 = 'X'.
v_clk2 = ' '.
else.
v_clk1 = ' '.
v_clk2 = 'X'.
endif.
when 'PQRS'.
if p_chk2 = 'X'.
v_clk2 = 'X'.
v_clk1 = ' '.
else.
v_clk2 = ' '.
v_clk1 = 'X'.
endif.
endcase.
Regards
Sailaja.
05-21-2007 12:33 PM
Hi
Instead of checkbox define the radiobuttons . extra coding is not required for unchecking. When u use a radio button, there are two parameters defined. Depending on which button is selected the value for that is set to 'X' and the other is set to space. To use this option all you have to do is assign both the radio buttons to one group.