Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV CL_GUI_ALV_GRID: Event BUTTON_CLICK does not work after inserting new row

alexander_diener
Explorer
0 Kudos

Hi

SAP_BASIS 750 0017

ALV CL_GUI_ALV_GRID. Editable.

There is a colum that is a button (FIELDCAT-HOTSPOT & FIELDCAT-STYLE).

Clicking the buton triggers event BUTTON_CLICK.

Method ON_BUTTON_CLICK (registered as event handler vor event BUTTON_CLICK) handels event.

This works fine except when before clicking the button a new row is inserted with the standart button insert row. Then the event is not triggered (at least the handler is not called). Other events (F4, DATA_CHANGED) are still triggered.

Any ideas? Thanks!

Regards

Alexander

1 ACCEPTED SOLUTION

alexander_diener
Explorer
0 Kudos

SOLUTION.

I hijacked* the standart button insert row and programmed it myself. Now the event BUTTON_CLICK works after inserting a row.

I still don't know what the problem is. Somehow the standart button insert row disturbes the event framework?

* Handle event ON_TOOLBAR. Set new function code for button insert row. Handle event BEFORE_USER_COMMAND. Add new row. May use methods GET_CURRENT_CELL, SET_CURRENT_CELL_VIA_ID and REFRESH.

5 REPLIES 5

Sandra_Rossi
Active Contributor

It works for me.

Sandra_Rossi
Active Contributor
0 Kudos

Please post a minimal reproducible example if you need further assistance. Thank you.

alexander_diener
Explorer
0 Kudos

That would take to much time.

alexander_diener
Explorer
0 Kudos

SOLUTION.

I hijacked* the standart button insert row and programmed it myself. Now the event BUTTON_CLICK works after inserting a row.

I still don't know what the problem is. Somehow the standart button insert row disturbes the event framework?

* Handle event ON_TOOLBAR. Set new function code for button insert row. Handle event BEFORE_USER_COMMAND. Add new row. May use methods GET_CURRENT_CELL, SET_CURRENT_CELL_VIA_ID and REFRESH.

Sandra_Rossi
Active Contributor
0 Kudos

For information, it took me 15 minutes to create a minimal program to reproduce, and it worked for me (so couldn't reproduce the problem). From there, I would compare the 2 programs to understand why one works and the other not, by adapting the minimal one to include the complex stuff of the second one, step by step, till it doesn't work anymore...