CL_GUI_ALV_GRID's  event CLICK_ROW_COL

Hello,
in order to allow the user a single click on any cell within the alv grid I would like
use CL_GUI_ALV_GRID's  event CLICK_ROW_COL .
It is protected so I can't use that. What I can do in this case ?
Thx in advance for your help.
Spielwiese

Look at this code:
CLASS lcl_gui_alv_event_receiver DEFINITION.
  PUBLIC SECTION.
    METHODS:
"        Hotspot click control
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid  
                               IMPORTING e_row_id e_column_id es_row_no.    "this will be passed each time your click on the cell
ENDCLASS.
CLASS lcl_gui_alv_event_receiver IMPLEMENTATION.
  METHOD handle_hotspot_click .
    DATA: l_mess TYPE string,
          l_row(2) TYPE c.
    WRITE es_row_no-row_id TO l_row.
    CONCATENATE 'Hotspot click at: ' e_column_id-fieldname 'in'
                                     l_row 'row.'
                                     INTO l_mess SEPARATED BY space.
    MESSAGE l_mess TYPE 'I'.    "here for example an info message will pop up with cell address
  ENDMETHOD .                    "handle_hotspot_click
ENDCLASS.
DATA: "alv event receiver class
      g_alv_event_ref TYPE REF TO lcl_gui_alv_event_receiver.
CREATE OBJECT g_alv_event_ref.
"set handler for your alv
SET HANDLER g_alv_event_ref->handle_hotspot_click FOR g_alv_grid_ref. "here g_alv_grid_ref must hold your alv grid reference
Regards
Marcin

