Skip to Content
author's profile photo Former Member
Former Member

Events click and dbl click on alv grid

Hello,

On an ALV grid, I want two actions for one cell - the click and the double click. For the double click I have triggered the event 'DOUBLE_CLICK' of the class CL_GUI_ALV_GRID but for the event click ( hotspot not compatible with double click ) the only one i have founded is 'CLICK_ROW_COL' on class CL_GUI_ALV_GRID_BASE but is private.

So I have tried to create a class who is inherit of CL_GUI_ALV_GRID and create an public event click_cell on this new class but I haven't success in.

If someone have a solution ...

Thanks,

Nicolas

Edited by: Nicolas Couret on Jun 2, 2010 10:32 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Jun 02, 2010 at 09:54 AM

    Hi,

    I think your idea of creating a derived class should work.

    Create the subclass.

    Create a public event, say CLICK_CELL having the same parameters as CLICK_ROW_COL.

    Create a protected method HANDLE_CLICK_ROW_COL as handler for CLICK_ROW_COL; derive the parameters.

    In HANDLE_CLICK_ROW_COL code:

    raise event click_cell exporting row_id = row_id col_id = col_id.

    Create a constructor and derive the interface of super's constructor.

    In the constructor call super's constructor (passing all parameters to it) and code:

    set handler handle_click_row_col for me.

    I just checked - at least it is giving no syntax error; just try.

    Regards, Gerd Rother

    Add a comment
    10|10000 characters needed characters exceeded

    • See the CL_GUI_ALV_GRID, provides you with the event. You have set the event handler for the same on the grid object that you would create. So this would normally occur on the constructor where you set the handler.

      For this you need to create the event handler and make sure that the event handler is defined for CL_GUI_ALV_GRID , on_node_doublick.( This is during the creation of event handler).

      Also there would be a on_item_doubleclick. make sure your control is directed from on_node_doubleclick( ) to on_item_doubleclick( ).

      Regards

      Kavindra

  • author's profile photo Former Member
    Former Member
    Posted on Nov 15, 2011 at 06:15 AM

    dear friend.

    need to do some programming.

    FORM DISPLAY_ALV_REPORT.

    GD_REPID = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = GD_REPID

    • i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM

    i_callback_user_command = 'USER_COMMAND' <<<<<<< this is perform for below code

    • i_grid_title = outtext

    IS_LAYOUT = GD_LAYOUT

    IT_FIELDCAT = FIELDCATALOG[]

    • it_special_groups = gd_tabgroup

    • IT_EVENTS = GT_XEVENTS

    I_SAVE = 'X'

    • is_variant = z_template

    TABLES

    T_OUTTAB = IT

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2.

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. " DISPLAY_ALV_REPORT

    FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM

    SELFIELD TYPE SLIS_SELFIELD.

    CASE UCOMM.

    WHEN '&IC1'.

    READ TABLE IT INDEX SELFIELD-TABINDEX INTO WA.

    IF SY-SUBRC EQ 0.

    IF SELFIELD-FIELDNAME = 'EBELN' ."AND NOT WA-LIFNR IS INITIAL.

    SET PARAMETER ID 'BES' FIELD WA-EBELN.

    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.

    ENDIF.

    ENDIF.

    ENDCASE.

    ENDFORM.

    hope this helps

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2011 at 05:20 AM

    Hi,

    I am posting sample code this will provide brief idea to you.

    REPORT ZALVGRID_PG.

    TABLES: SSCRFIELDS.

    DATA: V_BELNR TYPE RBKP-BELNR.

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

    SELECT-OPTIONS: IRNO FOR V_BELNR.

    PARAMETERS: P_GJAHR TYPE RBKP-GJAHR.

    SELECTION-SCREEN END OF BLOCK B1.

    DATA: WA TYPE ZALVGRID_DISPLAY,

    ITAB TYPE STANDARD TABLE OF ZALVGRID_DISPLAY.

    DATA: IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

    DATA: GRID TYPE REF TO CL_GUI_ALV_GRID.

    DATA: L_IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

    DATA: L_TREE TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.

    TYPE-POOLS: SLIS,SDYDO.

    DATA: L_LOGO TYPE SDYDO_VALUE,

    L_LIST TYPE SLIS_T_LISTHEADER.

    END-OF-SELECTION.

    CLASS CL_LC DEFINITION.

    PUBLIC SECTION.

    METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN.

    ENDCLASS.

    CLASS CL_LC IMPLEMENTATION.

    METHOD DC.

    DATA: WA1 TYPE ZALVGRID_DISPLAY.

    READ TABLE ITAB INTO WA1 INDEX E_ROW-INDEX.

    BREAK-POINT.

    SET PARAMETER ID 'BLN' FIELD WA1-BELNR.

    CALL TRANSACTION 'FB02'.

    ENDMETHOD. "DC

    ENDCLASS.

    DATA: OBJ_CL TYPE REF TO CL_LC.

    START-OF-SELECTION.

    PERFORM SELECT_DATA.

    IF SY-SUBRC = 0.

    CALL SCREEN 100.

    ELSE.

    MESSAGE E000(0) WITH 'DATA NOT FOUND'.

    ENDIF.

    MODULE STATUS_0100 OUTPUT.

    SET PF-STATUS 'AB'.

    • SET TITLEBAR 'xxx'.

    IF IDENTITY IS INITIAL.

    CREATE OBJECT IDENTITY

    EXPORTING

    CONTAINER_NAME = 'ALVCONTROL'.

    CREATE OBJECT GRID

    EXPORTING

    I_PARENT = IDENTITY.

    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY

    EXPORTING

    • I_BUFFER_ACTIVE =

    • I_BYPASSING_BUFFER =

    • I_CONSISTENCY_CHECK =

    I_STRUCTURE_NAME = 'ZALVGRID_DISPLAY'

    *

    • IS_VARIANT =

    • I_SAVE =

    • I_DEFAULT = 'X'

    • IS_LAYOUT =

    • IS_PRINT =

    • IT_SPECIAL_GROUPS =

    • IT_TOOLBAR_EXCLUDING =

    • IT_HYPERLINK =

    • IT_ALV_GRAPHICS =

    • IT_EXCEPT_QINFO =

    • IR_SALV_ADAPTER =

    CHANGING

    IT_OUTTAB = ITAB.

    • IT_FIELDCATALOG =

    • IT_SORT =

    • IT_FILTER =

    • EXCEPTIONS

    • INVALID_PARAMETER_COMBINATION = 1

    • PROGRAM_ERROR = 2

    • TOO_MANY_LINES = 3

    • others = 4

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CREATE OBJECT OBJ_CL.

    SET HANDLER OBJ_CL->DC FOR GRID.

    ENDIF.

    IF L_IDENTITY IS INITIAL.

    CREATE OBJECT L_IDENTITY

    EXPORTING

    CONTAINER_NAME = 'LOGO'

    .

    CREATE OBJECT L_TREE

    EXPORTING

    I_PARENT = L_IDENTITY.

    PERFORM LOGOSUB USING L_LOGO.

    CALL METHOD L_TREE->CREATE_REPORT_HEADER

    EXPORTING

    IT_LIST_COMMENTARY = L_LIST

    I_LOGO = L_LOGO.

    • I_BACKGROUND_ID =

    • I_SET_SPLITTER_HEIGHT =

    • I_MODEL_MODE =

    ENDIF .

    ENDMODULE. " STATUS_0100 OUTPUT

    FORM LOGOSUB USING P_L_LOGO.

    P_L_LOGO = 'ERPLOGO'.

    ENDFORM. " LOGOSUB

    ----


    FORM SELECT_DATA .

    SELECT RBKP~BELNR

    RBKP~BLDAT

    RSEG~BUZEI

    RSEG~MATNR

    INTO TABLE ITAB

    FROM RBKP INNER JOIN RSEG

    ON RBKPBELNR = RSEGBELNR

    WHERE RBKP~BELNR IN IRNO

    AND RBKP~GJAHR = P_GJAHR.

    ENDFORM. " SELECT_DATA

    ----


    MODULE USER_COMMAND_0100 INPUT.

    CASE SY-UCOMM.

    WHEN 'EXIT'.

    LEAVE PROGRAM.

    WHEN 'CANCEL'.

    EXIT.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_0100 INPUT

    WarmRegards,

    PavanKumar.G

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.