cancel
Showing results for 
Search instead for 
Did you mean: 

How to add checkbox to the alv in webdynpro

former_member226225
Contributor
0 Kudos

     Hi ,

          how to add checkbox to alv in webdynpro .

Thanks,

Raghunadh.

Accepted Solutions (1)

Accepted Solutions (1)

farooq_basha
Active Participant
0 Kudos

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

former_member226225
Contributor
0 Kudos

Hi Farooq,

     

            ok fine , code is working then if i select checkbox i have to get the data .

           Points will be rewarded for Helpful Answer.

Thanks,

Raghunadh K

farooq_basha
Active Participant
0 Kudos

Hi Raghu,

Please check the below link for ur reference....

http://scn.sap.com/thread/1399517

http://scn.sap.com/message/7780412

Regards,

Farooq

Former Member
0 Kudos

Hi Farooq,

thanks in advance.

Above code is very help full,and i am trying to check it but it is not allowing .

Regards,

Rajendra.

former_member190321
Participant
0 Kudos

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

Former Member
0 Kudos

Thank you Farooq.its working.

Regards,

Rajendra

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Please check out the following thread.

http://scn.sap.com/thread/1399517

Regards,

Fareez

former_member226225
Contributor
0 Kudos

Hi Fareez,

                I already checked ,  it is incomplete can you send the exact code.

Thanks,

Raghunadh.

Former Member
0 Kudos

Hi,

Please check out the following thread.

http://scn.sap.com/thread/1399517

Regards,

Fareez