Similar Messages

  • How to use Protected event CLICK_ROW_COL  of  cl_gui_alv_grid.

    I've  worked with Double_click,Hotspot_click events of Cl_gui_alv grid class quite comfortable as they are Public.
    But i'm unable to work with click_row_col..
    Could u tell me how to use protected event click_row_col..

    Hi Ilayarajaramana 
    Did you try to build up a subclass of cl_gui_alv_grid and access the protected events via the subclass?
    You could e.g. throw an own public event every time the click_row_col event is risen.
    I know this isn't the best way, but it should work.
    Kind Regards,
    Sebastian

  • ALV access protected event click_row_col ?

    Hi All,
    Could anyone give a sample code as to how I can access the ALV protected event "click_row_col" ?.
    I am trying to get an event to trigger to validate (select only 1 checkbox per row) after user checks on a checkbox on the alv grid display.
    Thankss,
    Neeth

    Hi Nameeth
    Or do you want to select the row whose checkbox field is checked. Then, at the data_changed event you can use the method "set_selected_rows" .
    Regards
    *--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

  • About CL_GUI_ALV_GRID's event-handling & PAI/PBO

    Hi, all,
    I met a problem when using CL_GUI_ALV_GRID's event-handling.
    I created a simple event-handling-class with an event-handling-method for DOUBLE-CLICK event of CL_GUI_ALV_GRID. And the event-handling-method, only makes some changes to the contents of itab to be shown in ALV_GRID.
    The problem is: In my idea, after event-dispatch and event-handling in PAI, subsequent PBO will be called. Since SET_TABLE_FOR_FIRST_DISPLAY is called in PBO, I would saw the changed itab shown. BUT, I saw the contents of the itab remaining unchanged.
    * PAI module, DISPATCH the event
      CASE OK_CODE.
        WHEN OTHERS.
          CALL METHOD cl_gui_cfw=>dispatch.
      ENDCASE.
    I debugged, and found that, after event-handling-method, PBO module doesn't execute.
    That's my wondering, after the preceding PAI, shouldn't the subsequent PBO appear? OR is event-handling different from other user actions?
    Many thanks.

    Hi,
    for double click you need explicit handler ,
    just check it.
    REPORT  ZTEST1234    MESSAGE-ID ZZ                           .
    DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID,  "First
          G_GRID1 TYPE REF TO CL_GUI_ALV_GRID. "Second
    DATA: L_VALID TYPE C,
          V_FLAG,
          V_DATA_CHANGE,
          V_ROW TYPE LVC_S_ROW,
          V_COLUMN TYPE LVC_S_COL,
          V_ROW_NUM TYPE LVC_S_ROID.
    DATA: OK_CODE LIKE SY-UCOMM,
          SAVE_OK LIKE SY-UCOMM,
          G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST', "First Container
          G_CONTAINER2 TYPE SCRFNAME VALUE 'TEST1',"Second container
          GS_LAYOUT TYPE LVC_S_LAYO.
    DATA:BEGIN OF  ITAB OCCURS 0,
         VBELN LIKE LIKP-VBELN,
         POSNR LIKE LIPS-POSNR,
         LFDAT like lips-vfdat,
         BOX(1),
         HANDLE_STYLE TYPE LVC_T_STYL,
         END OF ITAB.
    *       CLASS lcl_event_handler DEFINITION
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION .
        METHODS:
    **Hot spot Handler
        HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                          IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
    **Handler to Check the Data Change
        HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
                             OF CL_GUI_ALV_GRID
                             IMPORTING ER_DATA_CHANGED
                                       E_ONF4
                                       E_ONF4_BEFORE
                                       E_ONF4_AFTER,
    **Double Click Handler
        HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                         IMPORTING E_ROW E_COLUMN ES_ROW_NO.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *Handle Hotspot Click
      METHOD HANDLE_HOTSPOT_CLICK .
        CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
        V_ROW  = E_ROW_ID.
        V_COLUMN = E_COLUMN_ID.
        V_ROW_NUM = ES_ROW_NO.
        MESSAGE I000 WITH V_ROW 'clicked'.
      ENDMETHOD.                    "lcl_event_handler
    *Handle Double Click
      METHOD  HANDLE_DOUBLE_CLICK.
        CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
        V_ROW  = E_ROW.
        V_COLUMN = E_COLUMN.
        V_ROW_NUM = ES_ROW_NO.
        IF E_COLUMN = 'VBELN'.
          SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
        ENDIF.
        IF E_COLUMN = 'POSNR'.
          MESSAGE I000 WITH 'Click on POSNR row number '  E_ROW.
          "with this row num you can get the data
        ENDIF.
      ENDMETHOD.                    "handle_double_click
    **Handle Data Change
      METHOD HANDLE_DATA_CHANGED.
        CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY
          EXCEPTIONS
            FINISHED = 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.
      ENDMETHOD.                    "HANDLE_DATA_CHANGED
    ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION
    *&             Global Definitions
    DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
                G_HANDLER TYPE REF TO LCL_EVENT_HANDLER, "handler
                G_CUSTOM_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER. "Container2
    *- Fieldcatalog for First and second Report
    DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
          X_FIELDCAT TYPE LVC_S_FCAT,
          LS_VARI  TYPE DISVARIANT.
    *                START-OF_SELECTION
    START-OF-SELECTION.
      SELECT VBELN
             POSNR
             FROM LIPS
             UP TO 20 ROWS
             INTO CORRESPONDING FIELDS OF TABLE ITAB.
    END-OF-SELECTION.
      IF NOT ITAB[] IS INITIAL.
        CALL SCREEN 100.
      ELSE.
        MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
      ENDIF.
    *&      Form  CREATE_AND_INIT_ALV
    *       text
    FORM CREATE_AND_INIT_ALV .
      DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
    "First Grid
      CREATE OBJECT G_CUSTOM_CONTAINER
             EXPORTING CONTAINER_NAME = G_CONTAINER1.
      CREATE OBJECT G_GRID
             EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
    "Second Grid
      CREATE OBJECT G_CUSTOM_CONTAINER1
             EXPORTING CONTAINER_NAME = G_CONTAINER2.
      CREATE OBJECT G_GRID1
             EXPORTING I_PARENT = G_CUSTOM_CONTAINER1.
    * Set a titlebar for the grid control
      CLEAR GS_LAYOUT.
      GS_LAYOUT-GRID_TITLE = TEXT-003.
      GS_LAYOUT-ZEBRA = SPACE.
      GS_LAYOUT-CWIDTH_OPT = 'X'.
      GS_LAYOUT-NO_ROWMARK = 'X'.
      GS_LAYOUT-BOX_FNAME = 'BOX'.
      GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
      GS_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
      CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
      CREATE OBJECT G_HANDLER.
      SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
    *  SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
      SET HANDLER G_HANDLER->HANDLE_DATA_CHANGED FOR G_GRID.
    data: ls_outatb like line of itab,
          v_index type sy-tabix.
    DATA: LS_EDIT TYPE LVC_S_STYL,
            LT_EDIT TYPE LVC_T_STYL.
    LOOP AT ITAB INTO ls_outatb WHERE POSNR = '000010'.
        V_INDEX = SY-TABIX.
        LS_EDIT-FIELDNAME = 'VBELN'.
        LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
        LS_EDIT-STYLE2 = SPACE.
        LS_EDIT-STYLE3 = SPACE.
        LS_EDIT-STYLE4 = SPACE.
        LS_EDIT-MAXLEN = 8.
        INSERT LS_EDIT INTO TABLE LT_EDIT.
        INSERT LINES OF LT_EDIT INTO TABLE ls_outatb-handle_style.
        MODIFY ITAB INDEX V_INDEX FROM ls_outatb  TRANSPORTING
                                          HANDLE_STYLE.
      ENDLOOP.
    * setting focus for created grid control
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL = G_GRID.
    * Build fieldcat and set editable for date and reason code
    * edit enabled. Assign a handle for the dropdown listbox.
      PERFORM BUILD_FIELDCAT.
    * Optionally restrict generic functions to 'change only'.
    *   (The user shall not be able to add new lines).
      PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
    **Vaiant to save the layout
      LS_VARI-REPORT      = SY-REPID.
      LS_VARI-HANDLE      = SPACE.
      LS_VARI-LOG_GROUP   = SPACE.
      LS_VARI-USERNAME    = SPACE.
      LS_VARI-VARIANT     = SPACE.
      LS_VARI-TEXT        = SPACE.
      LS_VARI-DEPENDVARS  = SPACE.
      CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
    **Calling the Method for ALV output for First Grid
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          IS_VARIANT           = LS_VARI
          IS_LAYOUT            = GS_LAYOUT
          I_SAVE               = 'A'
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT
          IT_OUTTAB            = ITAB[].
    **Calling the Method for ALV output for Second Grid
       CALL METHOD G_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
    *    EXPORTING
    *      IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT
          IT_OUTTAB            = ITAB[].
    * Set editable cells to ready for input initially
      CALL METHOD G_GRID->SET_READY_FOR_INPUT
        EXPORTING
          I_READY_FOR_INPUT = 1.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
    *       text
    *      -->PT_EXCLUDE text
    FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
      DATA LS_EXCLUDE TYPE UI_FUNC.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_fieldcat
    *       Fieldcatalog
    FORM BUILD_FIELDCAT .
      DATA: L_POS TYPE I.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
      X_FIELDCAT-FIELDNAME = 'VBELN'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-EDIT      = 'X'.
      X_FIELDCAT-OUTPUTLEN = '10'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Item'(025).
      X_FIELDCAT-FIELDNAME = 'POSNR'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
        L_POS = L_POS + 1.
        X_FIELDCAT-SCRTEXT_M = 'Del Date'(015).
      X_FIELDCAT-FIELDNAME = 'LFDAT'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '10'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
    ENDFORM.                    " build_fieldcat
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF G_CUSTOM_CONTAINER IS INITIAL.
    **Initializing the grid and calling the fm to Display the O/P
        PERFORM CREATE_AND_INIT_ALV.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Regards
    vijay

  • Cl_gui_alv_grid onf4 event handler

    Has anyone got a nice, tight, example of an ONF4 event handler using CL_GUI_ALV_GRID that they'd be willing to share?
    I'm trying to figure out the example in BCALV_EDIT_08. But, it's very difficult to follow.
    If BCALV_EDIT_08 is indicative of how much work you have to do to enable this event ... phew, that's a lot of code you have to enter just for this 'simple' task.

    Hi,
    Try this one
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.
      PERFORM f230_value_request.
    FORM f230_value_request.
      DATA:  lv_exit        TYPE c,
               lw_variant    LIKE w_variant.
      w_variant-report   = sy-repid.
      w_variant-username = sy-uname.
    Invoke function to provide drop down entries
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                is_variant    = w_variant
                i_save        = c_a
           IMPORTING
                e_exit        = lv_exit
                es_variant    = lw_variant
           EXCEPTIONS
                not_found     = 1
                program_error = 2
                OTHERS        = 3.
      IF sy-subrc IS INITIAL.
        IF lv_exit IS INITIAL.
          p_layout = lw_variant-variant.
        ENDIF.
      ELSE.
        MESSAGE i037. "'No layouts found'
      ENDIF.
    ENDFORM.                    " f230_value_request
    Thanks & Regards,
    Judith.

  • How do I find an event which is triggered on line selection for ALV grid?

    Hi,
    I'm trying to find an event which is triggered when a user selects a row in the ALV grid. I want to add my own code in to add up the total values of selected lines, but can't find any event which will trigger my method.
    I found CLICK_ROW_COL but it's protected so when I try and add a method for it:
      PROTECTED SECTION.
        METHODS:
        select_row
            FOR EVENT click_row_col OF cl_gui_alv_grid.
    I get the syntax error:
    Access to protected event "CLICK_ROW_COL" is not allowed.
    Am I using the right event? Am I implementing it correctly?
    Any help appreciated. Thanks in advance.
    Gill

    I chose to solve this by removing the line select buttons from the ALV and replacing them with a checkbox defined as a hotspot.  I then used EVENT hotspot_click FROM cl_gui_alv_grid to highlight the line and change my totals on a single click.

  • Using protected events

    can any one give example program to use protected events from standard class cl_gui_alv_grid using local class in z reports.

    Hi parimi,
    Check this link, this will help you to get some idea.
    Here using protected event CLICK_ROW_COL is explained.
    http://scn.sap.com/thread/1306957
    thanks,
    vidyasagar

  • How to trigger single click event in ALV

    Hi Experts,
          I am trying to raise an event in a module pool program whereby an event will be triggered on  a single click of a particular row in the ALV.
       My requirement is that in the table display , which is being handled OO method, once the user clicks on a particular row - the details of the row should be displayed in another part of the screen.
       I have used hotspots and done this - but I do not want all my entries underlined.

    Hi Atish,
    Is there any other way to trigger the single click event in the ALV grid display for a particular row ? I have come across an event CLICK_ROW_COL, which I think may solve the problem, however this is a protected event and whenever I try to access it , I get the error that a protected event cannot be accessed.
    Edited by: Aditya  Niyogi on May 14, 2008 6:33 AM

  • ALV table with two dimensions and a link in each cell to a document

    Hi,
    I want to create an ALV output for a 2-dimension table. The table should look like:
    ---  |  Col1  |  Col2  | ...
    L1 | Cell11 | Cell12 | ...
    L2 | Cell21 | Cell22 | ...
    Do you have any hints how I could implement such a two dimensional ALV with different links when clicking on Cell11, Cell12, Cell21, ....
    Thanks for your help!
    Caroline

    if u use OO ALV,
    1.on clicking CELL1, CELL2 etc, to get different links,
    u can put hotspot for the fields in fieldcat
    and u can handle method
    button_click event of cl_gui_alv_grid.
          CLASS LCL_EVENT_RECEIVER DEFINITION
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS HANDLE_CLICK_ROW_COL
        FOR EVENT CLICK_ROW_COL OF CL_GUI_ALV_GRID
        IMPORTING ROW_ID COL_ID.
    ENDCLASS.                    "cl_event_receiver DEFINITION
          CLASS CL_EVENT_RECEIVER IMPLEMENTATION
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_BUTTON_CLICK.
        perform button_click using ROW_ID COL_ID.
      ENDMETHOD .                    "handle_top_of_page
    ENDCLASS .                    "cl_event_receiver
    2.
    FOR GETTING TWO DIMENSIONS, HANDLE PRINT_TOP_OF_PAGE
    and using write statements, build a row at the top of grid.
    or else
    IN THE LAYOUT , U CAN PLACE BUTTONS JUST ABOVE THE CUSTOM CONTAINER

  • How to capture check box click in ALV

    Hi,
    I have requirement in which after displaying the ALV out put, immediately when the check box is checked i need to capture it and proceed with further coding with that input.
    Check box click is not getting captured in "USER COMMAND or LINE SELECTION"
    Could you please suggest a way.
    Regards
    venkatesh.

    Venkatesh,
    If you are using cl_gui_alv_grid you need to register "change" event to catch the checkbox change.
    you do so with this method of cl_gui_alv_grid class :
    register_edit_event( i_event_id = cl_gui_alv_grid=>mc_evt_modified ).
    event handler class
    class lcl_event_receiver definition.
      public section.
        methods:
        user_command for event user_command of cl_gui_alv_grid
        importing e_ucomm,                                      "#EC NEEDED
        data_changed for event data_changed of cl_gui_alv_grid
        importing er_data_changed e_onf4 e_onf4_before e_onf4_after e_ucomm,"#EC NEEDED
    endclass.
    global data
    data: o_event_receiver      type ref to lcl_event_receiver.
    data: goo_grid type ref to cl_gui_alv_grid.
    At the displaying of your grid / register the change event and set handlers
    goo_grid->register_edit_event( i_event_id = cl_gui_alv_grid=>mc_evt_modified ).
        set handler:
          o_event_receiver->user_command for goo_grid,
          o_event_receiver->data_changed for goo_grid.
    hope this helps...
    regards

  • Check_Changed_Data not working

    Hi all,
    In my BADI i am triggering an ALV grid pop-up to select values with check box. For getting the changed data i am using check_changed_data method. Even after selecting the check boxes in ALV pop i am not able to get the changed data.
    program code :
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program    = sy-repid
          i_grid_title          = 'Select MAil ID'
          is_layout             = lt_layout
          it_fieldcat           = t_fieldcat
          i_screen_start_column = 20
          i_screen_start_line   = 5
          i_screen_end_column   = 70
          i_screen_end_line     = 15
          I_SAVE                = 'A'
        TABLES
          t_outtab              = it_ZEMAIL
        EXCEPTIONS
          program_error         = 1
          OTHERS                = 2.
      IF sy-subrc <> 0.
      ENDIF.
    data: gd_repid like sy-repid,
            ref_grid type ref to cl_gui_alv_grid.
      if ref_grid is initial.
        call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          importing
            e_grid = ref_grid.
      endif.
      if not ref_grid is initial.
        call method ref_grid->check_changed_data .
      endif.
    while debugging i found that the ref_grid remains initial after the function GET_GLOBALS_FROM_SLVC_FULLSCR.
    so  call method ref_grid->check_changed_data  is not executed.
    So how can i solve this problem.
    Thanks in advance.
    Venkat.

    Hi,
    u need to use user command
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program    = sy-repid
          i_grid_title          = 'Select MAil ID'
         i_callback_user_command  = 'USER_COMMAND'
          is_layout             = lt_layout
          it_fieldcat           = t_fieldcat
          i_screen_start_column = 20
          i_screen_start_line   = 5
          i_screen_end_column   = 70
          i_screen_end_line     = 15
          I_SAVE                = 'A'
        TABLES
          t_outtab              = it_ZEMAIL
        EXCEPTIONS
          program_error         = 1
          OTHERS                = 2.
      IF sy-subrc  0.
      ENDIF.
    FORM user_command USING lv_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    Declaration of local Variables
      DATA : lv_ref1 TYPE REF TO cl_gui_alv_grid.
    Event
        WHEN <event>
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              e_grid = lv_ref1.
          CALL METHOD lv_ref1->check_changed_data.
    Now try this...
    Regards,
    Nagaraj

  • CALL METHOD CL_GUI_CFW= DISPATCH.

    what is the use of CALL METHOD CL_GUI_CFW=>DISPATCH. one?

    Hi Vinay.
    I would like to suggest,
    [SDN - Reference for Usage of CALL METHOD cl_gui_cfw=>dispatch|cl_gui_cfw=>dispatch;
    [SDN - Reference for Issue in cl_gui_cfw=>dispatch|About CL_GUI_ALV_GRID's event-handling & PAI/PBO;
    Hope that's usefull.
    Good Luck & Regards.
    Harsh Dave

  • Problem with CL_GUI_CFW= DISPATCH

    hi experts,
    when I double click on a node , the dispatch metod :
    CALL METHOD CL_GUI_CFW=>DISPATCH
      IMPORTING
    RETURN_CODE = RETURN_CODE.
    returns ' -1'. ( RETURN_CODE = -1 ).
    means no event triggered, but I have double click on the node.
    Please tell me what could be the reason.
    Thanks.

    Check with below links :
    About CL_GUI_ALV_GRID's event-handling & PAI/PBO
    ALV REPORTS
    Thanks
    Seshu

  • Events in CL_GUI_ALV_GRID - PAI

    Hi All,
    I designed the screen like below
    I am using doc container with split one is for small ALV grid and next is for text editor. - Upper Portion of screen (Upper portion is splited vertically for alv grid and text editor)
    in the bottom of screen i have tabstrip in each tab it display the detailed ALV grid. - Bottom of screen
    When you click on upper portion of alv grid, the data is displayed in below tabs of ALV and long text in text editor.
    Tabstrip data is based on the upper portion of alv, it is like itemdata and header data.
    i used hotspot event in upper portion of alv to select the row and based on the row selected, bottom portion of data should display in the alv grids.
    But when i select the row it is not triggering the PAI event and it is triggering the PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
    how to trigger the PAI event when we click the double click or hot spot in alv grid.
    in alv tree we have set_registered_events but not alv grid.
    Please help me.
    Thanks,
    Srinivas Manai.

    Hi ,
    I guess the follwing code will be useful to you.
    Define a class. In that define a method for event hotspot_click of cl_gui_alv_grid like below.
    CLASS-METHODS:
          handle_hotspot_click
            FOR EVENT hotspot_click OF cl_gui_alv_grid
                IMPORTING e_row_id e_column_id es_row_no.
    In the method implementation write the desired code.
    Reward if useful
    Regards,
    Sravanthi.

  • EVENT USER_COMMAND for CL_GUI_ALV_GRID

    Hello All,
    We have a program that uses the CL_GUI_ALV_GRID and the events user_command and context_menu_request.  The program functions by selecting an option for the context menu on an ALV grid which will then take you to another screen with another ALV grid. 
    The issue is on the second screen where the user clicks the back button to return to the first ALV Grid.  For some reason, the functionality of Method user_command is triggered twice preventing the user from returning to the initial screen.  Once when the menu option is selected and again when the Back button on the second screen is selected.  If the user clicks the Back button again it will return to the initial ALV grid.  We need to have the program go to the initial ALV grid after the Back button is clicked the first time not the second. 
    Does anyone have any suggestions on how to correct this?  Thanks in advance for your help.
    John

    Hi John,
    maybe this will help you. I had a similar situation.
    1.) When you initialize the grid-controls try to set a
    unique identifier within the display-variant.
    lf_variant TYPE disvariant.
    lf_variant-report = ls_report (NOT SY_REPID!)
    lf_variant-handle = 'HUGO'....
    2.) After leaving the 2. screen clear all handles using
    the method hndle->free, free, clear ...
    In PAI you can easaly check <if hndle is initial> 
    or <if not ( hndle is initial )> ....
    Hope this will help you
    BR
    Michael

Maybe you are looking for

  • How to remove magicjack plus osx  10.7.5

    Hello, I am new to Mac and I am not a Unix system programmer. I purchased a MagicJack Plus for my sister and I set it up using my new iMac for her. Now I would like to remove the setup software from my iMac as I do not like to leave extraneous softwa

  • Thunderbolt did work, now doesn't

    I have an iMac 27" bought in 2012 with two Thunderbolt monitors. They both worked fine. When I moved the setup to another location, one monitor works fine but the other doesn't come on at all, and the connector gets rather warm. The monitor doesn't c

  • Hdmi resolution

    I just purchased MacBook Pro 15inch Retina Display but HDMI connection with my monitor has poor resolution.  Any suggestion?

  • BW performance

    Hi All, I am facing a performance related problem. We had a recent hardware upgrade . before the upgrade , during the non peak hours the CPU idle time was 95 % but now  (after upgrade) even though the data load and query load remains the same , the c

  • Downloading/Installing Photoshop Elements 11 for Mac

    I purchased Photoshop Elements 11 for Windows/Mac. (I have a Mac) I then downloaded the file and it opened to tell me that Mac can not open a windows file.  I went back in and looked at the files downloaded and there were two files with different ext