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.
Showing results for 
Search instead for 
Did you mean: 

Event Double_click of class cl_gui_alv_grid

Former Member
0 Kudos

Hi All,

I am trying to use the event double click of class cl_gui_alv_grid. For that I am using syntax- SET HANDLER <instance>->double_click FOR <instance>. in my report ,where instance is an object of class cl_gui_alv_grid but I am getting error - Method "DOUBLE_CLICK" is unknown or PROTECTED or PRIVATE. Please help me with this.




0 Kudos


did you create any local class to handle the DOUBLE_CLICK event of cl_gui_alv_grid.?

In that local class declare the method for event, in public section , for ex.

METHODS handle_double_click FOR EVENT double_click OF cl_gui_alv_grid IMPORTING (attributes of event)

Then create an object of this class and then set it as an handler for the object of cl_gui_alv_grid.



Former Member
0 Kudos

Can't I set the handler for the event directly without creating a local class. I saw it done somewhere this way.

0 Kudos

Not for the standard ones.

It's possible if you define your own local class with event as well a method for handling it.

Former Member
0 Kudos

Thank you for the help.

0 Kudos

So, is your problem solved.? What did you do finally?

Former Member
0 Kudos

I am able to do it by :

1. Defining local event in my local class in report and then calling the method that would trigger it,

2. Using global event handler method of global class and just calling the method in report that would trigger it.

But if I want to use a global class event(created in a custom global class) in report, even after creating a local class to handle the global class event, I am not able to trigger it. In that local class, I declared a method for event, in public section. Then I created an object of this class and then set it as an handler for the object of my global class.

0 Kudos

Can you post your code.?

Former Member
0 Kudos

Global Class zclass is created and has an event 'no_data', event handler method 'no_data_handler' and a method to fetch data 'get_data' which calls event 'no_data' if no records are fetched.

Local class




     handler_method FOR EVENT no_data OF zclass.


METHOD handler_method.

     Write: 'No data'.


CREATE OBJECT obj1.  " object of local class

CREATE OBJECT obj2.  " object of zclass

   SET HANDLER obj1->handler_method FOR obj2.

   CALL METHOD obj2->get_data.

0 Kudos

Everything is fine in the code.

Check the RAISE EVENT part in GET_DATA method for global class. May be condition which you have given is not working.

The CREATE OBJECT & SET HANDLER part should come before the implementation of your local class.

Flow -

-> Class declaration

-> Create Object , Set handler and method calling

-> Class Implementation

0 Kudos

Your code is no more related to your initial question! zclass should be cl_gui_alv_grid, and no_data should be double_click!

Former Member
0 Kudos

Yes, sorry for the confusion. I just wanted to make the problem scenario clear.

Active Contributor
0 Kudos

You must define your own class and your own method, to handle events. Your class can be anything. Your method must be declared METHODS yourmethod FOR EVENT double_click OF cl_gui_alv_grid IMPORTING the parameters you want to have.

SET HANDLER yourclassinstance->yourmethod FOR alvgridinstance.

This is the very basics of handling events for all controls in the Control Framework. Refer to the SAP Library for more information.