cancel
Showing results for 
Search instead for 
Did you mean: 

Checkbox in ALV to be checked by default

Former Member
0 Kudos

Hi
i have used checkbox in alv. i need it be checked default . tried setting defualt value of attribute it not working
my code.
  lt_columns = column_settings->get_columns( ).


  LOOP AT lt_columns ASSIGNING <fs_column>.
   CASE <fs_column>-id.
   WHEN 'PENDING'.
   CREATE OBJECT lr_checkbox
   EXPORTING
   checked_fieldname = <fs_column>-id.
    <fs_column>-r_column->set_cell_editor( lr_checkbox ).
     FREE lr_checkbox.
   ENDCASE.
  ENDLOOP.

i want check box to be set checked by default

Accepted Solutions (0)

Answers (4)

Answers (4)

chengalarayulu
Active Contributor
0 Kudos

You can do in this way..

1. Loop the entire records which to be bound to ALV Table,

Loop at LT_ALV_TAB into LS_ALV_TAB.

LS_ALV_TAB-PENDING = 'X' """ It should be CHAR1 or WDY_BOOLEAN type

modify LT_ALV_TAB from LS_ALV_TAB.

endloop.

Hope it may help you.

Former Member
0 Kudos

Pass 'X' to the column/field in the internal table that you populated for the ALV Data. and not sure why would need to call Free on the checkbox.

In case below I passed the 'X' to the field statu(S as column name) while populating the Internal table and bind it to the context data which you use for the mapping to the ALV data.

Cheers

Former Member
0 Kudos

any help on this

Former Member
0 Kudos

I think FREE lr_checkbox is not the correct way to do it.

I believe you need to make it ABAP_FALSE in a method.Please check methods in column settings.

Former Member
0 Kudos

any help on this