ALV OO Event DOUBLE_CLICK

Hi,
I´m using the Event DOUBLE_CLICK and HOTSPOT_CLICK. There are 3 Parameters and i dont know the different between the Parameter E_ROW and ES_ROW_NO (by HOTSPOT_CLICK named E_ROW_ID and ES_ROW_NO). Which Parameter is better as example to read an ITAB with INDEX? I have heared, the ES_ROW_NO is the better one. Really?
My other Problem is how to check, if the User clicked a Subtotal-Row. With the E_ROW i can check this by the ROWTYPE. If it´s filled, i think, it concerns about a Subtotal-Row. But, how it´s with the Parameter ES_ROW-NO?
Are there any experience?
Thanks you

Andreas,
*& Report  ZUS_SDN_TWO_ALV_GRIDS
REPORT  zus_sdn_two_alv_grids.
DATA:
  gd_okcode        TYPE ui_func,
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_splitter      TYPE REF TO cl_gui_splitter_container,
  go_cell_top      TYPE REF TO cl_gui_container,
  go_cell_bottom   TYPE REF TO cl_gui_container,
  go_grid1         TYPE REF TO cl_gui_alv_grid,
  go_grid2         TYPE REF TO cl_gui_alv_grid.
DATA:
  gt_knb1          TYPE STANDARD TABLE OF knb1,
  gt_knvv          TYPE STANDARD TABLE OF knvv.
*       CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
        IMPORTING
          e_row
          e_column
          es_row_no
          sender.
ENDCLASS.                    "lcl_eventhandler DEFINITION
*       CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
  METHOD handle_double_click.
*   define local data
    DATA:
      ls_knb1      TYPE knb1.
    CHECK ( sender = go_grid1 ).
    READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
    CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
    CALL METHOD go_grid1->set_current_cell_via_id
      EXPORTING
*        IS_ROW_ID    =
*        IS_COLUMN_ID =
        is_row_no    = es_row_no.
*   Triggers PAI of the dynpro with the specified ok-code
    CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
  ENDMETHOD.                    "handle_double_click
ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
  SELECT        * FROM  knb1 INTO TABLE gt_knb1
         WHERE  bukrs  = '1000'.
* Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent                      = cl_gui_container=>screen0
      ratio                       = 90
    EXCEPTIONS
      OTHERS                      = 6.
  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 splitter container
  CREATE OBJECT go_splitter
    EXPORTING
      parent            = go_docking
      rows              = 2
      columns           = 1
*      NO_AUTODEF_PROGID_DYNNR =
*      NAME              =
    EXCEPTIONS
      cntl_error        = 1
      cntl_system_error = 2
      OTHERS            = 3.
  IF sy-subrc  0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
* Get cell container
  CALL METHOD go_splitter->get_container
    EXPORTING
      row       = 1
      column    = 1
    RECEIVING
      container = go_cell_top.
  CALL METHOD go_splitter->get_container
    EXPORTING
      row       = 2
      column    = 1
    RECEIVING
      container = go_cell_bottom.
* Create ALV grids
  CREATE OBJECT go_grid1
    EXPORTING
      i_parent          = go_cell_top
    EXCEPTIONS
      OTHERS            = 5.
  IF sy-subrc  0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
* Set event handler
  SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
  CREATE OBJECT go_grid2
    EXPORTING
      i_parent          = go_cell_bottom
    EXCEPTIONS
      OTHERS            = 5.
  IF sy-subrc  0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
* Display data
  CALL METHOD go_grid1->set_table_for_first_display
    EXPORTING
      i_structure_name = 'KNB1'
    CHANGING
      it_outtab        = gt_knb1
    EXCEPTIONS
      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.
  CALL METHOD go_grid2->set_table_for_first_display
    EXPORTING
      i_structure_name = 'KNVV'
    CHANGING
      it_outtab        = gt_knvv  " empty !!!
    EXCEPTIONS
      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.
* Link the docking container to the target dynpro
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = syst-repid
      dynnr                       = '0100'
