cancel
Showing results for 
Search instead for 
Did you mean: 

Editable Check Box/ALV

Former Member
0 Kudos

Hi,

I am using the following code to create a check box in ALV grid , but the check box is not is editable mode to check and uncheck any suggestions would be helpfull.

method WDDOMODIFYVIEW .

DATA: lr_column type ref to cl_salv_wd_column,

lr_checkbox type ref to cl_salv_wd_uie_checkbox.

DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,

lr_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE,

l_VALUE type ref to Cl_Salv_Wd_Config_Table.

lr_INTERFACECONTROLLER = wd_This->wd_cpifc_alv_comp( ).

l_VALUE = lr_INTERFACECONTROLLER->Get_Model( ).

lr_column_settings ?= l_value.

if not l_value is initial.

lr_column = l_value->if_salv_wd_column_settings~get_column( 'STATUS' ).

endif.

create object lr_checkbox

EXPORTING

checked_fieldname = 'STATUS'.

lr_checkbox->set_enabled( abap_true ).

lr_column->set_cell_editor( lr_checkbox ).

endmethod.

Thanks,

Kumar.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In the node that you are binding to ALV, create a conetxt attribute of type char1(SELECT).

Fill the table for char1 field as 'X' or space for all the rows.

loop at lt_table into ls_table.
lv_tabix = sy-tabix.
ls_table-select = 'X'.            
modify lt-table..... index lv_tabix transporting select.
endif.

Now in the lr_checkbox object use the method SET_CHECKED_FIELDNAME and pass this context attribute(char1) field name.

*  create object lr_check
*    EXPORTING
*      checked_fieldname = 'SELECT'.

X means checked, space means unchecked.

Please try this way.

Regards,

Lekha.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Kumar,

I ran into the same issue before, and the only solution I found is to set the edit mode in ALV table to abap true.

It worked just fine for me

data: lr_table_settings type ref to if_salv_wd_table_settings.

lr_table_settings ?= lo_value.

lr_table_settings->set_read_only( abap_false ).

Abdul

Former Member
0 Kudos

Hi,

The following code fine in editing the check box , I am looking to get the returned values of the selected row of the ALV grid that also includes the check box values ( Checked/Unchecked) , Any sample code to achive this ..

data: lr_table_settings type ref to if_salv_wd_table_settings.

data: t_value type string.

lr_table_settings ?= l_value.

lr_table_settings->set_read_only( abap_false ).

Thanks,

Kumar.

Former Member
0 Kudos

Hi Kumar,

You can create an event handler/action for capturing the check box click in ALV table.

Follow these steps:-

1. Goto the Methods tab.

2. Give the Method a name

3. Select Method type as 'Event Handler'

4. In the Event Column, Do F4 and select 'On Click' Event.

Now you event handler is ready, write the code in here to get the chekcbox values along with the dteails of the entire row.

You can use wdevent and r_param parameters to retrieve the values.

Hope this helps you.

Radhika Vadher.