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

Get Row Data from a selected Row in an ALV Grid

Former Member
0 Kudos

Hello,

I create a Custom Control from an intern table. When i do a double click on a row, i call another dynpro. The data of the marked line should be written into an internal table.

How i implement this?

I tried things like:

Call method alv_list->GET_SELECTED_ROWS_BASE

or

Call method alv_list->GET_SELECTED_ROWS

1 ACCEPTED SOLUTION

Former Member

Hi Sebastian,

For a double click event we need to register the double click event which goes the following way.

 
data: lref_alv type ref to cl_gui_alv_grid.
* after initializing ALV
 SET HANDLER gref_application->handle_alv_dblclik FOR lref_alv.

Now this double click event needs to be handled in the local class.

eg:


CLASS lcl_application DEFINITION.

  PUBLIC SECTION.
    METHODS:
* Method to handle double click on ALV grid.............................
      handle_alv_dblclik
                    FOR EVENT double_click
                           OF cl_gui_alv_grid
                    IMPORTING e_row
                              e_column
                              es_row_no.
endclass.

CLASS lcl_application IMPLEMENTATION.
*&---------------------------------------------------------------------*
*           Method: HANDLE_ALV_DBLCLICK                                *
*&---------------------------------------------------------------------*
*           Text: Event triggers when ALV grid is double clicked       *
*&---------------------------------------------------------------------*
*    -->e_row                                                          *
*    -->e_column                                                       *
*    -->es_row_no,                                                     *
*&---------------------------------------------------------------------*

  METHOD handle_alv_dblclik.
    data:  lv_value(40) TYPE c.
   * Get the value of the current cell double clicked......................
    CALL METHOD gref_alv->get_current_cell
      IMPORTING
        e_value   = lv_value
        .
*  here you can insert the values in the internal table
  endmethod.

endclass.

hope this helps.

Regards,

Kinshuk

4 REPLIES 4

Former Member
0 Kudos

If you see the IMPORT parameters of the event double click It gives you the following information

E_ROW

E_COLUMN

ES_ROW_NO

That means you have the row no, and the column name on which the user has clicked. So, just read the internal table with the index of the row number and you should have the data.

Regards,

Ravi

Note - Please mark all the helpful answers

Former Member
0 Kudos

thanks for your comment. it helps me very much.

0 Kudos

Please close the thread, by clicking on the answer which helped you the most.

Regards,

Ravi

Note - Please mark all the helpful answers

Former Member

Hi Sebastian,

For a double click event we need to register the double click event which goes the following way.

 
data: lref_alv type ref to cl_gui_alv_grid.
* after initializing ALV
 SET HANDLER gref_application->handle_alv_dblclik FOR lref_alv.

Now this double click event needs to be handled in the local class.

eg:


CLASS lcl_application DEFINITION.

  PUBLIC SECTION.
    METHODS:
* Method to handle double click on ALV grid.............................
      handle_alv_dblclik
                    FOR EVENT double_click
                           OF cl_gui_alv_grid
                    IMPORTING e_row
                              e_column
                              es_row_no.
endclass.

CLASS lcl_application IMPLEMENTATION.
*&---------------------------------------------------------------------*
*           Method: HANDLE_ALV_DBLCLICK                                *
*&---------------------------------------------------------------------*
*           Text: Event triggers when ALV grid is double clicked       *
*&---------------------------------------------------------------------*
*    -->e_row                                                          *
*    -->e_column                                                       *
*    -->es_row_no,                                                     *
*&---------------------------------------------------------------------*

  METHOD handle_alv_dblclik.
    data:  lv_value(40) TYPE c.
   * Get the value of the current cell double clicked......................
    CALL METHOD gref_alv->get_current_cell
      IMPORTING
        e_value   = lv_value
        .
*  here you can insert the values in the internal table
  endmethod.

endclass.

hope this helps.

Regards,

Kinshuk