cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO MAKE USER TO ALLOW TO SELECT ONLY ONE CHECKBOX IN ALV WEBDYNPRO

santhosh_nagavalli
Participant
0 Kudos

Hi Experts,

                I  have to allow user to select only one checkbox  from group of records in webdynpro alv table,im already created alv table

can anybody please tell me the logic for this Iam tried a lot but not getting.. advance Thanks.

Thanks & Regards

Santhosh

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

HI Santosh,

Lets consider you have buttons for checkboxes and with their event handler you should call the DATA_CHECK method of the ALV. This method would scan the ALV for any changes in data. If anything has changed (any checkbox checked) then the system raises the event ON_DATA_CHECK.

So if the user has checked any checkboxes then the ALV's data would have changed & so the system would have raised the ON_DATA_CHECK event. Hence create an event handler method for the event ON_DATA_CHECK.

A parameter WDEVENT is passed as an input to this particular method. Check the properties of WDEVENT , it has a PARAMETERS table. We have R_PARAM as a parameter to this table.

Check R_PARAM you will find various parameters which includes the one given below.

          IF_SALV_WD_TABLE_DATA_CHECK~T_MODIFIED_CELLS

This table contain the indexes of the rows in which the data has changed. (where the checkbox has been checked) You can pass the index to read the data from the context node using a get_static_attributes.


I hope it helps.



Regards,

AkkI

former_member222068
Active Participant
0 Kudos

Hi Santosh,

Set the selection cardinality to 0-1.

Hope this should solve your problem. if not let us know, we will work around.

Thanks & Regards,

Sankar Gelivi

santhosh_nagavalli
Participant
0 Kudos

Hi Sankar,

Thanks for quick response,its not working im worked on it.

Thanks & Regards

Santhosh

Former Member
0 Kudos

Hi Santosh,

Could you please elaborate the question properly.

santhosh_nagavalli
Participant
0 Kudos

Hi Ravi Kiran,

        Thanks for quick Reply my requirement is ,In webdynpro alv table there is a checkbox in every row in first column,if user selects one checkbox all other checkbox or rows should become uneditable mode and only that select record should be captured if unselects all other checkbox should be in editable mode  .....user should be allowed to select only one checkbox or record .if u got any solution please let me know.

Thanks &Regards.

Santhosh

Former Member
0 Kudos

HI Santosh,

Create an attribute called 'Check' of type wdy_boolean in the context node. Create an Event Handler method of checkbox in view.Event is  link_click . Whenever user clicks on checkbox, event handler method gets called.

You can see the Event from class CL_SALV_EVENTS_TABLE.

*...Get all the Columns

    DATA: lt_columns TYPE REF TO cl_salv_columns.

                   lt_columns = lr_alv->get_columns( ),

                   lr_checkbox type ref to cl_salv_wd_uie_checkbox.

* set check box for column id check and register for event

loop at lt_columns into ls_columns.
case ls_columns-id.
when 'CHECK.

" create checkbox
  CREATE OBJECT lr_checkbox

  ls_columns-r_column->set_cell_editor( lr_checkbox ).

   ls_columns->set_cell_type( if_salv_c_cell_type=>checkbox_hotspot ).

endcase.
endloop.

Event Handler Method

1. When user clicks on check box, this method gets called,and in this method get the selected index check box from event parameters and then loop the table records columns and set all the other records checkbox READ_ONLY property to abap_false. (code you implement according to it)

Hope this will help you .

Regards,

Ravikiran.K

santhosh_nagavalli
Participant
0 Kudos

Hi Ravi Kiran ,

           

                Thanks for qiuck response ,in event handler method there is no method called link_click can u please elaboate answer iam new to webdynpro and may i know why should we take checkbox attribute.

Thanks & Regards

Santhosh

Former Member
0 Kudos

HI Santosh,

In event Handler select 'ON_CLICK' Event of Alv and Implement code in that method.


Regards,
Ravikiran.k