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

ALV --- Grid/List

Former Member
0 Likes
776

Hi there,

I would like to create a checkbox on the ALV list output..I used the option Checkbox when doing the field catalogue ,but the problem is the checkbox is not clickable..

Can u please help on which options must I use to have a clickable checkbox on an ALV list(NB not Grid)

and Again How do I see which lines have been selected

(if more than one check box marked) . At user command I used internal table of type slis_selfield and it only shows on the field tabix it only shows 1 field which is the last to be marked..Please advise on how to keep track of all the marked rows..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
748

Hi,

these three must...

<b>fieldcat-checkbox = 'X'.

fieldcat-input = 'X'.

fieldcat-edit = 'X'.</b>

and you have to loop and find the rows where the selection is made.

<b>loop at itab where chk = 'X'.

"here you get all the Checked records...

endloop.</b>

Regards

vijay

6 REPLIES 6
Read only

Former Member
0 Likes
748

Hi makgatho,

1. To get a taste of it,

just copy paste this program.

2. It will display alv (t001)

It will show CHECKBOXES (besides every row)

TICK some rows,

and DOUBLE-CLICK ON any row.

3. It will display all the row numbers which have been checked/ticked.

4.

report abc.

TYPE-POOLS : slis.

*----


Data

DATA : BEGIN OF itab OCCURS 0.

INCLUDE STRUCTURE t001.

DATA : flag tyPE c,

END OF itab.

DATA : alvfc TYPE slis_t_fieldcat_alv.

DATA : alvly TYPE slis_layout_alv.

*----


Select Data

SELECT * FROM t001 INTO TABLE itab.

*------- Field Catalogue

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_inclname = sy-repid

CHANGING

ct_fieldcat = alvfc

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

*----


Display

alvly-box_fieldname = 'FLAG'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

it_fieldcat = alvfc

i_callback_program = sy-repid "<-------Important

i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important

is_layout = alvly

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

*----


  • CALL BACK FORM

*----


FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE

slis_selfield.

data : msg(100) type c.

LOOP AT itab.

if itab-flag = 'X'.

msg = sy-tabix.

condense msg.

concatenate 'Row Number ' msg ' ' into msg

separated by space.

message msg type 'I'.

endif.

ENDLOOP.

ENDFORM. "ITAB_user_command

regards,

amit m.

Read only

Former Member
0 Likes
749

Hi,

these three must...

<b>fieldcat-checkbox = 'X'.

fieldcat-input = 'X'.

fieldcat-edit = 'X'.</b>

and you have to loop and find the rows where the selection is made.

<b>loop at itab where chk = 'X'.

"here you get all the Checked records...

endloop.</b>

Regards

vijay

Read only

0 Likes
748

Thanx.. This was really helpfull.

Js another question .. is it possible that I can have all rows marked by default..

Read only

0 Likes
748

Hi,

yes it is possible.

Before calling the ALV FM, populate the field(checkbox).

loop at itab.
itab-check = 'X'.
modify itab.
endloop.

Now send this itab to ALV FM.

Regards

vijay

Read only

Former Member
0 Likes
748

Hi Makgatho,

You have set the property Edit for checkbox to be editable

There is a method available GET_SELECTED_ROWS

Regards

Arun

Read only

Former Member
0 Likes
748

Hi,

Yes, it is possible to have all rows checked by

default. Just populate the field in your internal table by value 'X'.

Regards,

Sandeep