on 10-26-2009 3:04 PM
Hi,
in my component I am displaying a table. I need to add functionality to this tableview, so that enduser can tick one ore more rows, and then let the method record the ticked row(s).
Could anyone please help, with a step to step guide, from the tablecontex tlevel and up ?
Thank you.
Regards
Arne Jakob
You can create a check box in ALV using the following code.
First create an attribute of type boolean for the checkbox column and bind it and use the following code to populate ALV with checkbox
METHOD WDDOINIT.
DATA:
lr_alv_usage TYPE REF TO if_wd_component_usage,
lr_if_controller TYPE REF TO iwci_salv_wd_table,
lr_config TYPE REF TO cl_salv_wd_config_table,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lt_columns TYPE salv_wd_t_column_ref,
lr_link TYPE REF TO cl_salv_wd_uie_link_to_action,
lr_checkbox TYPE REF TO cl_salv_wd_uie_checkbox,
lr_image type ref to cl_salv_wd_uie_image.
FIELD-SYMBOLS
<fs_column> LIKE LINE OF lt_columns.
* Instantiate the ALV Component
lr_alv_usage = wd_this->wd_cpuse_cmp_alv( ).
IF lr_alv_usage->has_active_component( ) IS INITIAL.
lr_alv_usage->create_component( ).
ENDIF.
* Get reference to model
lr_if_controller = wd_this->wd_cpifc_cmp_alv( ).
lr_config = lr_if_controller->get_model( ).
* Set the UI elements.
lr_column_settings ?= lr_config.
lt_columns = lr_column_settings->get_columns( ).
LOOP AT lt_columns ASSIGNING <fs_column>.
CASE <fs_column>-id.
WHEN 'CHECKBOX'.
CREATE OBJECT lr_checkbox
EXPORTING
checked_fieldname = <fs_column>-id.
<fs_column>-r_column->set_cell_editor( lr_checkbox ).
FREE lr_checkbox.
WHEN 'OTHERS'.
ENDCASE.
ENDLOOP.
ENDMETHOD.
"Now implement the OnCLick event . This event will be triggered whenever a chekcbox is ticked.
In this method you can fill your internal table with rows that are selected using the checkbox
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
To create Checkbox inside an AlV Column , refer this blog :
To create an event for Checkbox created refer this thread:
SAP Online help on Various Events of ALV:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/12093591152464e10000000a1553f7/frameset.htm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.