on 11-09-2011 7:02 AM
Hi,
I have used SALV_WD_TABLE as component reuse to display an ALV on my web dynpro application. But the problem is when it is displayed the first row is by defaut selected. If I try to click on any other row it is not getting selected and the first row is still selected.
I checked the context node which I used for mapping to data node of SALV_WD_TABLE . The cardinality is 0..n and selection is 0..1. Again while instantiating the ALV class in the view I din't use any set_selection method to define selection in ALV.
So, I need your help to know what is the reason that is not allowing me to select any other row other than the first row. Also I want to how to program the change in lead selection in the ALV. I mean how to understand when user selects another row and I need to know the row number.
Thanks,
Mainak
Hi Mainak
This problem may occur if in your WDDOMODIFY is having code which will bind your ALV node with data.
Or in your modify view method your ALV node data is changed.
Nawal Kishor Mittal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i have a alv table with 3 fields.
I have appended 10 empty rows initially.
My requirement is when ever i enter some value in coloum 1 remaining 2 fields must be updated based on value of 1st column.
i am writing code in modify view and binding table.
value is getting populated but i cannot select any row afterwards.
For example if i enter user name in first column i must get first name and last name in other colums
below is the sample row in my alv.
user1 userfirstname user lastname
Please tell me in which event must i rite the code
Thanks in advance
SSK
Hi SSK,
Sorry for being late to reply. Please find below the steps to follow for your requirement -
1. Enable ON_CELL_ACTION event for the ALV
You can follow the link for the coding. But make sure not to write the code in WDDOMODIFY method. Instead you write the code in WDDOINIT method.
How to trigger the event ON_CELL_ACTION in ALV - Web Dynpro ABAP - SCN Wiki
2. Now in the view methods tab define a event handler for this event
create a new entry in method tab and choose method type as event handler and for the event you choose the ON_CELL_ACTION event of your ALV interface controller via F4 value help.
3. Now in this method created in step 2, you will get the value of the column in variable R_PARAM->ATTRIBUTE. That means, if you press enter in columnn 'USER_NAME' then this variable will contain this column name. Then the sample coding would be -
case R_PARAM->attribute.
when 'USER_NAME'.
* Populate the first name and last name in the corresponding context node element
endcase.
Hi,
basic checks are, cardinality, selection property of ALV node context. binding of the ALV internal table.
In case you do not want 1st row to be selected then use method as below,
get element via lead selection
lo_el_node_alv_output = lo_nd_node_alv_output->get_element( ).
lo_nd_node_alv_output->set_lead_selection_index( -1 ).
lo_nd_node_alv_output->bind_table( it_alv_table[] ).
regarding accesing the row selected by user, simply use below code,
navigate from <CONTEXT> to <NODE_ALV_OUTPUT> via lead selection
lo_nd_node_alv_output = wd_context->get_child_node( name = wd_this->wdctx_node_alv_output ).
Get element via lead selection
lo_el_node_alv_output = lo_nd_node_alv_output->get_element( ).
lt_element = lo_nd_node_alv_output->get_selected_elements( ).
Thanks,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try by making selection cardinality to 0:n
and
GET_LEAD_SELECTION_INDEX method will return the index of selected row value
Regards
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mainak,
don´t forget to set this propety to the ALV,
CALL METHOD l_value->if_salv_wd_table_settings~set_selection_mode
EXPORTING
value = cl_wd_table=>e_selection_mode-multi_no_lead.
You can choose the property to allow selection for just one row or more than row. The one above, is to allow select more than one row on the ALV.
Regards.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.