Skip to Content
avatar image
Former Member

Selecting Row of Data from ALV Grid

When handling a double-click for my alv grid, I have found methods for getting the value of the cell that was clicked. Is there a method for returning the value of the whole row?

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Apr 15, 2004 at 06:51 AM

    Try the code bellow.

    You also have to set the fieldcat-hotspot field to 'X' in the fieldcatalog for the column you want to enable clicking.

    There is also a method for double click, as far as I remember it works very similar way...but I always use hotspot_click.

    I've just found it: check demo BCALV_GRID_02

    Incho

    *eject

    ----


    • CLASS cl_event_receiver DEFINITION

    ----


    • class lcl_event_receiver: local class to handle event HOTSPOT_CLICK

    CLASS lcl_event_receiver DEFINITION.

    PUBLIC SECTION.

    METHODS:

    handle_hotspot_click

    FOR EVENT hotspot_click OF cl_gui_alv_grid

    IMPORTING e_row_id e_column_id.

    ENDCLASS. "lcl_event_receiver DEFINITION

    ----


    • CLASS lcl_event_receiver IMPLEMENTATION

    ----


    CLASS lcl_event_receiver IMPLEMENTATION.

    METHOD handle_hotspot_click.

    READ TABLE it_rseg INDEX e_row_id-index INTO wa_rseg.

    CASE e_column_id-fieldname.

    *--> Display Invoice

    WHEN 'BELNR'.

    IF wa_rseg-belnr <> space.

    SET PARAMETER ID 'RBN' FIELD wa_rseg-belnr.

    SET PARAMETER ID 'GJR' FIELD wa_rseg-gjahr.

    CALL TRANSACTION tcode_mir4 AND SKIP FIRST SCREEN.

    ENDIF.

    ENDCASE.

    ENDMETHOD. "handle_double_click

    ENDCLASS. "lcl_event_receiver IMPLEMENTATION

    *=======================================================================

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      You need to call method GET_SELECTED_ROWS of class CL_GUI_ALV_GRID. This method returns the whole row that was selected by the user.