Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Get table for cl_gui_alv_grid

Dear all

I have several cl_gui_alv_grid controls and I like to add 1 double-click handler to all those Grids.

Now when doubleclicking, I need to now which table (they have all the same type) is displayed by this grid.

How can I get this information?

thank you


Former Member

that's exactly what I like to do... now i wanted to get in the event handler the table for the grid where the method was launched. so I don't know if it's possible on a dynamic way.

Well I would totally resign from using separate handlers for each grid. Instead use one method. Via optional parameter e_object you will get instance of grid which raised the event. Simply query which of these objects (grids) it is and address respective table

methods handle_dbl_clk for event .... importing e_object.

method handle_dbl_clk.
  field-symbols <tab> type any table.
  data lr_tab type ref to data.

   case e_object.
       when go_grid1.   "check if it is a refernce of your global alv grid1
            get reference of ITAB1 to lr_tab.
       when go_grid2. "check if it is a refernce of your global alv grid2
             get reference of ITAB2 to lr_tab.

    assign lr_tab->* to <tab>.
     "now you can work with <tab> dynamically
     "it is transparent to you which table you are working with 

Of course this somehow violates good OO design, as you are programming to an instance not an interface, but overally you achieve addressing table dynamically.



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question