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: 

ABAP OO ALV DATA_CHANGED event - Avoid double_click trigger

Former Member
0 Kudos

Hello developers,

I'm using the object oriented, editable ALV.

When the user presses the SAVE button, my report triggers the DATA_CHANGED event and all changes are stored permanent into the database.

For this reason, I don't want that the event is also raised when the users double clicks on a cell.

Is it possible to avoid that behaviour?

Best regards,

8 REPLIES 8

Former Member
0 Kudos

Please share your code

Former Member
0 Kudos

The whole coding would be too mutch, but as you see I only registered the following events:

     "Set data changed event handler

     CREATE OBJECT lr_event.

     SET HANDLER lr_event->handle_data_changed FOR lr_grid.

     SET HANDLER lr_event->handle_data_changed_finished for lr_grid.

     set HANDLER lr_event->handle_BEFORE_USER_COMMAND for lr_grid.

set HANDLER lr_event->handle_button_click for lr_grid.

--> No double_click event. However, the handle_data_changed event is raised when the user double clicks on any cell.

   In my data_changed event handler, I've got the following construction:

     if ok_code EQ 'LEAVE' OR ok_code = 'EXIT' or ok_code ='BACK'.

     ......."handle changed data

          ELSEIF ok_code EQ 'SAVE'.


      ......."handle changed data

     ELSE.

      RETURN.

With this I'm able to exit the data handling at the beginning when it was a double click.

But actually I would like to avoid the event completly, because when the user presses the 'SAVE' button later on, all other changes are no longer in the er_data_changed because the data_changed event was already raised.

0 Kudos

I wonder why it is triggering the handle data changed on double click , since the function code for double click is usually &IC1 and its not handled in your program.

Enter debugging mode and check the value of ok_code on double click. Then handle that event by including that function code also in the PAI.

Or you create an event to handle double click

handle_double_click FOR EVENT double_click OF cl_gui_alv_grid

                              IMPORTING e_row e_column es_row_no

and in its implementation, do nothing.

and set HANDLER lr_event->handle_double_click FOR for lr_grid.

0 Kudos

Thanks for your answer.

The ok_code is empty. Also the e_ucomm of the data_changed event is empty.  Implementig the double_click event doesn't avoid the data_changed event 😕

Even if the user presses two times the "select all rows" button, the data_changed event is raised. Same behavior when any toolbar icon is pressed ( for example 'change layout')

0 Kudos

Hi,

I would suggest you to register the edit event and use get selected rows method to update to databse.

Refer this link for the steps.

http://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=37472

0 Kudos

But how can I, for example, handle deleted rows in this scenario?

Former Member
0 Kudos

Hi,

In your IF statement, add a condition to handle the user command(ucomm) value for  double click event ie. '&IC1'.

Hope this will help you to solve the issue.

Regards,

Anoop

0 Kudos

Thanks, but I would like to avoid the data_changed event in general. Because calling this after doubleblicking a cell doesn't make sense.