on 01-31-2014 12:51 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Santosh,
Could you please elaborate the question properly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
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.