cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting Row of Data from ALV Grid

Former Member
0 Kudos
227

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Peter_Inotai
Active Contributor
0 Kudos

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

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

Former Member
0 Kudos

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.