*      CONTAINER                   =
    EXCEPTIONS
      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.
* NOTE: dynpro does not contain any elements
  CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
*  MODULE STATUS_0100.
*PROCESS AFTER INPUT.
*  MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*&      Module  STATUS_0100  OUTPUT
*       text
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.  " contains push button "DETAIL"
*  SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
  CALL METHOD go_grid2->refresh_table_display
*    EXPORTING
*      IS_STABLE      =
*      I_SOFT_REFRESH =
    EXCEPTIONS
      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.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&      Module  USER_COMMAND_0100  INPUT
*       text
MODULE user_command_0100 INPUT.
  CASE gd_okcode.
    WHEN 'BACK' OR
         'END'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.
*   User has pushed button "Display Details"
    WHEN 'DETAIL'.
      PERFORM entry_show_details.
    WHEN OTHERS.
  ENDCASE.
  CLEAR: gd_okcode.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&      Form  ENTRY_SHOW_DETAILS
*       text
*  -->  p1        text
*  <--  p2        text
FORM entry_show_details .
* define local data
  DATA:
    ld_row      TYPE i,
    ls_knb1     TYPE knb1.
  CALL METHOD go_grid1->get_current_cell
    IMPORTING
      e_row = ld_row.
  READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
  CHECK ( syst-subrc = 0 ).
  SELECT        * FROM  knvv INTO TABLE gt_knvv
         WHERE  kunnr  = ls_knb1-kunnr.
ENDFORM.                    " ENTRY_SHOW_DETAILS

