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

Select or Deselect All Checkboxes on a Selection Screen

Former Member
0 Likes
4,085

Hi,

I have a list of many checkboxes on a standard selection screen, I’ve added buttons that “Select All” and “Deselect All” the checkboxes. The code I’ve 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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,186

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.

Hi,

I have a list of many checkboxes on a standard selection screen, I’ve added buttons that “Select All” and “Deselect All” the checkboxes. The code I’ve 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.

8 REPLIES 8
Read only

Former Member
0 Likes
2,186
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...

Read only

Former Member
0 Likes
2,186

You need to add <b>modify screen</b> statement in

loop at screen--endloop.

Read only

Former Member
0 Likes
2,186

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

Read only

0 Likes
2,186

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

Read only

0 Likes
2,186

Thanks Ravi, your suggestion worked.

Regards,

Cara.

Read only

Former Member
0 Likes
2,187

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.

Read only

0 Likes
2,186

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.

Read only

Former Member
0 Likes
2,186

Instead of using selection texts , try using SELECTION-SCREEN COMMENT