Skip to Content
avatar image
Former Member

CL_GUI_ALV_GRID's event CLICK_ROW_COL

Hello,

in order to allow the user a single click on any cell within the alv grid I would like

use CL_GUI_ALV_GRID's event CLICK_ROW_COL .

It is protected so I can't use that. What I can do in this case ?

Thx in advance for your help.

Spielwiese

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Apr 14, 2009 at 04:06 PM

    Hi,

    You can provide the Hotspot Option. By passing X to the field hotspot in Fieldcatalog. This will allow the user for single click.

    Add comment
    10|10000 characters needed characters exceeded

    • Look at this code:

      CLASS lcl_gui_alv_event_receiver DEFINITION.
        PUBLIC SECTION.
          METHODS:
      "        Hotspot click control
                handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid   
                                     IMPORTING e_row_id e_column_id es_row_no.    "this will be passed each time your click on the cell
      ENDCLASS. 
      
      CLASS lcl_gui_alv_event_receiver IMPLEMENTATION.
      
        METHOD handle_hotspot_click .
          DATA: l_mess TYPE string,
                l_row(2) TYPE c.
      
          WRITE es_row_no-row_id TO l_row.
          CONCATENATE 'Hotspot click at: ' e_column_id-fieldname 'in'
                                           l_row 'row.'
                                           INTO l_mess SEPARATED BY space.
          MESSAGE l_mess TYPE 'I'.    "here for example an info message will pop up with cell address
        ENDMETHOD .                    "handle_hotspot_click
      ENDCLASS.
      
      DATA: "alv event receiver class
            g_alv_event_ref TYPE REF TO lcl_gui_alv_event_receiver.
      
      CREATE OBJECT g_alv_event_ref.
      
      "set handler for your alv
      SET HANDLER g_alv_event_ref->handle_hotspot_click FOR g_alv_grid_ref. "here g_alv_grid_ref must hold your alv grid reference
      

      Regards

      Marcin