2005 Dec 29 11:15 AM
Hi,
I have a list of many checkboxes on a standard selection screen, Ive added buttons that Select All and Deselect All the checkboxes. The code Ive used is shown below:
selection-screen pushbutton
/01(15) p_sall user-command sall modif id mod.
selection-screen pushbutton
20(15) p_dall user-command dall modif id mod.
parameters: p_mandt as checkbox modif id t01,
p_zbukr as checkbox modif id t01,
p_rzawe as checkbox modif id t01,
p_chect as checkbox modif id t01,
p_checf as checkbox modif id t01,
p_laufd as checkbox modif id t01 and so on
at selection-screen.
If Select All button has been pressed then select all the checkbox
fields
if sscrfields-ucomm = 'SALL'.
perform select_all.
endif.
If Deselect All button has been pressed then deselect all the
checkbox fields
if sscrfields-ucomm = 'DALL'.
perform deselect_all.
endif.
form select_all.
field-symbols <fs1> type any.
loop at screen.
if screen-group1 = 'T01'.
assign (screen-name) to <fs1>.
<fs1> = 'X'.
endif.
endloop.
form deselect_all.
field-symbols <fs1> type any.
loop at screen.
if screen-group1 = 'T01'.
assign (screen-name) to <fs1>.
clear <fs1>.
endif.
endloop.
My problem is that when the Select All button is pressed, the checkboxes are all selected but the selection text for all the checkboxes changes to X, and when the Deselect All button is pressed the selection text for all the checkboxes is cleared. Is there any way of doing this without setting each checkbox individually to X (as there are a lot of checkboxes)?
I am using version 4.6c.
Any help will be greatly appreciated.
Regards,
Cara.
2005 Dec 29 11:36 AM
Hi Cara,
1 replace ur FORMS with this.
2. It works fantastic.
3.
&----
*& Form select_all
&----
text
----
FORM select_all.
FIELD-SYMBOLS <fs1> TYPE ANY.
LOOP AT SCREEN.
IF screen-group1 = 'T01'.
IF screen-name NS 'TEXT'.
ASSIGN (screen-name) TO <fs1>.
<fs1> = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. "select_all
&----
*& Form deselect_all
&----
text
----
FORM deselect_all.
FIELD-SYMBOLS <fs1> TYPE ANY.
LOOP AT SCREEN.
IF screen-group1 = 'T01'.
IF screen-name NS 'TEXT'.
ASSIGN (screen-name) TO <fs1>.
CLEAR <fs1>.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. "deselect_all
Regards,
Amit M.
2005 Dec 29 11:19 AM
form select_all.
field-symbols <fs1> type any.
loop at screen.
if screen-group1 = 'T01'.
assign (screen-name) to <fs1>.
<b><fs1> = 'X'.</b>
endif.
endloop.because of the above code...
2005 Dec 29 11:20 AM
You need to add <b>modify screen</b> statement in
loop at screen--endloop.
2005 Dec 29 11:20 AM
HI Cara,
I Think the screen Group name is the same for even the selection screen texts also. Try giving labels, instead of Selection screen texts for the check boxes.
Regards,
Ravi
2005 Dec 29 11:32 AM
Hi.
While looping at the SSIT ( Screen System Internal Table ),it is always necessary to use MODIFY SCREEN before ending the loop.
Thanks,
Maheshwari.V
2005 Dec 29 11:36 AM
2005 Dec 29 11:36 AM
Hi Cara,
1 replace ur FORMS with this.
2. It works fantastic.
3.
&----
*& Form select_all
&----
text
----
FORM select_all.
FIELD-SYMBOLS <fs1> TYPE ANY.
LOOP AT SCREEN.
IF screen-group1 = 'T01'.
IF screen-name NS 'TEXT'.
ASSIGN (screen-name) TO <fs1>.
<fs1> = 'X'.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. "select_all
&----
*& Form deselect_all
&----
text
----
FORM deselect_all.
FIELD-SYMBOLS <fs1> TYPE ANY.
LOOP AT SCREEN.
IF screen-group1 = 'T01'.
IF screen-name NS 'TEXT'.
ASSIGN (screen-name) TO <fs1>.
CLEAR <fs1>.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. "deselect_all
Regards,
Amit M.
2005 Dec 29 11:42 AM
Hi Amit,
I was just creating comments for all the checkboxes (there are lots of them!) when I saw your reply, and it works. So thank you very much for your help.
Regards,
Cara.
2005 Dec 29 11:37 AM
Instead of using selection texts , try using SELECTION-SCREEN COMMENT