cancel
Showing results for 
Search instead for 
Did you mean: 

ALV checkbox

Former Member
0 Kudos

Hi,  can anyone tell me d steps on How to add a checkbox in ALV??   Thanks  Vijay

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vijay,

Please refer below mentioned code for the same:

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 'CARRID'.

        CREATE OBJECT lr_link.

        lr_link->set_text_fieldname( <fs_column>-id ).

        <fs_column>-r_column->set_cell_editor( lr_link ).

      WHEN 'CONNID'.   "For which checkbox needs to be created

        CREATE OBJECT lr_checkbox

          EXPORTING

            checked_fieldname = <fs_column>-id.

        <fs_column>-r_column->set_cell_editor( lr_checkbox ).

        FREE lr_checkbox.

          ENDCASE.

  ENDLOOP.

Regards,

NS

Former Member
0 Kudos

Thanks Neha Singh..  Problem solved.

Answers (4)

Answers (4)

alessandroieva
Active Participant
0 Kudos

Hi Jitendra

in internal structure (used for the first_display) add one field "checkbox" type flag.

later, modify the catalog table and insert an "X" in the field "CHECKBOX" --> (the catalog field) ....

when you select the checkbox in the 'alv, automatically will be filled with 'X'  the field in the internal table

AI

Former Member
0 Kudos

Hi ,

   Below thread will help you.

 

Regards,

Monishankar Chatterjee

Former Member
0 Kudos

  try using class  cl_salv_wd_uie_checkbox for making column checkbox

Former Member
0 Kudos

Hi Jitendra Yadav,  I have followed your steps , which u have mentioned in d previous blog.  http://scn.sap.com/thread/3327930  But still i could not able to get it..  Can u elaborate the steps.  Thanks  Vijay

Former Member
0 Kudos
Former Member
0 Kudos

Hi BalaSubramanyam Duvvuri ,  Thanks for your reoly.  I am searching WRT alv not table.