4 Replies Latest reply: May 16, 2012 12:56 AM by karina hurtado RSS

Getting current cell in ALV Grid

karina hurtado
Currently Being Moderated

Is there something equivalent to the get_current_cell method from class cl_gui_alv_grid for

REUSE_ALV_GRID_DISPLAY

 

I would like to get the index of the internal table that was selected,

with a single click, actually I'm getting that using

p_selfield-tabname in user_command, but this is triggered only with double click.

  • Re: Getting current cell in ALV Grid
    Clemens Li
    Currently Being Moderated

    Hi karina,

     

    also in OO grid you need some event to trigger get_current_cell method, at least ENTER (or F1, F4). You can define columns as HOTSPOT, that needs no double- only single click.

    If you want to use ENTER, F1 or  F4 then you must access the grid object using FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR',  register the respective events and implement event handlers. You can start with CL_ALV_GRID as well.

     

    Regards

     

    Clemens

    • Re: Getting current cell in ALV Grid
      karina hurtado
      Currently Being Moderated

      Thanks Clemens, now I'm trying with GET_GLOBALS_FROM_SLVC_FULLSCR,

      and get_current_cell method, but still can't figure out how can I implement just a single click on the cell

      I have a custom search help attached to the field, so I can't define the column as hotspot, but I think that using F4 the issue will be solved. How can use it? Sorry I'm not familiar with OO

      • Re: Getting current cell in ALV Grid
        Clemens Li
        Currently Being Moderated

        Hi karina,

         

        mo_grid->register_edit_event( i_event_id = cl_gui_alv_grid=>mc_evt_enter ).

         

        You will need an event handler class:

         

        CLASS lcl_event_receiver DEFINITION.

         

          PUBLIC SECTION.

         

            METHODS:

            handle_toolbar

                FOR EVENT toolbar OF cl_gui_alv_grid

                    IMPORTING e_object e_interactive,               "#EC NEEDED

         

            handle_user_command

                FOR EVENT user_command OF cl_gui_alv_grid

                    IMPORTING e_ucomm,                              "#EC NEEDED

         

            handle_double_click

                FOR EVENT double_click OF cl_gui_alv_grid

                    IMPORTING e_row e_column,                       "#EC NEEDED

            hotspot_click

                FOR EVENT hotspot_click OF cl_gui_alv_grid

                    IMPORTING

                      e_row_id

                      e_column_id

                      es_row_no.                                    "#EC NEEDED

         

          PRIVATE SECTION.

         

        ENDCLASS.                    "lcl_event_receiver DEFINITION

         

        CLASS lcl_event_receiver IMPLEMENTATION.

          METHOD handle_user_command.

        * sorry the advanced

        editor broke down

         

          DATA: lt_selected_rows  TYPE lvc_t_roid,
                ls_selected_rows  TYPE lvc_s_roid,

         

         

         

         

         

        SoiSorry

         

         

         

         

        Don't know how to survive new SCN

         

        Regards Clemens

Actions