Similar Messages

  • How to identify which ALV triggered event in split ALV

    Hi all,
    I'm using a split ALV like this:
    CREATE OBJECT ob_custom
      EXPORTING
        container_name = 'CONTAINER'.
    CREATE OBJECT ob_split1
      EXPORTING
        parent      = ob_custom
        orientation = cl_gui_easy_splitter_container=>orientation_vertical.
    CREATE OBJECT ob_grid1
      EXPORTING
        i_parent = ob_split1->top_left_container.
    CREATE OBJECT ob_grid2
      EXPORTING
        i_parent = ob_split1->bottom_right_container.
    I want to trigger double_click event:
    CREATE OBJECT ob_event.
      SET HANDLER ob_event->handle_double_click FOR ob_grid1.
      SET HANDLER ob_event->handle_double_click FOR ob_grid2.
    The problem is I don't know how to identify in which ALV the user double_clicked.
    Is there solution?
    Thanks in advance

    The trick is (just to help others):
    CLASS lcl_event_receiver1 DEFINITION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver1 IMPLEMENTATION.
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver2 DEFINITION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver2 IMPLEMENTATION.
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    and for data declaration:
    DATA: ob_event1  TYPE REF TO lcl_event_receiver1,
          ob_event2  TYPE REF TO lcl_event_receiver2.
    and then:
    CREATE OBJECT ob_event1.
    SET HANDLER ob_event1->handle_double_click FOR ob_grid1.
    CREATE OBJECT ob_event2.
    SET HANDLER ob_event1->handle_double_click FOR ob_grid2.
    Thanks a lot kiran kumar!
    Edited by: orgasmics on May 11, 2010 1:56 PM

  • In ALV End_of_list Event  Scrolling Option

    Hi Experts,
    In ALV END_OF_LIST Event if I want to display more records approx:50 .
    iam able to display using Reuse_Alv_Commentary_Write But .Due to high volume of Records Its Overlaping Main List  I need to drag Manually.
    My Question : is There any option where Scrolling is Available for Reuse_Alv_Commentary.
    Thank You.Please Reply.

    Hi,
    Use do_sum = 'X', in the fieldcatalog for the fields for which you need to do the summation.
    Best Regards,
    Durga Naresh Bayireddy

  • ALV  ONF4 event

    Hi All,
    I have used the ALV onF4 event for F4 help for a field in an ALV display....But the problem is that this is not getting triggered on pressing F4.....
    What might be the problem..
    I have referred the program : BCALV_EDIT_08.
    -SatyaPriya

    Hi ,
      Please check whether you have created the class to handle events and also set the handlers for it.
    Regards
    Arun

  • ALV Print event in Custom Button

    Hi,
    I have requirement to call ALV print event in Custom Button after some condition. Can anyone give me the solution or link to achieve this requirement.
    Thank in advance.

    Hi Mani,
    On that ALV button event, write the following code.
      DATA lo_component TYPE REF TO if_wd_component.
      DATA lo_appl      TYPE REF TO if_wd_application.
      lo_component = wd_comp_controller->wd_get_api( ).
      lo_appl      = lo_component->get_application( ).
      lo_appl->print_page( ).
      DATA lo_app_info TYPE REF TO if_wd_rr_application .
      lo_app_info = lo_appl->get_application_info( ).
      DATA lv_app_name TYPE string .
      lv_app_name = lo_app_info->get_name( ).
    It helps you to print the table contents. Hope this helps you.
    Thanks
    KH

  • Wrong messagetype while processing in an alv grid event

    Hello,
    a brief discription of my problem:
    I am processing a standard SAP form "PERIODE_PRUEFEN" which calls the function "READ_CUSTOMIZED_MESSAGE". The routine is called inside an event-handler of the ALV Grid event 'user_command'. The messagetype is selected from a customising table 'T100C'. Despite the messagetype 'W' the program is always aborted with an 'E' message.
    What I have tried so far:
    1. I debugged the SAP standard transaction 'fb08' which runs exactly the same functions with the same values and it works.
    2. I changed the messagetype in the debugger - no success
    3. I searched the SAP notes, but theres nothing about my problem
    I guess the problem is somewhere in the ALV Grid event, because this is the only difference between the SAP standard an my program. Maybe the message is processed wrong while beeing called within an event.
    It would be great to get some useful hints to solve this problem

    Hi,
    The ABAP runtime environment handles messages according to the type declared in the MESSAGE statement and the context in which the message was sent.
    The behaviour of message type 'W' in a dialog is different from a report program.
    Run demo program DEMO_MESSAGES, select Main Program, Type 'W' and execute. You will get an error message instead of warning message.
    This behaviour is well documeneted in the on-line help for MESSAGE statement.
    Regards,
    Rao A

  • ALV Grid: method double_click provides wrong information with 'totals line'

    Hi together,
    I´m using 'method double_click' with an ALV grid...like:
    CLASS lcl_events IMPLEMENTATION.
      METHOD double_click.
        READ TABLE it_outtab INDEX e_row-index INTO s_datatab.
    Everything works perfect as long as I don´t use totals with it.
    Using totals /subtotals lines 'READ TABLE...' provides a wrong row-index.
    Any idea how to resolve this problem?
    Thanks for any help

    Hi, this is a big problem when you use OO to build an ALV, to resolve your problem, you have to implement an event TOOLBAR_BUTTON_CLICK to get button function, when your code pass by this method you have to use the method
    CALL METHOD gcl_grid->set_function_code
        CHANGING
            c_ucomm = l_ucomm.
    l_ucomm is the function code of button, the method set_function_code sort your internal table dynamically and you get the correct index when you use double_click.
    Regards.
    David Carballido
    PD: Sry for my bad english ^^

  • ALV Grid event handlers

    Hello Friends;
    I have a problem with event handlers. I have defined events for double_click, data_change and hotspot_click. At first run of the program everything runs fine but when I make a change at the screen (like pressing Enter or entering a value at a screen field) the handlers seem to be called a couple of times. For example at a hotspot click I call an accounting document display and when I want to return with back button the program seems to be stuck at document display. Actually it calls event handler over and over again. How can I solve this problem? Can refreshing grid be a solution?
    Thx in advance
    Ali

    Hello Ali
    The problem is that after handling the hotspot event the current cell is still on the field with the hotspot. Thus, when you push ENTER the ALV grid checks the current cell which has a hotspot defined which, in turn, raises event HOTSPOT_CLICK.
    Therefore, you have to move the current cell to another cell that has no hotspot defined. Have a look at the implementation of the event handler method. The hotspot is on field KUNNR. After calling transaction XD03 I shift the current cell to field BUKRS.
    If you comment these lines you will see the same behaviour of the report as you described.
    *& Report  ZUS_SDN_TWO_ALV_GRIDS
    REPORT  ZUS_SDN_ALVGRID_EVENTS.
    DATA:
      gd_okcode        TYPE ui_func,
      gt_fcat          TYPE lvc_t_fcat,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1.
    PARAMETERS:
      p_bukrs      TYPE bukrs  DEFAULT '1000'  OBLIGATORY.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    *   define local data
        DATA:
          ls_knb1     TYPE knb1,
          ls_col_id   type lvc_s_col.
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
        SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
        CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
    *   Set active cell to field BUKRS otherwise the focus is still on
    *   field KUNNR which will always raise event HOTSPOT_CLICK
        ls_col_id-fieldname = 'BUKRS'.
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
            IS_ROW_ID    = e_row_id
            IS_COLUMN_ID = ls_col_id.
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = p_bukrs.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      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 ALV grid
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_docking
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_hotspot_click FOR go_grid1.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog_knb1.
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        CHANGING
          it_outtab       = gt_knb1
          it_fieldcatalog = gt_fcat
        EXCEPTIONS
          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.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          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.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_FIELDCATALOG_KNB1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog_knb1 .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNB1'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'KUNNR'.
      IF ( syst-subrc = 0 ).
        ls_fcat-hotspot = abap_true.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDIF.
    ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
    Regards
      Uwe

  • Drop Down List in ALV with Event handler

    Hi All ,
    I have created an ALV grid with a dropdown as one of the columns. This all works fine, except that I want to be able to react to a change in the value of each line's dropdown the next column values should change according to the user selection in the 1st column .
    Is this possible?
    As an example, I have a table of records with one column as a dropdown called " Replace Function Module "   and in 2nd column i have call function of that Replace Function Module , If a  change in " Replace Function Module " should change the call function of in the 2nd column .
    I am using these objects lvc_t_drop , lvc_s_drop and  the method  " set_drop_down_table ",
    Please Can any 1 tel me how to do this with any event handler ar any other way !

    Hi,
    You need to use event handler for this. Check if the below link gives some direction.
    [http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01]
    I guess you should create a method inside which you call the FM using the FM name from the selected cell in ALV.
    I have not tried it out, but its worth a try.
    Hope this helps!
    Regards,
    Saumya

  • ALV Tree event registration doesn't work

    Hello Experts,
    the following is the registration-form which shall register a item-double-click event to my alv-tree-object. when doing the double-click it doesn't open my own methods in the event-handler class but the standard ones and nothing happens further.
    Any ideas?
    Many thanks in advance!
    Tobias
    FORM register_events.
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
      CALL METHOD g_alv_tree->get_registered_events
        IMPORTING
          events = lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
      APPEND l_event TO lt_events.
      CALL METHOD g_alv_tree->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
      CREATE OBJECT event_handler.
      SET HANDLER event_handler->handle_item_double_click FOR g_alv_tree.
    ENDFORM.

    It doesn't matter where I place my double-click. The standard event handling "handle_event" is called.
    Instead of this I would like to have my coding.....
    Changing the cl_gui_alv_tree to cl_gui_column_tree doesn't work since my tree isn't a reference of column_tree but of alv_tree. So I would have to rebuild nearly the entire tree. This cannot be a solution since I guess the double-click item should work anyway.
    What I am wondering furthermore is my button declaration not being displayed. The following is my fieldcatalog declaration:
    FORM create_tree_fc.
      DATA: ls_fc TYPE lvc_s_fcat.
      DATA: lo_descrref   TYPE REF TO cl_abap_typedescr.
      DATA: lo_tableref TYPE REF TO cl_abap_tabledescr.
      DATA: lo_structref TYPE REF TO cl_abap_structdescr.
      FIELD-SYMBOLS: <fs_str> TYPE abap_compdescr.
      lo_tableref ?= cl_abap_tabledescr=>describe_by_data( lt_report_tree ).
      lo_descrref ?= lo_tableref->get_table_line_type( ).
      lo_structref ?= lo_descrref.
      CLEAR gt_fc[].
      LOOP AT lo_structref->components ASSIGNING <fs_str>.
        CLEAR ls_fc.
        ls_fc-fieldname = <fs_str>-name.
        ls_fc-intlen = <fs_str>-length.
        ls_fc-inttype = <fs_str>-type_kind.
        ls_fc-decimals = <fs_str>-decimals.
        CASE <fs_str>-name.
          WHEN 'PROCESS_TYPE'.
            ls_fc-tooltip = 'Process Type'.
            ls_fc-coltext = 'Process Type'.
            ls_fc-emphasize = 'C110'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = cl_gui_column_tree=>item_class_button.
            ls_fc-outputlen = 20.
          WHEN 'SMI_PROJECT'.
            ls_fc-tooltip = 'Project Relation'.
            ls_fc-coltext = 'Project'.
            ls_fc-hotspot = 'X'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
            ls_fc-outputlen = <fs_str>-length.
          WHEN 'TRORDER_NUMBER'.
            ls_fc-tooltip = 'ID of Transport Request'.
            ls_fc-coltext = 'Transport Request'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = CL_GUI_ALV_GRID=>MC_STYLE_HOTSPOT.
            ls_fc-outputlen = 30.
        ENDCASE.
        APPEND ls_fc TO gt_fc.
      ENDLOOP.
    ENDFORM.
    Edited by: Tobias Fickinger on Jun 10, 2009 9:59 AM
    Edited by: Tobias Fickinger on Jun 10, 2009 10:00 AM
    Edited by: Tobias Fickinger on Jun 10, 2009 10:03 AM

  • Capturing the ALV Grid Event

    Hi Experts,
    I am working on ALV Grid , Data is Displayed in Grid well , But Can Any one please tell me how can i capture the event (back,exit and cancel) which is persent on standard toolbar on ALV Gried output .
    Rgds,
    Premraj

    Hello PremRaj ,
    Please find an dummy program to capture the events below:
    TYPE-POOLS slis.
    DATA: ITAB_EVENTS TYPE slis_t_event,
          WA_EVENTS TYPE SLIS_ALV_EVENT.
    DATA: IT_END TYPE SLIS_T_LISTHEADER,
          WA_END TYPE SLIS_LISTHEADER.
    ** This function module will get all the events present in alv into internal table itab_events*
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = ITAB_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 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.
    ** With this read table statement itab_events is read for the desired event*+
    READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.
      wa_eventS-form = 'END'.
      MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.
      CLEAR wa_eventS.
    *Pass the ITAB_EVENTS created in this Function Module
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
        IT_EVENTS                         = ITAB_EVENTS
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER           =
       ES_EXIT_CAUSED_BY_USER            =
       TABLES
         t_outtab                          = it_tab
    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.
    *READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.
    wa_eventS-form = 'END'.
    MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.
    CLEAR wa_eventS.
    *in these statements ,the second line will automatically try to call subroutine with name end.
    FORM END.
    WA_END-TYP = 'S'.
    WA_END-KEY = TEXT-004.
    WA_END-INFO = SY-DATUM.
    APPEND WA_end TO IT_END.
    CLEAR WA_END.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = IT_END
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    Hope it helps you.
    Thanks Mansi
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 11:02 AM
    Edited by: MANSI  ASNANI on Jan 9, 2009 7:31 AM

  • ALV F8 event + Checkbox?

    Hi,
    1. How to catch F8 event in an ALV?
    2. How to determine witch checkbox is checked.
    tnx!
    Simple ALV example:
    TYPE-POOLS: slis.
    DATA: g_repid LIKE sy-repid,
    gs_print            TYPE slis_print_alv,
    gt_list_top_of_page TYPE slis_t_listheader,
    gt_events           TYPE slis_t_event,
    gt_sort             TYPE slis_t_sortinfo_alv,
    gs_layout           TYPE slis_layout_alv,
    gt_fieldcat         TYPE slis_t_fieldcat_alv,
    fieldcat_ln LIKE LINE OF gt_fieldcat,
    col_pos TYPE i.
    DATA: BEGIN OF itab,
    sel,
      field1(5) TYPE c,
      field2(5) TYPE c,
      field3(5) TYPE p DECIMALS 2,
    END OF itab.
    DATA: BEGIN OF itab1 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA: END OF itab1.
    DATA: BEGIN OF itab_fieldcat OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA: END OF itab_fieldcat.
    INITIALIZATION.
      g_repid = sy-repid.
    " PERFORM print_build    USING gs_print.      "Print PARAMETERS
      gs_layout-box_fieldname = 'SEL'.
    START-OF-SELECTION.
    * TEST DATA
      MOVE 'TEST1' TO itab1-field1.
      MOVE 'TEST1' TO itab1-field2.
      MOVE '10.00' TO itab1-field3.
      APPEND itab1.
      MOVE 'TEST2' TO itab1-field1.
      MOVE 'TEST2' TO itab1-field2.
      MOVE '20.00' TO itab1-field3.
      APPEND itab1.
      DO 5 TIMES.
        APPEND itab1.
      ENDDO.
    END-OF-SELECTION.
      PERFORM build.
      PERFORM call_alv.
    *&      Form  BUILD
    *       text
    FORM build.
    * DATA FIELD CATALOG
    * Explain Field Description to ALV
      DATA: fieldcat_in TYPE slis_fieldcat_alv.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname = 'FIELD1'.
      fieldcat_ln-tabname   = 'ITAB1'.
    *FIELDCAT_LN-NO_OUT    = 'X'.  "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
      fieldcat_ln-key       = ' '.   "SUBTOTAL KEY
      fieldcat_ln-no_out    = ' '.
      fieldcat_ln-seltext_l = 'HEAD1'.
      APPEND fieldcat_ln TO gt_fieldcat.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname = 'FIELD2'.
      fieldcat_ln-tabname   = 'ITAB1'.
      fieldcat_ln-no_out    = 'X'.
      fieldcat_ln-seltext_l = 'HEAD2'.
      APPEND fieldcat_ln TO gt_fieldcat.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname     = 'FIELD3'.
      fieldcat_ln-tabname       = 'ITAB1'.
      fieldcat_ln-ref_fieldname = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
      fieldcat_ln-ref_tabname   = 'MSEG'.  "<- REF TABLE IN THE DICTIONNARY
      fieldcat_ln-no_out        = ' '.
      fieldcat_ln-do_sum        = 'X'.   "SUM UPON DISPLAY
      APPEND fieldcat_ln TO gt_fieldcat.
    * DATA SORTING AND SUBTOTAL
      DATA: gs_sort TYPE slis_sortinfo_alv.
      CLEAR gs_sort.
      gs_sort-fieldname = 'FIELD1'.
      gs_sort-spos      = 1.
      gs_sort-up        = 'X'.
      gs_sort-subtot    = 'X'.
      APPEND gs_sort TO gt_sort.
      CLEAR gs_sort.
      gs_sort-fieldname = 'FIELD2'.
      gs_sort-spos      = 2.
      gs_sort-up        = 'X'.
    *GS_SORT-SUBTOT    = 'X'.
      APPEND gs_sort TO gt_sort.
    ENDFORM.                    "BUILD
    *&      Form  CALL_ALV
    *       text
    FORM call_alv.
    * ABAP List Viewer
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
      i_callback_program = g_repid
    * I_CALLBACK_PF_STATUS_SET = ' '
    * I_CALLBACK_USER_COMMAND = ' '
      i_structure_name = 'ITAB1'
      is_layout =  gs_layout
      it_fieldcat = gt_fieldcat[]
        it_sort = gt_sort[]
        it_events = gt_events[]
        is_print = gs_print
      TABLES
      t_outtab = itab1
      EXCEPTIONS
      program_error = 1
      OTHERS = 2.
    ENDFORM.                    "CALL_ALV

    Hi,
    stil not working..:(
    Please, could you use my code and fil up with yours?
    TYPE-POOLS: slis.
    DATA: g_repid LIKE sy-repid,
    gs_print            TYPE slis_print_alv,
    gt_list_top_of_page TYPE slis_t_listheader,
    gt_events           TYPE slis_t_event,
    gt_sort             TYPE slis_t_sortinfo_alv,
    gs_layout           TYPE slis_layout_alv,
    gt_fieldcat         TYPE slis_t_fieldcat_alv,
    fieldcat_ln LIKE LINE OF gt_fieldcat,
    col_pos TYPE i.
    DATA: BEGIN OF itab,
    sel,
      field1(5) TYPE c,
      field2(5) TYPE c,
      field3(5) TYPE p DECIMALS 2,
    END OF itab.
    DATA: BEGIN OF itab1 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA: END OF itab1.
    DATA: BEGIN OF itab_fieldcat OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA: END OF itab_fieldcat.
    INITIALIZATION.
      g_repid = sy-repid.
      " PERFORM print_build    USING gs_print.      "Print PARAMETERS
      gs_layout-box_fieldname = 'SEL'.
    START-OF-SELECTION.
    * TEST DATA
      MOVE 'TEST1' TO itab1-field1.
      MOVE 'TEST1' TO itab1-field2.
      MOVE '10.00' TO itab1-field3.
      APPEND itab1.
      MOVE 'TEST2' TO itab1-field1.
      MOVE 'TEST2' TO itab1-field2.
      MOVE '20.00' TO itab1-field3.
      APPEND itab1.
      DO 5 TIMES.
        APPEND itab1.
      ENDDO.
      gs_layout-get_selinfos = 'X'.
    END-OF-SELECTION.
      PERFORM build.
      PERFORM call_alv.
    *&      Form  BUILD
    *       text
    FORM build.
    * DATA FIELD CATALOG
    * Explain Field Description to ALV
      DATA: fieldcat_in TYPE slis_fieldcat_alv.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname = 'FIELD1'.
      fieldcat_ln-tabname   = 'ITAB1'.
    *FIELDCAT_LN-NO_OUT    = 'X'.  "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
      fieldcat_ln-key       = ' '.   "SUBTOTAL KEY
      fieldcat_ln-no_out    = ' '.
      fieldcat_ln-seltext_l = 'HEAD1'.
      APPEND fieldcat_ln TO gt_fieldcat.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname = 'FIELD2'.
      fieldcat_ln-tabname   = 'ITAB1'.
      fieldcat_ln-no_out    = 'X'.
      fieldcat_ln-seltext_l = 'HEAD2'.
      APPEND fieldcat_ln TO gt_fieldcat.
      CLEAR fieldcat_in.
      fieldcat_ln-fieldname     = 'FIELD3'.
      fieldcat_ln-tabname       = 'ITAB1'.
      fieldcat_ln-ref_fieldname = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
      fieldcat_ln-ref_tabname   = 'MSEG'.  "<- REF TABLE IN THE DICTIONNARY
      fieldcat_ln-no_out        = ' '.
      fieldcat_ln-do_sum        = 'X'.   "SUM UPON DISPLAY
      APPEND fieldcat_ln TO gt_fieldcat.
    * DATA SORTING AND SUBTOTAL
      DATA: gs_sort TYPE slis_sortinfo_alv.
      CLEAR gs_sort.
      gs_sort-fieldname = 'FIELD1'.
      gs_sort-spos      = 1.
      gs_sort-up        = 'X'.
      gs_sort-subtot    = 'X'.
      APPEND gs_sort TO gt_sort.
      CLEAR gs_sort.
      gs_sort-fieldname = 'FIELD2'.
      gs_sort-spos      = 2.
      gs_sort-up        = 'X'.
    *GS_SORT-SUBTOT    = 'X'.
      APPEND gs_sort TO gt_sort.
    ENDFORM.                    "BUILD
    *&      Form  CALL_ALV
    *       text
    FORM call_alv.
    * ABAP List Viewer
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
      i_callback_program = g_repid
    * I_CALLBACK_PF_STATUS_SET = ' '
      i_callback_user_command = 'form_user'
      i_structure_name = 'ITAB1'
      is_layout =  gs_layout
      it_fieldcat = gt_fieldcat[]
      it_sort = gt_sort[]
      it_events = gt_events[]
      is_print = gs_print
      TABLES
      t_outtab = itab1
      EXCEPTIONS
      program_error = 1
      OTHERS = 2.
    ENDFORM.                    "CALL_ALV
    *&      Form  form_user
    *       text
    FORM form_user.
      CASE sy-ucomm.
        WHEN 'ENTER' OR 'SPACE'.                                " for F8
    ***do coding
      ENDCASE.
    ENDFORM.                    "form_user

  • ALV Grid: event for user return in ALV Grid Control

    Hi developers,
    i'm wanna do something after a user has pressed the return button in a alv grid control. For that i need probably a event. But i can not find a proper event in the documentation. Could one of you guys help me?
    Best regards christian

    Hi Christian
    ALV grid is an encapsulated object, so it seems there is no way, you ought to implement the data_changed event. So if you want to make bulk data input and after trigger the event by pressing the return key, you should make the ALV Grid get your changes after pressing the key but not after a cell change of a modified cell.
    To set this attribute:
    CALL METHOD gr_alvgrid->register_edit_event
         EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter .
    This way "data_changed" event will be triggered whenever you press the return key while editing.
    For some more information you can also refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference for ALV Grid Control"</a>.
    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>

  • ALV GRID - EVENT HANDLING

    Hi all,
       Please let me know how to hanldle  event handling , making a cell in editable mode ,double click and hotspot creation,colorign a single cell,calling a transatcion when clicked on hotspot in a alv grid display program (not using OO   concepts).
    Looikng forward for a positive response.
    Reagrds,
    Mohinder.

    Hi,
    You can create your own custom status and asign it to your
    ALV GRID. Here is a sample code to add custom status and handling events.
    http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • ALV OO - event receiver issue

    Hi,
    in my ALV 00 program i have several simular ALV grids (with the same layout, fieldcat etc). The handling of the double click event in the different ALV grids is handled by different event receivers ( but type ref to the same event handler class).
    How can i see in the general event handler class, which event receiver reference has raised the event, so on which alv grid was the double click !
    As i said the ALV grids are lookalike, but only the data is different. So for the double click event i should read different data tables.
    Any one a solution ?
    regards,
    Hans

    Hi,
    you should have different event reciever. to respond the different grids to show the different grids....
    regards
    vijay

Maybe you are looking for

  • Questions on CMS database

    Hi, I am trying to find out the name of table and column in CMS database (BOXI 3.1) which stores the information about error message received in scheduling (e.g. Cannot initialize Report Engine server. (Error: RWI 00226) ). I was reading this post /p

  • How do I stop youtube images from loading after trying to do so in the options?

    I have gone into Options under Tools and unchecked the "Load images automatically" box, restarted my computer, and typed in the google search bar, Adrienne Barbeau. Various hits come up, but the one I select is the Adrienne Barbeau Voluptuous link. I

  • Opening an image from LR 2 in CS5 results in an image 2-3 stops lighter

    When I open an image from Lr2 into CS5 or CS3 the image is 2-3 stops lighter than what it was in Lightroom. My color settings for the working space and the  image profile are ProPhoto in both LR and PS. Does any one have an idea of what is causing th

  • 50L7300UC - sound input from Mac not outputting to ARC

    I'm having an odd problem with audio on my 50L7300UC (Canadian model of the 50L7300U). I have a soundbar hooked up via HDMI ARC, and it works fine for audio from my cable PVR, from online sevices such as Netflix accessed through the TV itself, and fr

  • Is there a lightning cable for my old iPad2?

    My iPad 2 is very slow charging. Is there a faster cable available for it, either Apple or maybe Belkin? Thanks!