on 04-30-2012 7:30 AM
Hi ,
how to add checkbox to alv in webdynpro .
Thanks,
Raghunadh.
Hi Raghu,
Check the below code....To make cell edit, check box and add image.
For check box create the node attribute as boolean i.e.,WDY_BOOLEAN for check box
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 'BOOKINGID'.
CREATE OBJECT lr_link.
lr_link->set_text_fieldname( <fs_column>-id ).
<fs_column>-r_column->set_cell_editor( lr_link ).
WHEN 'RESERVED'. " Ur Column name
CREATE OBJECT lr_checkbox
EXPORTING
checked_fieldname = <fs_column>-id.
<fs_column>-r_column->set_cell_editor( lr_checkbox ).
FREE lr_checkbox.
WHEN 'CANCELLED'.
CREATE OBJECT lr_image.
lr_image->set_source_fieldname( <fs_column>-id ).
<fs_column>-r_column->set_cell_editor( lr_image ).
FREE lr_image.
ENDCASE.
ENDLOOP.
Regards,
Farooq
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raghu,
Please check the below link for ur reference....
http://scn.sap.com/thread/1399517
http://scn.sap.com/message/7780412
Regards,
Farooq
Hi,
You start by creating an attribute in the Context of type CHAR1. and then got to the on toggle event of the checkbox and then, create an event. open the event, click on the Code Wizard tool, Check the read Radio button, Click on context, select your attribute and then click ok. Now you can use the imported value of the attribute to modify your alv.That is, when is marked with 'X', show the data,else hide the data. Hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
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.