Application Development 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: 

Checkbox in a list

Former Member
0 Kudos

Hi ,

is there any method by which we can select/deselect all the checkboxes on a screen.

Regards

Arun

1 ACCEPTED SOLUTION

athavanraja
Active Contributor
0 Kudos

If its on a list screen then you can have two button for select all and deselect all and on user command you can use one of the forms below.


form select_all.
  wf_n = 1 .
  do.
    read line wf_n  field value box.
    if sy-subrc ne 0 .
      exit.
    endif.
    if box = space .
      box = 'X'.
      modify line wf_n field value box .
    endif.
    wf_n = wf_n + 1 .
  enddo.
endform.                    " select_all


form deselect_all.
  clear wf_line1.
  clear wf_line.
  wf_n = 1 .
  do.
    read line wf_n  field value box.
    if sy-subrc ne 0 .
      exit.
    endif.
    if box = 'X' .
      box = space.
      modify line wf_n field value box .
      modify line  wf_n  line format color col_normal
      intensified on .
    endif.
    wf_n = wf_n + 1 .
  enddo.
endform.                    " deselect_all

Hope this helps.

Regards

Raja

2 REPLIES 2

Former Member
0 Kudos
  • Sorry I did not read your question correctly and write the code for selection-screen.

REPORT zsilf .

TABLES sscrfields.

FIELD-SYMBOLS:

<fs>.

PARAMETERS:

vbeln LIKE vbak-vbeln,

  • give a groupname for checkboxes

zcheck AS CHECKBOX MODIF ID chk,

zcheck2 AS CHECKBOX MODIF ID chk.

SELECTION-SCREEN PUSHBUTTON /10(20) pushy USER-COMMAND abcd.

INITIALIZATION.

MOVE 'Clear' TO pushy.

AT SELECTION-SCREEN.

CHECK sscrfields-ucomm = 'ABCD'.

LOOP AT SCREEN.

  • clear all checkboxes

CHECK screen-group1 EQ 'CHK'.

ASSIGN (screen-name) TO <fs>.

CLEAR <fs>.

ENDLOOP.

START-OF-SELECTION.

Message was edited by: Fuat Ulugay

athavanraja
Active Contributor
0 Kudos

If its on a list screen then you can have two button for select all and deselect all and on user command you can use one of the forms below.


form select_all.
  wf_n = 1 .
  do.
    read line wf_n  field value box.
    if sy-subrc ne 0 .
      exit.
    endif.
    if box = space .
      box = 'X'.
      modify line wf_n field value box .
    endif.
    wf_n = wf_n + 1 .
  enddo.
endform.                    " select_all


form deselect_all.
  clear wf_line1.
  clear wf_line.
  wf_n = 1 .
  do.
    read line wf_n  field value box.
    if sy-subrc ne 0 .
      exit.
    endif.
    if box = 'X' .
      box = space.
      modify line wf_n field value box .
      modify line  wf_n  line format color col_normal
      intensified on .
    endif.
    wf_n = wf_n + 1 .
  enddo.
endform.                    " deselect_all

Hope this helps.

Regards

Raja