cancel
Showing results for 
Search instead for 
Did you mean: 

Can't select row on ALV

former_member224404
Active Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

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

former_member224404
Active Participant
0 Kudos

Hi Nawal,

You have pointed out the root cause for this problem. So I am closing the thred. Thank you for the help.

Thanks,

Mainak

Former Member
0 Kudos

Hi Nawal, Hi Mainak,

I got the same "problem" and I need to modify the table and bind it in the WDDOMODIFYVIEW, because of updating status of the rows and so on dynamically.... Is there a solution to save the selections and set after bind_table ?

Thanks in advance and best regards

hhermann

former_member197696
Participant
0 Kudos

hey what if i have to bind table in modifyview and still have to select that one user.

Is it possible

former_member197696
Participant
0 Kudos

Hi gm how did you solve your issue

former_member224404
Active Participant
0 Kudos

Hi Sriramula,

I removed the code that was triggering in WDDOMODIFYVIEW event. Instead, I populated the ALV in WDDOININT event, and changed the context node binding in appropriate ALV events.

Thanks,

Mainak

former_member224404
Active Participant
0 Kudos

Hello Heinrich,

Sorry for replying after so long time. Not sure if it will help you really now ;-). But you shouldn't use WDDOMODIFYVIEW ideally to change the status of rows. You should do it on the appropriate ALV events which should trigger the change of any ALV rows.

Thanks,

Mainak

former_member197696
Participant
0 Kudos

Hey thanks a lot for the reply .

Can u please guide me through the appropriate alv events.

I will follow you in scn even you follow me so that i can message you in SCN.

I am relatively new to webdynpro .

Please help

former_member224404
Active Participant
0 Kudos

Please explain the requirements breifly so that I can help yoiu on this.

former_member197696
Participant
0 Kudos

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

former_member224404
Active Participant
0 Kudos

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.

Answers (2)

Answers (2)

ChandraMahajan
Active Contributor
0 Kudos

Hi,

Please go thru

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

former_member199125
Active Contributor
0 Kudos

try by making selection cardinality to 0:n

and

GET_LEAD_SELECTION_INDEX method will return the index of selected row value

Regards

Srinivas

former_member224404
Active Participant
0 Kudos

Hi Srinivas,

I already tried that but no success. Can you please let me know what are the points that I need to consider for this problem.

Thanks,

Mainak

rub_alfonso
Explorer
0 Kudos

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.