cancel
Showing results for 
Search instead for 
Did you mean: 

ALV - is there an event when selecting lines?

Former Member
0 Kudos

Hi folks

I have an ALV with mulitple line selection,

means first there's the the lead selection and all others are additionally.

Is there any event I can use if I mark a line in the ALV?

my requirement is to calculate a sum depending on the values of the marked ALV lines

(add and subtract values immediately depending on line selection or deselection)

ON_LEAD_SELECT is only for the lead but not for all other lines

ON_CLICK -> I don't know when this is event is executed, it won't work. maybe if field is a link

ON_DATA_CHECK work only if entries were changed, but not if I only change my selection of ALV lines.

do I really have to add button saying, "calculate" and then get the marked lines and do the calculation?

Any hint is appreciated

Thomas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Thomas

ON_CLICK event will trigger when there is a button or toggle button in th ALV cell and user click on that.

yes you are right ON_LEAD_SELECT will not work too.

but check for WDDOMODIFYVIEW. i think on every line select this will trigger. check if you can keep your logic in this method.

Regards

Naresh

Former Member
0 Kudos

too bad, the wddomodifyview will not be triggered for further selected lines, just for the first one, what's the on_lead_select event.

Thomas

Former Member
0 Kudos

I tried the wdmodifyview. its working. Just put a break point and check.it should work

Former Member
0 Kudos

I've tried again, but it's still the same.

For the first selected line wdmodifyview will be executed, also on_lead_select of course,

but for the 2nd, 3rd selected line, wdmodifyview will NOT be executed.

Is there some ALV setting I have to set up for this?

Thomas

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I'm afraid there is no easy answer. If the suggestions given don't work you might consider switching back to the normal table UI element. It has two separate event handlers - one for leadSelect and one for Select. Unfortunetely both of these event handlers are not mapped through the ALV component. The other suggestion would be to add a button to the ALV task bar that did the calculation. It is an extra step, but once the button is pressed you can read the selected elements from the node and do the calculation. That should produce less roundtrips to the server.

Former Member
0 Kudos

I've already implemented a calculation button as I already thought that there will not be a solution for the ALV.

Switching back to normal table is not possible, because I need the ALV's filter and setting funktionality

So thanks for all the hints.