cancel
Showing results for 
Search instead for 
Did you mean: 

Capture multiple rows on lead select in ALV Web dynpro

former_member450029
Participant
0 Kudos

Hi all,

I am trying to capture the selected rows on lead select in ALV.

I have tried with supply function and ON_LEAD_SELECT event of ALV.

When I am trying this I am able to capture only one row but not multiple.

I don't want use any extra actions or buttons to get the selected rows, it must be possible only through any ALV events or using supply function.

BR,
Eshwar

Accepted Solutions (1)

Accepted Solutions (1)

former_member183072
Active Participant
0 Kudos

Hi ,

If you tried with ON_SELECT and this is not working, maybe is OK for you in one of the methods WDDOBEFOREACTION, WDMODIFYVIEW OR WDDOAFTERACTION .

Hope this will be OK for  you,

Hancila

former_member450029
Participant
0 Kudos

Hi,

I will clearly explain what has to happen.

When I select multiple rows in ALV I should capture all the selected row records without help of any button.

When I use ON_LEAD_SELECT it captures only one record.

When I use ON_SELECT it is not getting triggered.

Hope y'll got my point.

BR,

Eshwar

mmgc_riel
Participant
0 Kudos

Hi,

Please check :

- the node for filling the table has selection 0..n

- the selectionMode for the table on view has multi

- the onSelect event has a value

The event now should be triggered.
If it does not work,
can you tell what you have differently?

Maarten

former_member450029
Participant
0 Kudos

Hi,

My requirement is not for a normal table it is for ALV table.

If I am not wrong the above one is not for ALV.

BR,

Eshwar

mmgc_riel
Participant
0 Kudos

Hi,

You use this to set to on_select?

DATA:

     lo_config_table        TYPE REF TO cl_salv_wd_config_table.

 

   lo_config_table->if_salv_wd_table_settings~set_on_select_enabled( ).


And in the component controller create a new method for event_handler



This method will executed


Hope this works


Maarten

former_member450029
Participant
0 Kudos

Hi,

Thank you for your valuable suggestion.

The problem is solved.

I have just made on_select event enabled.

Cheers,

Eshwar

Answers (4)

Answers (4)

mmgc_riel
Participant
0 Kudos

Hi,

You can use the event ON_SELECT.

Everytime you select a line this event is fired.
It supplies you the OLD_LEAD_SELECTION and the NEW_LEAD_SELECTION.

If the parameter SELECTION_TYPE contains RANGE,

the use has selected a range of lines.
With the statements above form Amy you can get the selected lines.

The problem is,

You never know if the user just wants to select one line or he wants to make a multiple selection on the the first time the event is raised.

Greetings Maarten

former_member450029
Participant
0 Kudos

Hi,

I have tried with ON_SELECT event but it is not getting triggered.

BR,

Eshwar

amy_king
Active Contributor
0 Kudos

Hi Eshwar,

In addition to a single lead selection, a context node also keeps track of all selected elements. Take a look at method GET_SELECTED_ELEMENTS of interface IF_WD_CONTEXT_NODE. Note the optional parameter, including_lead_selection.


data lo_nd_node type ref to if_wd_context_node.

data lt_elements type wdr_context_element_set.

lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).

lt_elements = lo_nd_node->get_selected_elements( including_lead_selection = abap_true ).

Cheers,

Amy

former_member184578
Active Contributor
0 Kudos

Hi,

With multi selection( CTRL + click), the lead select event will not be triggered. You can create a custom button and read the selected rows.

Or, On Lead_select, or each row append the row index/data to internal table and then loop that internal table ans use set_selected_elements or set_lead_selection_index.

Regards,

Kiran

former_member450029
Participant
0 Kudos

Hi Kiran,

I have tried with ON_LEAD_SELECT, but when I select multiple rows this event is not getting triggered.

With out using button Is there a possibility.

BR,

Eshwar

former_member184578
Active Contributor
0 Kudos

Hi,

I had said the same thing! With multi selection the Lead selection even will not be triggered. Please check my previous reply.

As suggested earlier, you could use the work around to append the selected rows/index to internal table.

Regards,

Kiran

former_member183072
Active Participant
0 Kudos

Hi Eshwar,

I had  a similar request:

The solution was something like :

data  lt_temp TYPE   wdr_context_element_set,

lo_nd = wd_context->get_child_node( ...)

lt_temp = lo_nd->get_selected_elements.

" now get data

If lt_temp is not initial.

loop at lt_temp into ls_temp

ls_temp=>get_static_attributes(importing static_attributes = ls_values).

append ls_values to lt_values.

else.

"error message-> no line selected

endif.

Have fun with this,

Hancila