cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a checkbox to an ALV in WDA?

former_member195355
Participant
0 Kudos

Hiya,

I need a table with a column as a checkbox within my web dynpro.

So I created a structure in the context, where the column for the checkbox is setup as type WDY_BOOLEAN:

Unfortunately in the ALV it appears as a non-editable checkbox:

Anyone know what I've done wrong?

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

To make the ALV editable, use the set_read_only( ) and set the value to abap_false.

  lr_component = wd_this->wd_cpifc_alv( ).

  lr_model = lr_component->get_model( ).

lr_model->if_salv_wd_table_settings~set_read_only( value = abap_false ).

Regards,

Kiran

former_member195355
Participant
0 Kudos

Hiya,

I've added the following code and it seems to work. Could you just check and then I can close this discussion.

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,
       lt_columns         TYPE        salv_wd_t_column_ref.

* Instantiate the ALV Component
   lr_alv_usage = wd_this->wd_cpuse_alv_table( ).

* Get reference to model
   lr_if_controller = wd_this->wd_cpifc_alv_table( ).
   lr_config        = lr_if_controller->get_model( ).

*Enable the non-read only fields to be edited.
   lr_config->if_salv_wd_table_settings~set_read_only( value = abap_false ).


Thanks!

former_member184578
Active Contributor
0 Kudos

Hi,

Yes, It's correct. You can close the discussion.

Regards,

Kiran

former_member195355
Participant
0 Kudos

Sorry but it wasn't working but I've now added this:

** Instantiate the ALV Component
   lr_alv_usage = wd_this->wd_cpuse_alv_table( ).
   IF lr_alv_usage->has_active_component( ) IS INITIAL.
     lr_alv_usage->create_component( ).
   ENDIF.


And it seems to work fine now.

Do you know why thsi would have been needed? Wouldn't the Web Dynpro have activated the ALV component?

former_member184578
Active Contributor
0 Kudos

Hi,

Sry, I hadn't noticed it. You need to initialize the component usage of ALV to get the model reference. Else it would return null.

Regards,

Kiran

Answers (1)

Answers (1)

former_member212124
Active Participant
0 Kudos

Hi,

You can follow as suggested in these links.

1) you have to create a read only attribute in your table's node.

2)   lo_table_settings->set_read_only( abap_false ).

3) lo_column->set_cell_editor( lr_checkbox ).

this link will help you

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

thanks,

vidyasagar