Handling  single click in alv tree

Hello Friends,
Is there an event triggered,for single click on an alv tree.
regards
kaushik

hi ,
it_fieldcat-hotspot = 'X'.
regards,
venkat.
Edited by: venkat  appikonda on Mar 13, 2008 8:11 PM
Edited by: venkat  appikonda on Mar 13, 2008 8:12 PM

Similar Messages

  • Handle single click event in ALV OOPS

    Hi,
    I have to display 2 ALV grid...one above the other.
    Top ALV will contain Header info and bottom ALV witll display line item.
    I am use ALV OOPS.
    Now when user will click on the top ALV ...bottom ALV should show corresponding data.
    I don't have to use HOTSPOT or Double click event.
    How can I handle single click event.
    Please guide me..thanks in advance
    Regards,
    Prasoon

    hi,
                    for this in ALV OOPS take <b>2 custom containers( cl_gui_custom_container)</b>in the same screen and on the 1st container display the header data<b>(use set_tale_for_first_display method of class cl_gui_alv_grid)</b>.
                   On the 2nd screen item data for  this  use<b> EVENT</b> handling(you want <b>single click</b>). use<b> hotspot_click</b> or <b>button_click </b>events. 
    for this you have to register the events.   the code for that.
    <b>CLASS lcl_event_handler DEFINITION .</b>
    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 ,
    *--To control button clicks
    handle_button_click
    FOR EVENT button_click OF cl_gui_alv_grid
    IMPORTING e_oject e_ucomm .
    PRIVATE SECTION.
    ENDCLASS.
    <b>CLASS lcl_event_handlerIMPLEMENTATION .</b>
    *--Handle Hotspot Click
    METHOD handle_hotspot_click .
    PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
    ENDMETHOD .
    METHOD handle_button_click .
    PERFORM handle_button_click USING e_object e_ucomm .
    ENDMETHOD .
    ENDCLASS .
    DATA gr_event_handler TYPE REF TO lcl_event_handler .
    <b>*--Creating an instance for the event handler</b>
    CREATE OBJECT gr_event_handler.
    <b>*--Registering handler methods to handle ALV Grid events</b>
    SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid .
    SET HANDLER gr_event_handler->handle_button_click FOR gr_alvgrid .
    do n't forget to use<b> refresh_table_display
    </b> other wise only the record which you first you clicked will display in the 2nd container.
    <b>Reward points for useful Answers</b>

  • Double click in ALV tree output????

    Hi all,
    I am able to display output in tree format. But I want to add the double click functionality to some of the fields in output. Means if I double click on some value in output tree, it should call some transaction. Please help me with this issue of double clicking.
    Please tell how to handle events in this report tree display.
    For the following code its displaying output in tree format and in right way. But i need to add double click functionality to this.
    So provide me some sample program for this one....
    * create hierarchy
      CALL METHOD tree1->set_table_for_first_display
              EXPORTING
                   it_list_commentary   = lt_list_commentary
                   i_background_id      = 'ALV_BACKGROUND'
                   i_save               = 'A'
                   is_variant            = ls_variant
              CHANGING
                   it_sort              = gt_sort[]
                   it_outtab            = itab_outtab
                   it_fieldcatalog      = t_fieldcat. "gt_fieldcatalog.
    * expand first level
      CALL METHOD tree1->expand_tree
             EXPORTING
                 i_level = 1.
    * optimize column-width
      CALL METHOD tree1->column_optimize
               EXPORTING
                   i_start_column = tree1->c_hierarchy_column_name
                   i_end_column   = tree1->c_hierarchy_column_name.
    In grid ALV we can have double cilck functionality using code:
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program       = w_repid
                i_callback_pf_status_set = 'PF_STATUS'
                i_callback_user_command  = 'USER_COMMAND'
                is_layout                = ls_layout
                it_fieldcat              = gt_fc[]
    Here we can write subroutine for USER_COMMAND and handle the double click evenet. But tell me how to provide this in tree ALV.
    <REMOVED BY MODERATOR>
    Regards,
    Sachin
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 1:47 PM

    Hello Sachin
    The following sample report ZUS_SDN_ALV_TREE_DEMO demonstrates the crucial parts for double-click event handling (nodes & items) in ALV trees.
    *& Report  ZUS_SDN_ALV_TREE_DEMO
    *& Thread: double click in ALV tree output????
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="742412"></a>
    REPORT  zus_sdn_alv_tree_demo.
    CLASS cl_gui_column_tree DEFINITION LOAD.
    CLASS cl_gui_cfw DEFINITION LOAD.
    TYPE-POOLS: abap.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE TYPE knvv AS data.
    TYPES: nkey       TYPE lvc_nkey.
    TYPES: parent_key TYPE lvc_nkey.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA: gt_outtab    TYPE ty_t_outtab.
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syst-repid,
      gt_fcat          TYPE lvc_t_fcat,
      gs_layout        TYPE lvc_s_layo,
      gs_variant       TYPE disvariant,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_tree          TYPE REF TO cl_gui_alv_tree.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
        handle_node_double_click
          FOR EVENT node_double_click OF cl_gui_alv_tree
          IMPORTING node_key,
        handle_item_double_click
          FOR EVENT item_double_click OF cl_gui_alv_tree
          IMPORTING node_key
                    fieldname.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_node_double_click.
        message 'Event=Double-Click on Node' type 'I'.
        call transaction 'XD03'.
      ENDMETHOD.                    "handle_node_double_click
      METHOD handle_item_double_click.
        message 'Event=Double-Click on Item' type 'I'.
        call transaction 'VA03'.
      ENDMETHOD.                    "handle_item_double_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      PERFORM init_controls.
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      container                   =
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          lifetime_dynpro_dynpro_link = 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.
      CALL SCREEN '0100'.
    ** NOTE: no elements on screen
    **  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'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      TRANSLATE gd_okcode TO UPPER CASE.
      CASE gd_okcode.
        WHEN 'BACK'  OR
             'EXIT'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'REFRESH'.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  init_controls
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
    * 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 tree control
      CREATE OBJECT go_tree
        EXPORTING
            parent              = go_docking
            node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
            item_selection      = 'X'  " required for double-click event on item
            no_html_header      = ''
            no_toolbar          = ''
        EXCEPTIONS
            cntl_error                   = 1
            cntl_system_error            = 2
            create_error                 = 3
            lifetime_error               = 4
            illegal_node_selection_mode  = 5
            failed                       = 6
            illegal_column_name          = 7.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    * create Hierarchy-header
      DATA ls_hierarchy_header TYPE treev_hhdr.
      PERFORM build_hierarchy_header CHANGING ls_hierarchy_header.
      PERFORM build_fieldcatalog.
      PERFORM set_layout_and_variant.
    * create emty tree-control
      CALL METHOD go_tree->set_table_for_first_display
        EXPORTING
    **      i_structure_name     = 'KNVV'
          is_variant           = gs_variant
          i_save               = 'A'
    *      i_default            = 'X'
          is_hierarchy_header  = ls_hierarchy_header
    *      is_exception_field   =
    *      it_special_groups    =
    *      it_list_commentary   =
    *      i_logo               =
    *      i_background_id      =
    *      it_toolbar_excluding =
    *      it_except_qinfo      =
        CHANGING
          it_outtab            = gt_outtab
    *      it_filter            =
          it_fieldcatalog      = gt_fcat.
    * create hierarchy
      PERFORM create_hierarchy.
    * register events
      PERFORM register_events.
    * adjust column_width
      CALL METHOD go_tree->column_optimize.
    ENDFORM.                    " init_controls
    *&      Form  build_hierarchy_header
    *       build hierarchy-header-information
    *      -->P_L_HIERARCHY_HEADER  strucxture for hierarchy-header
    FORM build_hierarchy_header CHANGING
                                   p_hierarchy_header TYPE treev_hhdr.
      p_hierarchy_header-heading = 'Hierarchy Header'.          "#EC NOTEXT
      p_hierarchy_header-tooltip =
                             'This is the Hierarchy Header !'.  "#EC NOTEXT
      p_hierarchy_header-width = 30.
      p_hierarchy_header-width_pix = ''.
    ENDFORM.                               " build_hierarchy_header
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
      REFRESH: gt_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNVV'
    *     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.
      DELETE gt_fcat FROM 8.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  SET_LAYOUT_AND_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_layout_and_variant .
      CLEAR: gs_layout,
             gs_variant.
      gs_variant-report = syst-repid.
      gs_variant-handle = 'TREE'.
    ENDFORM.                    " SET_LAYOUT_AND_VARIANT
    *&      Form  create_hierarchy
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM create_hierarchy .
      DATA: ls_knvv    TYPE sflight,
            ls_outtab  TYPE ty_s_outtab,
            lt_outtab  TYPE ty_t_outtab.
    * get data
      SELECT * FROM knvv INTO CORRESPONDING FIELDS OF TABLE lt_outtab
                            UP TO 200 ROWS .                "#EC CI_NOWHERE
      SORT lt_outtab BY kunnr vkorg.
    * add data to tree
      DATA: ld_kunnr_key TYPE lvc_nkey,
            ld_vkorg_key TYPE lvc_nkey,
            ld_last_key  TYPE lvc_nkey.
      LOOP AT lt_outtab INTO ls_outtab.
        ON CHANGE OF ls_outtab-kunnr.
          PERFORM add_customer_line USING    ls_outtab-data
                                  CHANGING ld_kunnr_key.
        ENDON.
        ON CHANGE OF ls_outtab-vkorg.
          PERFORM add_salesorg_line USING    ls_outtab-data
                                             ld_kunnr_key
                                  CHANGING ld_vkorg_key.
        ENDON.
        PERFORM add_complete_line USING  ls_outtab-data
                                         ld_vkorg_key
                                CHANGING ld_last_key.
      ENDLOOP.
    * calculate totals
      CALL METHOD go_tree->update_calculations.
    * this method must be called to send the data to the frontend
      CALL METHOD go_tree->frontend_update.
    ENDFORM.                    " create_hierarchy
    *&      Form  add_customer_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_customer_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_data TYPE ty_s_outtab-data.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@A0@'.  " icon_customer.
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      APPEND ls_item_layout TO lt_item_layout.
    * add node
      l_node_text =  us_data-kunnr.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_data
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_customer_line
    *&      Form  add_salesorg_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_salesorg_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_data TYPE ty_s_outtab-data.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@DS@'.  " ICON_PARTNER_SALES_ACTIVITY
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      APPEND ls_item_layout TO lt_item_layout.
    * add node
      l_node_text =  us_data-vkorg.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_data
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_salesorg_line
    *&      Form  add_cmplete_line
    *       add hierarchy-level 3 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_complete_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-class   = cl_gui_column_tree=>item_class_checkbox.
    **  ls_item_layout-editable = 'X'.
      APPEND ls_item_layout TO lt_item_layout.
    **  CLEAR ls_item_layout.
    **  ls_item_layout-fieldname = 'PLANETYPE'.
    **  ls_item_layout-alignment = cl_gui_column_tree=>align_right.
    **  APPEND ls_item_layout TO lt_item_layout.
      l_node_text =  us_data-vtweg.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          is_outtab_line   = us_data
          i_node_text      = l_node_text
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_complete_line
    *&      Form  register_events
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM register_events.
    * define the events which will be passed to the backend
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
    * define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_header_click.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
    **  APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
      APPEND l_event TO lt_events.
      CALL METHOD go_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.
    * set Handler
      set handler:
        lcl_eventhandler=>handle_node_double_click for go_tree,
        lcl_eventhandler=>handle_item_double_click for go_tree.
    **  DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
    **  CREATE OBJECT l_event_receiver.
    **  SET HANDLER l_event_receiver->handle_node_ctmenu_request
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_node_ctmenu_selected
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_item_ctmenu_request
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_item_ctmenu_selected
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_checkbox_change FOR tree1.
    ENDFORM.                               " register_events
    Regards
      Uwe

  • Single click in alv grid

    Hi friends,
    below statement is for double clicking,
    WHEN '&IC1'. " SAP standard code for double-clicking, but i need single click because when i select field(not doubble click only single click) in alv grid it has to trigger and perform some action  ,can any one know please tell me.

    gwa_fldcat-col_pos       = 2.
      gwa_fldcat-fieldname     = 'CHK'.
      gwa_fldcat-tabname       = 'GT_FINAL'.
    gwa_fldcat-EMPHASIZE = 'C310'.
    gwa_fldcat-input        = 'X'.
      gwa_fldcat-edit          = 'X'.
      gwa_fldcat-checkbox      = 'X'.
      gwa_fldcat-just          = 'C'.
      gwa_fldcat-key           = 'X'.
      gwa_fldcat-outputlen     = 16.
      gwa_fldcat-seltext_l     = 'Selection'.
      gwa_fldcat-hotspot        = 'X'.
      APPEND gwa_fldcat TO git_fldcat.
      CLEAR gwa_fldcat.
      gs_events-name = 'USER_COMMAND'.
      gs_events-form = 'USER'.
      append gs_events to gi_events.
    call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
         i_callback_program                = sy-repid
         i_callback_pf_status_set          = 'PFSTATUS'
         i_callback_user_command           = 'USER'
         I_CALLBACK_TOP_OF_PAGE            = ' '
         I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
         I_CALLBACK_HTML_END_OF_LIST       = ' '
         I_STRUCTURE_NAME                  =
         I_BACKGROUND_ID                   = ' '
         I_GRID_TITLE                      =
          I_GRID_SETTINGS                   = wa_grid
         is_layout                         = gs_layout
         it_fieldcat                       = git_fldcat
         IT_EXCLUDING                      =
         IT_SPECIAL_GROUPS                 =
         IT_SORT                           =
         IT_FILTER                         =
         IS_SEL_HIDE                       =
         I_DEFAULT                         = 'X'
         I_SAVE                            = ' '
         IS_VARIANT                        =
         it_events                         = gi_events
         IT_EVENT_EXIT                     =
         IS_PRINT                          =
         IS_REPREP_ID                      =
         I_SCREEN_START_COLUMN             = 0
         I_SCREEN_START_LINE               = 0
         I_SCREEN_END_COLUMN               = 0
         I_SCREEN_END_LINE                 = 0
         IT_ALV_GRAPHICS                   =
         IT_HYPERLINK                      =
         IT_ADD_FIELDCAT                   =
         IT_EXCEPT_QINFO                   =
         I_HTML_HEIGHT_TOP                 =
         I_HTML_HEIGHT_END                 =
    IMPORTING
         E_EXIT_CAUSED_BY_CALLER           =
         ES_EXIT_CAUSED_BY_USER            =
    tables
         t_outtab                          = gt_final.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-zebra             = 'X'.
      gs_layout-info_fieldname    = 'COLOR'.
    gs_layout-KEY_HOTSPOT       = 'X'.
    form user using lv_okcode   like sy-ucomm
                           rs_selfield type slis_selfield.
      lv_okcode = sy-ucomm.
    case lv_okcode.
    when '&IC1'.
    loop at gt_final into gwa_final .
    where chk = 'X'.
      if gwa_final-chk is not initial.
    gwa_final-color = 'C111' .
    modify gt_final from gwa_final
       index sy-tabix transporting color.
    clear gwa_final.
    endif.
    endloop.
    encase.
    form Grid_settings .
    wa_grid-EDT_CLL_CB = 'X'.
    endform.

  • Handling dbl click in alv

    Hi
    Can u tell me how to handle double click in alv?
    Thanks and Regards
    Anish

    Do you mean interactive Alv? is its that. check this out.
    REPORT  ZALV_OOINTERACTIVE.
    *Class definition for handling double click
    CLASS event_class DEFINITION DEFERRED.
    *Internal table and work area declarations for dd02l and dd03l
    DATA : it_dd02l TYPE TABLE OF dd02l,
           wa_dd02l TYPE dd02l,
           it_dd03l TYPE TABLE OF dd03l,
           wa_dd03l TYPE dd03l.
    *data declarations for ALV Main list
    DATA : ty_lay1 TYPE lvc_s_layo,
           it_fieldcat TYPE lvc_t_fcat ,
           ty_fieldcat TYPE lvc_s_fcat ,
           c_alv1 TYPE REF TO cl_gui_alv_grid,
           c_cont1 TYPE REF TO cl_gui_custom_container,
           event_receiver TYPE REF TO event_class.
    *data declarations for ALV Interactive list
    DATA : ty_lay2 TYPE lvc_s_layo,
           it_fcat TYPE lvc_t_fcat ,
           ty_fcat TYPE lvc_s_fcat ,
           c_alv2 TYPE REF TO cl_gui_alv_grid,
           c_cont2 TYPE REF TO cl_gui_custom_container.
    **Select options for multiple values and NOT ranges
    SELECT-OPTIONS : s_table FOR wa_dd02l-tabname NO INTERVALS.
    Initialization event
    INITIALIZATION.
    *Start of selection event
    START-OF-SELECTION.
    *fetch data into table and field characteristics
      PERFORM fetch_data.
    *ALV display for output
      PERFORM alv_output.
    *&      Form  FETCH_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM fetch_data .
    *Select the table details
      SELECT * FROM dd02l INTO CORRESPONDING FIELDS OF TABLE it_dd02l 
    WHERE tabname IN s_table
      AND tabclass = 'TRANSP'.
    ENDFORM.                    " FETCH_DATA
    ----* CLASS lcl_event_receiver DEFINITION*-------
    CLASS event_class DEFINITION.
    *Handling double click
      PUBLIC SECTION.    METHODS:
        handle_double_click
        FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row .
    ENDCLASS. "lcl_event_receiver DEFINITION
    ----* CLASS lcl_event_receiver IMPLEMENTATION
    CLASS event_class IMPLEMENTATION. 
    METHOD handle_double_click.
        DATA : ls_dd02l LIKE LINE OF it_dd02l.
    *Reading the selected data into a variable
        READ TABLE it_dd02l INDEX e_row-index INTO ls_dd02l.
    *Select the field details of the selected table
        SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
        WHERE tabname EQ ls_dd02l-tabname.
    *calling the ALV containing the field values
        CALL SCREEN 101. 
    ENDMETHOD. "handle_double_click
    ENDCLASS.  "lcl_event_receiver IMPLEMENTATION
    & Module pbo_100 OUTPUT&----
    MODULE pbo_100 OUTPUT.
    *set pf-status 'XXX'.
    *set titlebar 'XXX'.
    ENDMODULE. " PBO_100 OUTPUT
    *& Module alv_100 OUTPUT
    MODULE alv_100 OUTPUT.
    *Check if there is no custom container in screen 100
      IF c_cont1 IS INITIAL.
    *Creating object of container
        CREATE OBJECT c_cont1
         EXPORTING
           container_name = 'CCONT'.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *Creating object of alv
        CREATE OBJECT c_alv1
           EXPORTING
            i_parent = c_cont1.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *alv layout
        PERFORM alv_100_layout.
    *alv field catalogue
        PERFORM alv_100_fieldcat.
    *Displaying the ALV grid
        CALL METHOD c_alv1->set_table_for_first_display
          EXPORTING
            is_layout       = ty_lay1
          CHANGING
            it_outtab       = it_dd02l[]
            it_fieldcatalog = it_fieldcat.   
    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 of the event class and setting handler for double click
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_double_click FOR c_alv1.
      ENDIF.
    ENDMODULE. " ALV_100 OUTPUT
    &----& Module pai_100 INPUT&----
    MODULE pai_100 INPUT.
    ENDMODULE. " pai_100 INPUT
    ----* MODULE PBO_101 OUTPUT----MODULE pbo_101 OUTPUT.
    SET PF-STATUS 'XXX'.
    SET TITLEBAR 'XXX'.
    ENDMODULE. " PBO_101 INPUT
    ----* MODULE ALV_101 OUTPUT*----
    MODULE alv_101 OUTPUT.
    *Check if the Custom container exists.
      IF c_cont2 IS INITIAL.
    *Creating container object
        CREATE OBJECT c_cont2
          EXPORTING
            container_name = 'CDCONT'.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *creating ALV grid for interactive list
        CREATE OBJECT c_alv2
          EXPORTING
           i_parent = c_cont2.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    *ALV layout
        PERFORM alv_101_layout.
    *ALV fieldcatalogue
        PERFORM alv_101_fieldcat.
    *Sorting the output by field position
        SORT it_dd03l BY position.
    *ALV for display field details
        CALL METHOD c_alv2->set_table_for_first_display
          EXPORTING
            is_layout       = ty_lay2
          CHANGING
            it_outtab       = it_dd03l[]
            it_fieldcatalog = it_fcat.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.  ENDIF.ENDMODULE. " ALV_101 OUTPUT
    &----& Module PAI_101 INPUT&----
    MODULE pai_101 INPUT.
    ENDMODULE. " PAI_101 INPUT
    *&      Form  ALV_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_output .
      CALL SCREEN 100.
    ENDFORM.                    " ALV_OUTPUT
    *&      Form  ALV_100_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_100_layout .
      ty_lay1-grid_title = 'TABLES'.
      ty_lay1-zebra = 'X'.
      ty_lay1-no_toolbar = 'X'.
    ENDFORM.                    " ALV_100_LAYOUT
    *&      Form  ALV_100_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_100_fieldcat .
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 1.
      ty_fieldcat-fieldname = 'TABNAME'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'TableName'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 2.
      ty_fieldcat-fieldname = 'TABCLASS'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'CATEGORY'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 3.
      ty_fieldcat-fieldname = 'AS4USER'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'CREATED'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat. 
    ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 4.
      ty_fieldcat-fieldname = 'AS4DATE'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'DATE'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
      ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 5.
      ty_fieldcat-fieldname = 'AS4TIME'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'TIME'.
      ty_fieldcat-outputlen = 10.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat. 
    ty_fieldcat-row_pos = 1.
      ty_fieldcat-col_pos = 6.
      ty_fieldcat-fieldname = 'CONTFLAG'.
      ty_fieldcat-tabname = 'GT_DD02L'.
      ty_fieldcat-coltext = 'Delivery Class'.
      ty_fieldcat-outputlen = 15.
      APPEND ty_fieldcat TO it_fieldcat.
      CLEAR ty_fieldcat.
    ENDFORM.                    " ALV_100_FIELDCAT
    *&      Form  ALV_101_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_101_layout .
    ty_lay2-grid_title = 'FIELDS'.
      ty_lay2-zebra = 'X'.
      ty_lay2-no_toolbar = 'X'.
    ENDFORM.                    " ALV_101_LAYOUT
    *&      Form  ALV_101_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM alv_101_fieldcat .
      REFRESH it_fieldcat.
      REFRESH it_fcat.
      CLEAR ty_fcat.
      ty_fcat-row_pos = 1.
      ty_fcat-col_pos = 1.
      ty_fcat-fieldname = 'FIELDNAME'.
      ty_fcat-tabname = 'GT_DD03L'.
      ty_fcat-coltext = 'Fieldname'.
      ty_fcat-outputlen = 10.
      APPEND ty_fcat TO it_fcat.
      ty_fcat-row_pos = 1.
      ty_fcat-col_pos = 2.
      ty_fcat-fieldname = 'CHECKTABLE'.
      ty_fcat-tabname = 'GT_DD03L'.
      ty_fcat-coltext = 'CHECKTABLE'.
      ty_fcat-outputlen = 10.
      APPEND ty_fcat TO it_fcat.
      ty_fcat-row_pos = 1.
      ty_fcat-col_pos = 3.
      ty_fcat-fieldname = 'KEYFLAG'.
      ty_fcat-tabname = 'GT_DD03L'.
      ty_fcat-coltext = 'Key Flag'.
      ty_fcat-outputlen = 10.
      APPEND ty_fcat TO it_fcat.
    ENDFORM.                    " ALV_101_FIELDCAT

  • Double click in ALV tree display....

    Hi all,
    I am able to display output in tree format. But I want to add the double click functionality to some of the fields in output. Means if I double click on some value in output tree, it should call some transaction. Please help me with this issue of double clicking.
    My code as of now is as below:
    Please tell how to handle events in this report tree display and how and where to write the code for this functionlity of double click.
    FORM alv_tree.
    PERFORM build_sort_table.  “----
    table is sorted
    create container for alv-tree
      DATA: l_tree_container_name(30) TYPE c,
            l_custom_container TYPE REF TO cl_gui_custom_container.
      l_tree_container_name = 'TREE1'.
      CREATE OBJECT l_custom_container
          EXPORTING
                container_name = l_tree_container_name
          EXCEPTIONS
                cntl_error                  = 1
                cntl_system_error           = 2
                create_error                = 3
                lifetime_error              = 4
                lifetime_dynpro_dynpro_link = 5.
    create tree control
      CREATE OBJECT tree1
        EXPORTING
            i_parent              = l_custom_container
            i_node_selection_mode =
                                  cl_gui_column_tree=>node_sel_mode_multiple
            i_item_selection      = 'X'
            i_no_html_header      = ''
            i_no_toolbar          = ''
        EXCEPTIONS
            cntl_error                   = 1
            cntl_system_error            = 2
            create_error                 = 3
            lifetime_error               = 4
            illegal_node_selection_mode  = 5
            failed                       = 6
            illegal_column_name          = 7.
    create info-table for html-header
      DATA: lt_list_commentary TYPE slis_t_listheader.
      PERFORM build_comment USING
                     lt_list_commentary. “----
    already created
    repid for saving variants
      DATA: ls_variant TYPE disvariant.
      ls_variant-report = sy-repid.
    register events
      PERFORM register_events.
    create hierarchy
      CALL METHOD tree1->set_table_for_first_display
              EXPORTING
                   it_list_commentary   = lt_list_commentary
                   i_background_id      = 'ALV_BACKGROUND'
                   i_save               = 'A'
                   is_variant            = ls_variant
              CHANGING
                   it_sort              = gt_sort[]
                   it_outtab            = itab_outtab
                   it_fieldcatalog      = t_fieldcat. "gt_fieldcatalog.
    expand first level
      CALL METHOD tree1->expand_tree
             EXPORTING
                 i_level = 1.
    optimize column-width
      CALL METHOD tree1->column_optimize
               EXPORTING
                   i_start_column = tree1->c_hierarchy_column_name
                   i_end_column   = tree1->c_hierarchy_column_name.
    ENDFORM.                    " alv_tree
    FORM register_events.
    define the events which will be passed to the backend
      data: lt_events type cntl_simple_events,
            l_event type cntl_simple_event.
    define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_click.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
      append l_event to lt_events.
      call method tree1->set_registered_events
        exporting
          events = lt_events
        exceptions
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
    ENDFORM.                    " register_events

    hi
    (also check u have refresh the field)
    Check the demo program,In this double click the data fields it will display some field in screen,You can check it
    BCALV_GRID_DND_TREE
    Thanks
    Edited by: dharma raj on Jun 17, 2009 7:41 PM

  • Double Click in ALV TREE doesn't get triggered

    Hello All,
    Double click event on item in a alv tree report doesn't get triggered. I thought I was doing everything right. Please help me out.
    Look at the code below and tell me what else I need to do.
    <b>FORM register_events .
    Event registration: tell ALV Tree which events shall be passed
    from frontend to backend.
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event,
            l_event_receiver TYPE REF TO lcl_tree_event_receiver.
    Frontend registration:  get already registered tree events
      CALL METHOD g_alv_tree->get_registered_events
        IMPORTING
          events = lt_events.
    Frontend registration: add additional event ids
      l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
      APPEND l_event TO lt_events.
    Frontend registration: provide new event table to alv tree
      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.
    Register events on backend (ABAP Objects event handling)
      CREATE OBJECT l_event_receiver.
      SET HANDLER l_event_receiver->node_double_click FOR g_alv_tree.
      SET HANDLER l_event_receiver->item_double_click FOR g_alv_tree.
      SET HANDLER l_event_receiver->on_function_selected FOR g_toolbar.
    ENDFORM.                    " register_events</b>
    When I double click on item on the report double click event doesnt trigger. what could be the problem? Any sample programs?
    Thanks,
    Chandni

    Hi,
    Here is a sample code for you.
    report ztree.
    TABLES : vbak.
    DATA: BEGIN OF mylist OCCURS 50. " Internal table hierarchy
    INCLUDE STRUCTURE snodetext.
    DATA: END OF mylist.
    DATA: f15 TYPE c.
    DATA :
    BEGIN OF gt_sales OCCURS 0,
    vbeln LIKE vbak-vbeln,
    kunnr LIKE vbak-kunnr,
    matnr LIKE vbap-matnr,
    arktx LIKE vbap-arktx,
    END OF gt_sales.
    SELECT-OPTIONS : s_vbeln FOR vbak-vbeln.
    START-OF-SELECTION.
    SET PF-STATUS 'ZTREE1'.
    SET TITLEBAR 'T1'.
    Fill internal table with pseudo-data
    PERFORM fill_itab.
    Hierarchy output
    PERFORM main.
    *& Form FILL_ITAB
    text
    --> p1 text
    <-- p2 text
    FORM fill_itab .
    *Fill the gt_sales table
    SELECT vkvbeln vkkunnr vpmatnr vparktx INTO CORRESPONDING FIELDS OF
    TABLE gt_sales
    FROM ( vbak AS vk INNER JOIN vbap AS vp ON vkvbeln = vpvbeln )
    WHERE vk~vbeln IN s_vbeln.
    SORT gt_sales BY vbeln kunnr.
    *Fill the root
    mylist-name = 'Report Tree List'.
    mylist-color = 1.
    mylist-intensiv = '1'.
    mylist-text = 'Report Tree List'.
    mylist-tlength = 16.
    mylist-tlevel = 1.
    mylist-tcolor = 1.
    mylist-tintensiv = '1'.
    mylist-text1 = 'using "RS_TREE_CONSTRUCT" function'.
    mylist-tlength1 = 50.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    LOOP AT gt_sales.
    ON CHANGE OF gt_sales-vbeln.
    mylist-name = 'level1'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = 'Sales Document no:'.
    mylist-tlength = 20.
    mylist-tlevel = 2.
    mylist-tcolor = 7.
    mylist-tintensiv = '1'.
    mylist-text1 = gt_sales-vbeln.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDON.
    ON CHANGE OF gt_sales-kunnr.
    mylist-name = 'level2'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = 'Customer no:'.
    mylist-tlength = 20.
    mylist-tlevel = 3.
    mylist-tcolor = 5.
    mylist-tintensiv = '1'.
    mylist-text1 = gt_sales-kunnr.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 3.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDON.
    mylist-name = 'level3'.
    mylist-color = 0.
    mylist-intensiv = '0'.
    mylist-text = gt_sales-matnr.
    mylist-tlength = 15.
    mylist-tlevel = 4.
    mylist-tcolor = 4.
    mylist-tintensiv = '0'.
    mylist-text1 = gt_sales-arktx.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 2.
    mylist-tintensiv1 = '0'.
    APPEND mylist.
    ENDLOOP.
    ENDFORM. " FILL_ITAB
    *& Form MAIN
    text
    --> p1 text
    <-- p2 text
    FORM main .
    PERFORM hierarchy. " construct & draw the tree
    ENDFORM. " MAIN
    *& Form HIERARCHY
    text
    --> p1 text
    <-- p2 text
    FORM hierarchy .
    PERFORM build_tree.
    PERFORM draw_tree.
    ENDFORM. " HIERARCHY
    FORM BUILD_TREE *
    Builds the tree from internal table *
    Uses the Function module RS_TREE_CONSTRUCT *
    FORM build_tree.
    CALL FUNCTION 'RS_TREE_CONSTRUCT'
    TABLES
    nodetab = mylist
    EXCEPTIONS
    tree_failure = 1.
    ENDFORM. "build_tree
    FORM DRAW_TREE *
    Builds the tree from internal table *
    Uses the Function module RS_TREE_DISPLAY *
    FORM draw_tree.
    sy-lsind = 0.
    CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
    callback_program = 'ZREPORT_TREE'
    callback_user_command = 'NODE_SELECT'
    IMPORTING
    f15 = f15.
    ENDFORM. "draw_tree
    FORM NODE_SELECT *
    Handles selection of nodes *
    FORM node_select TABLES knoten STRUCTURE seucomm
    USING command
    CHANGING exit
    list_refresh.
    Processing of commands for hierarchy list
    CASE command.
    WHEN 'DISP'.
    CASE knoten-id.
    WHEN '000002'.
    *Display Sales Order
    SET PARAMETER ID 'AUN' FIELD knoten-text1.
    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    WHEN '000003'.
    *Display Customer
    SET PARAMETER ID 'KUN' FIELD knoten-text1.
    CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
    ENDCASE.
    ENDCASE.
    list_refresh = 'X'.
    ENDFORM. "node_select

  • How to Open new screen for single click on ALV icon.

    Hi All,
    Can any body help me regarding the below ALV requirement.
    I need to create a executable program ZPROGRAM with a table having field to store long text.The ALV report should display records according to the selection screen parameters with a icon in each record when clicked should open a new screen with present data in the field and must be able to save the entered long text.
    Can any body give me the idea after displaying the simple ALV in the output,
    How to open new screen(not the Pop-up’s) after single click on the icon,
    in that I should be able to modify & save the long text in my ZTABLE and
    able to retrieve the same text for single clicked icon record.
    which function modules/Classes/Methods can we use for this requirement.
    And how retrieve the same text for this record.
    Thanks in advance.
    Regards,
    Kalam A.

    *& Report  ZTEST_ALV
    REPORT  ZTEST_ALV.
    TYPE-POOLS slis.
    DATA: gt_fieldcat TYPE TABLE OF slis_fieldcat_alv .
    DATA: gs_layout  TYPE slis_layout_alv.
    DATA: gt_list_top_of_page TYPE slis_t_listheader.
    DATA: gt_sortinfo_alv   TYPE  slis_t_sortinfo_alv.
    DATA: gs_print_alv TYPE slis_print_alv.
    DATA: gs_grid TYPE lvc_s_glay.
    DATA: gt_event TYPE slis_t_event.
    DATA: gs_event TYPE slis_alv_event.
    DATA: BEGIN OF GT_DISPLAY OCCURS 100.
       INCLUDE STRUCTURE MARA.
       DATA: BOX.
    DATA: END OF GT_DISPLAY.
    START-OF-SELECTION.
    SELECT * FROM MARA UP TO 50 ROWS
      INTO CORRESPONDING FIELDS OF TABLE GT_DISPLAY.
    End-of-Selection.
      PERFORM build_alv.
      PERFORM display_screen .
    FORM build_alv .
      DATA: ls_fieldcat LIKE LINE OF gt_fieldcat.
      DATA: ls_top TYPE LINE OF slis_t_listheader.
      DATA: ls_sort TYPE slis_sortinfo_alv.
      CLEAR: ls_fieldcat, gt_fieldcat[], ls_top,gt_list_top_of_page[],
             ls_sort,gs_grid,gs_print_alv,gt_sortinfo_alv[].
    *&-----gs_layout definition.
    gs_layout-zebra = 'X'.
    gs_layout-detail_popup = 'X'.          "ÊÇ·ñµ¯³öÏêϸÐÅÏ¢´°¿Ú
    gs_layout-f2code = '&ETA'.             "ÉèÖô¥·¢µ¯³öÏêϸÐÅÏ¢´°¿ÚµÄ¹¦ÄÜÂë,ÕâÀïÊÇË«»÷
      gs_layout-no_vline = ' '.              "ÉèÖÃÁмä¸ôÏß
      gs_layout-colwidth_optimize = 'X'.     "ÓÅ»¯Áпí
      gs_layout-detail_initial_lines = 'X'.
    gs_layout-coltab_fieldname = 'LINE_COLOR'. "Line_colorΪgt_displayµÄÒ»¸ö×Ö¶Î,¾ßÌåÑÕÉ«ÉèÖüûÏÂÃæ˵Ã÷.
      gs_layout-hotspot_fieldname = 'MATNR'.
    gs_layout-detail_titlebar = 'ÏêϸÄÚÈÝ'. "ÉèÖõ¯³ö´°¿ÚµÄ±êÌâÀ¸
    gs_layout-group_change_edit = 'X'.
    *&-----gs_grid definition.
      gs_grid-top_p_only = 'X'.
    *&-----gs_print_alv definition.
      gs_print_alv-prnt_title = 'X'.
      gs_print_alv-prnt_info = 'X'.
    *&-----gt_sortinfo_alv definition. С¼Æ
      ls_sort-fieldname = 'MTART'.
      ls_sort-tabname =  'GT_DISPLAY'.
      ls_sort-subtot = 'X'.
      ls_sort-spos      = 1.
      ls_sort-up        = 'X'.
    ls_sort-group = 'UL'.
      APPEND ls_sort TO gt_sortinfo_alv.
      ls_sort-fieldname = 'AENAM'.
      ls_sort-tabname =  'GT_DISPLAY'.
      ls_sort-subtot = 'X'.
      ls_sort-spos      = 1.
      ls_sort-up        = 'X'.
    ls_sort-group = 'UL'.
      APPEND ls_sort TO gt_sortinfo_alv.
    *&-----slis_t_listheader definition. title.
      CLEAR  ls_top.
      ls_top-key  = 'µ±Ç°ÈÕÆÚ:'.
      ls_top-typ  = 'S'.  " H = Header, S = Selection, A = Action
      CONCATENATE  sy-datum0(4)   '-' sy-datum4(2) '-' sy-datum+6(2) INTO ls_top-info .
      APPEND ls_top TO gt_list_top_of_page.
      CLEAR  ls_top.
      ls_top-key  = 'title'.
      ls_top-typ  = 'S'.  " H = Header, S = Selection, A = Action
      ls_top-info = space.
      APPEND ls_top TO gt_list_top_of_page.
    *&-----gs_print_alv definition.
      gs_print_alv-prnt_title = 'X'.
      gs_print_alv-prnt_info = 'X'.
    *&-----gt_fieldcat definition.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
         i_program_name     = sy-repid
         i_internal_tabname = 'GT_DISPLAY'
          i_structure_name = 'MARA'
          I_CLIENT_NEVER_DISPLAY = 'X'
         i_inclname         = sy-repid
       CHANGING
         ct_fieldcat        = gt_fieldcat[]
       EXCEPTIONS
         inconsistent_interface = 1
         program_error          = 2
         OTHERS                 = 3.
      ls_fieldcat-hotspot = 'X'.
      MODIFY gt_fieldcat FROM ls_fieldcat INDEX 2.
    **-1. definition with macro.
      DEFINE macro.
       col_pos = col_pos + 1.
       ls_fieldcat-tabname   = 'it_typ_data'.
        ls_fieldcat-fieldname = '&1'.
        ls_fieldcat-seltext_l =  &2.
       ls_fieldcat-col_pos   =  col_pos.
        ls_fieldcat-outputlen =  '&3'.
       ls_fieldcat-datatype  =  '&4'.
       ls_fieldcat-do_sum    =  &5.
       ls_fieldcat-edit    =   &6.
       ls_fieldcat-checkbox  =   &7.
       ls_fieldcat-key   =   &9.
       ls_fieldcat-fix_column =  &10.
       ls_fieldcat-no_out =  &11.
        ls_fieldcat-ref_fieldname = &4.    " System F4 Effect.
        ls_fieldcat-ref_tabname   =  &5.   " System F4 Effect.
        ls_fieldcat-hotspot   =   &6.
        append ls_fieldcat to gt_fieldcat.
        clear ls_fieldcat.
      END-OF-DEFINITION.
      macro matnr     'matnr'            18   'MATNR'   'MARA'  'X'.
      macro MTART     'MTART'            18      'MTART' 'MARA'  ''.
      macro  AENAM    'AENAM'            18       'MAENAM'  'MARA'   ''.
    **-2. definition one-by-one.
    CLEAR ls_fieldcat.
    ls_fieldcat-fieldname = 'MATNR'.
    ls_fieldcat-seltext_s = 'ÎïÁÏ'.
    ls_fieldcat-ref_fieldname = 'ROLLNAME'.
    ls_fieldcat-ref_tabname   =  'DD03L'.
    APPEND ls_fieldcat TO gt_fieldcat.
    ENDFORM.                    "build_alv
    FORM display_screen .
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type     = 0
       IMPORTING
         et_events       = gt_event
       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.
    READ TABLE gt_event INTO gs_event WITH KEY name = 'TOP_OF_PAGE'.
    IF sy-subrc EQ 0.
       gs_event-form = 'TOP_OF_PAGE'.
       MODIFY gt_event FROM gs_event INDEX sy-tabix.
    ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = sy-repid
        i_callback_pf_status_set          = 'PF_STATUS_SET '
         i_callback_user_command           = 'USER_COMMAND'
        i_callback_top_of_page            = 'TOP_OF_PAGE'
       I_CALLBACK_HTML_TOP_OF_PAGE       = 'HTML_TOP_OF_PAGE'
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
        I_BACKGROUND_ID                   = 'ALV_BACKGROUND'    "When top-of-page is initial.
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
         is_layout                         = gs_layout
         it_fieldcat                       = gt_fieldcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
        it_sort                           =  gt_sortinfo_alv[]
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
       I_SAVE                            = 'A'
      IS_VARIANT                        =
      IT_EVENTS                         = gt_event
      IT_EVENT_EXIT                     =
       IS_PRINT                          = gs_print_alv
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = gt_display
    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_screen
    FORM user_command          USING ucomm LIKE sy-ucomm
                               selfield TYPE slis_selfield.
    Data ref1 type ref to cl_gui_alv_grid.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' "Check Box need fieldcat-checkbox, input and edit.
         IMPORTING
           E_GRID = ref1.
      CASE ucomm.
        WHEN '&IC1'. " SAP standard code for double-clicking
    READ TABLE gt_display INTO gs_display INDEX  slis_selfield-tabindex.
    CHECK sy-subrc = 0.
         CASE  selfield-fieldname  .
           WHEN 'PLNUM'.
             SET PARAMETER ID 'PAF' FIELD gs_display-plnum.
             CALL TRANSACTION 'MD12' AND SKIP FIRST SCREEN.
           WHEN  'POSNR'.
           SUBMIT  rvscd100 USING SELECTION-SCREEN '1000' WITH vbeln = gs_display-vbeln
                                                          WITH posnr = gs_display-posnr
                                                          WITH zinfo = 'X'
                                                          AND RETURN.
         ENDCASE.
       IF selfield-sel_tab_field = 'OUT_ITAB-PI_SL'. " Line detail.
           READ TABLE i_output INTO pisl_itab INDEX selfield-tabindex.
           IF sy-subrc EQ 0.
       ENDIF.
        WHEN 'CHANGE'.
         CALL METHOD ref1->check_changed_data.
         CALL METHOD ref1->refresh_table_display.
    *5´Ë´¦´úÂë×èÖ¹'REUSE_ALV_GRID_DISPLAY´´½¨ÐµÄÆÁÄ»£¬Ôì³ÉÆÁÄ»¶à²ã
         selfield-refresh = 'X'.
        WHEN 'SWITCH'.
         PERFORM switch_edit_mode.
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                    "user_command
    Add your code in user_command form.
    WHEN you click matnr ucomm eq '&IC1'.
    Message was edited by:
            Chunhai Hu

  • Regarding single click in alv's

    hi guru's
    i have a small problem.
    iam using a alv grid display. after clicking on the row in alv , i need to navigate to a transaction mm03. 
    My problem is the navigation is happening in double-click. how can i use the single click option.
    my program consists of:
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = sy-repid
          i_structure_name       = l_c_struc
          i_inclname             = sy-repid
        CHANGING
          ct_fieldcat            = fp_l_i_fieldcat
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = sy-cprog
          i_callback_user_command = l_c_user_command
          i_grid_title            = text-004
          is_layout               = fp_wa_layout
          it_fieldcat             = fp_i_fieldcatalog
          i_save                  = l_c_a
          it_events               = fp_i_event
        TABLES
          t_outtab                = fp_i_makt
    FORM at_user_command USING fp_ucom     TYPE sy-ucomm
                               fp_selfield TYPE slis_selfield.  "#EC *
        CASE fp_ucom.
          WHEN '&IC1'.
            READ TABLE i_makt INTO wa_final
                                        INDEX fp_selfield-tabindex.
            IF sy-subrc EQ c_0.
              SET PARAMETER ID 'MAT' FIELD wa_final-matnr.
              CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
            ENDIF.
          WHEN OTHERS.
            MESSAGE i009.
        ENDCASE.
    ENDFORM.                  
    please give me a detailed description as iam new to abap programming.

    HI USE THIS EXAMPLE ,
    use the hot spot for this option.
    *& Report  Z_TEST001
    REPORT  Z_TEST001.
    TYPE-POOLS:  slis.
    tables: rseg.
    DATA: begin of TAB_ARSEG occurs 0.
            INCLUDE STRUCTURE RSEG.
    DATA: END OF TAB_ARSEG.
    DATA: T_FIELDCAT TYPE slis_t_fieldcat_alv.
    DATA: c_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
    START-OF-SELECTION.
    <<<  YOUR CODE  >>> ***********************
    select * from rseg into table tab_arseg .
    END-OF-SELECTION.
    perform build_fieldcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
        i_buffer_active                   = space
        i_callback_program                = sy-repid
       I_CALLBACK_USER_COMMAND            = c_user_command
      I_STRUCTURE_NAME                  =
      IS_LAYOUT                         =
       IT_FIELDCAT                        = T_FIELDCAT[]
      TABLES
        T_OUTTAB                          = TAB_ARSEG
    EXCEPTIONS
       PROGRAM_ERROR                      = 1
       OTHERS                             = 2.
    IF SY-SUBRC ne 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    **&      Form  USER_COMMAND
    FORM USER_COMMAND USING F_UCOMM LIKE SY-UCOMM
                    I_SELFIELD TYPE SLIS_SELFIELD.
      DATA: F_SUBRC LIKE SY-SUBRC,
            s_arseg like tab_arseg.
      READ TABLE tab_arseg INDEX i_selfield-tabindex INTO s_arseg.
        CASE F_UCOMM.
            WHEN '&IC1'.
            CASE i_SELFIELD-SEL_TAB_FIELD.
            WHEN 'TAB_ARSEG-BELNR'.
              CHECK NOT S_ARSEG-BELNR IS INITIAL.
              SET PARAMETER ID 'RBN' FIELD S_ARSEG-BELNR.
              SET PARAMETER ID 'GJR' FIELD S_ARSEG-GJAHR.
              CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
            ENDCASE.
        ENDCASE.
    ENDFORM.
    **&      Form  build_fieldcat
    FORM build_fieldcat .
    DATA: FIELDCAT TYPE SLIS_FIELDCAT_ALV.
      CLEAR FIELDCAT.
      FIELDCAT-FIELDNAME     = 'BELNR'.
      FIELDCAT-TABNAME       = 'TAB_ARSEG'.
      FIELDCAT-REF_TABNAME   = 'RSEG'.
      FIELDCAT-REF_FIELDNAME = 'BELNR'.
      fieldcat-hotspot   = 'X'.
      FIELDCAT-COL_POS       = 1.
      APPEND FIELDCAT TO t_fieldcat.
      CLEAR FIELDCAT.
      FIELDCAT-FIELDNAME     = 'GJAHR'.
      FIELDCAT-TABNAME       = 'TAB_ARSEG'.
      FIELDCAT-REF_TABNAME   = 'RSEG'.
      FIELDCAT-REF_FIELDNAME = 'GJAHR'.
      FIELDCAT-COL_POS       = 2.
      APPEND FIELDCAT TO t_fieldcat.
    ENDFORM.                    " build_fieldcat
    REGARDS,
    VENKAT.

  • Single-click on a Tree not cancelable

    Hi,
    I have a component that includes a Tree, and the Tree uses a
    custom TreeItemRenderer. The render extends the default one, and
    adds a small graphic next to each Tree node's label.
    If users click the graphic, I'd like to prevent the default
    single-click behavior of the tree. For example, I'd like to prevent
    the node being selected.
    I've found that MouseEvent.CLICK is not cancelable, so
    preventDefault() has no effect.
    Is there a way to prevent the Tree from reacting to the
    single click, if the single-click is on the graphic in my item
    renderer?

    "Marc Missire" <[email protected]> wrote in
    message
    news:gap3mm$def$[email protected]..
    > Hi,
    >
    > I have a component that includes a Tree, and the Tree
    uses a custom
    > TreeItemRenderer. The render extends the default one,
    and adds a small
    > graphic
    > next to each Tree node's label.
    >
    > If users click the graphic, I'd like to prevent the
    default single-click
    > behavior on the tree. For example, I'd like to prevent
    the node being
    > selected.
    >
    > I've found that MouseEvent.CLICK is not cancelable, so
    preventDefault()
    > has no
    > effect.
    >
    > Is there a way to prevent the Tree from reacting to the
    single click, if
    > the
    > single-click is on the graphic in my item renderer?
    Setting mouseChildren to false on the image might work.
    HTH;
    Amy

  • Double Click on ALV Tree

    Hi All,
    I am displaying the output of my report in ALV Tree form displaying Plant, Functional Location,
    Equipment, Order as Levels.
    The Requirement is when i double click on the order number, it should navigate to the Details of the Order i.e. navigate to Transaction IW33.
    I have used the Function Module "RS_TREE_LIST_DISPLAY" for displaying my ALV output as below :
        CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
          EXPORTING
            CALLBACK_PROGRAM      = 'ZPM714'.
    Please suggest me for this.
    Thanks & Regards,
    Bhavika

    Hi Pavan,
    Please find the code below :
    FORM BUILD_TREE .
      CLEAR : WA_NODE, WT_NODE[], WT_NODE.
    ***Building ALV Tree maintaining the Hierarchy of Plant,Functional Location,Equipment Number,& Object Number
      WA_NODE-TYPE = 'T'.
      WA_NODE-NAME = 'Plant'.
      WA_NODE-TLEVEL = '01'.
      WA_NODE-NLENGTH = '15'.
      WA_NODE-COLOR = '5'.
    WA_NODE-TPOS = '45'.
      WA_NODE-TPOS = '85'.
      WA_NODE-TEXT = 'Actual Costs'.
      WA_NODE-TLENGTH = '15'.
      WA_NODE-TCOLOR = '3'.
    WA_NODE-TPOS1 = '60'.
      WA_NODE-TPOS1 = '100'.
      WA_NODE-TEXT1 = 'Planned Costs'.
      WA_NODE-TLENGTH1 = '20'.
      WA_NODE-TCOLOR1 = '3'.
      APPEND WA_NODE TO WT_NODE.
      CLEAR WA_NODE.
      LOOP AT WT_P.
        WA_NODE-TYPE = 'P'.
        WA_NODE-TLEVEL = '02'.
        WA_NODE-TEXT = WT_P-WERKS.
        WA_NODE-TLENGTH = '15'.
        WA_NODE-TCOLOR = '1'.
        CLEAR WV_VALUE.
        WV_VALUE = WT_P-WTGBTR.
        CONDENSE WV_VALUE.
        WA_NODE-TEXT1 = WV_VALUE.
        WA_NODE-TLENGTH1 = '15'.
        WA_NODE-TCOLOR1 = '1'.
       WA_NODE-TPOS1 = '45'.
        WA_NODE-TPOS1 = '85'.
        CLEAR WV_VALUE.
        WV_VALUE = WT_P-WTG001.
        CONDENSE WV_VALUE.
        WA_NODE-TEXT2 = WV_VALUE.
        WA_NODE-TLENGTH2 = '15'.
        WA_NODE-TCOLOR2 = '1'.
       WA_NODE-TPOS2 = '60'.
        WA_NODE-TPOS2 = '100'.
        APPEND WA_NODE TO WT_NODE.
        CLEAR WA_NODE.
        LOOP AT WT_FL WHERE WERKS = WT_P-WERKS.
          WA_NODE-TYPE = 'P'.
          WA_NODE-TLEVEL = '03'.
         WA_NODE-TEXT = WT_FL-ILOAN.
          WA_NODE-TEXT = WT_FL-TPLNR.
         WA_NODE-TLENGTH = '12'.
          WA_NODE-TLENGTH = '30'.
          WA_NODE-TCOLOR = '1'.
          CLEAR WV_VALUE.
          WV_VALUE = WT_FL-AC.
          CONDENSE WV_VALUE.
          WA_NODE-TEXT1 = WV_VALUE.
          WA_NODE-TLENGTH1 = '15'.
          WA_NODE-TCOLOR1 = '1'.
         WA_NODE-TPOS1 = '45'.
          WA_NODE-TPOS1 = '85'.
          CLEAR WV_VALUE.
          WV_VALUE = WT_FL-PC.
          CONDENSE WV_VALUE.
          WA_NODE-TEXT2 = WV_VALUE.
          WA_NODE-TLENGTH2 = '15'.
          WA_NODE-TCOLOR2 = '1'.
         WA_NODE-TPOS2 = '60'.
          WA_NODE-TPOS2 = '100'.
          APPEND WA_NODE TO WT_NODE.
          CLEAR WA_NODE.
          LOOP AT WT_EQ WHERE WERKS = WT_FL-WERKS AND
                             FUNC_LOC = WT_FL-ILOAN.
                              TPLNR = WT_FL-TPLNR.
            WA_NODE-TYPE = 'P'.
            WA_NODE-TLEVEL = '04'.
            WA_NODE-TEXT = WT_EQ-EQUNR.
            WA_NODE-TLENGTH = '18'.
            WA_NODE-TCOLOR = '1'.
            WA_NODE-TEXT1 = WT_EQ-EQKTX.
            WA_NODE-TLENGTH1 = '40'.
            WA_NODE-TCOLOR1 = '1'.
           WA_NODE-TPOS1 = '45'.
            WA_NODE-TPOS1 = '40'.
            CLEAR WV_VALUE.
            WV_VALUE = WT_EQ-AC.
            CONDENSE WV_VALUE.
            WA_NODE-TEXT2 = WV_VALUE.
            WA_NODE-TLENGTH2 = '15'.
            WA_NODE-TCOLOR2 = '1'.
           WA_NODE-TPOS1 = '45'.
            WA_NODE-TPOS2 = '85'.
            CLEAR WV_VALUE.
            WV_VALUE = WT_EQ-PC.
            CONDENSE WV_VALUE.
            WA_NODE-TEXT3 = WV_VALUE.
            WA_NODE-TLENGTH3 = '15'.
            WA_NODE-TCOLOR3 = '1'.
           WA_NODE-TPOS2 = '60'.
            WA_NODE-TPOS3 = '100'.
            APPEND WA_NODE TO WT_NODE.
            CLEAR WA_NODE.
            LOOP AT WT_OB WHERE WERKS = WT_EQ-WERKS AND
                               FUNC_LOC = WT_EQ-FUNC_LOC AND
                                TPLNR = WT_EQ-TPLNR AND
                                EQUNR    = WT_EQ-EQUNR.
              WA_NODE-TYPE = 'P'.
              WA_NODE-TLEVEL = '05'.
             WA_NODE-TEXT = WT_OB-OBJNR.
              WA_NODE-TEXT = WT_OB-AUFNR.
             WA_NODE-TLENGTH = '22'.
              WA_NODE-TLENGTH = '12'.
              WA_NODE-TCOLOR = '1'.
              WA_NODE-TEXT1 = WT_OB-KTEXT.
              WA_NODE-TLENGTH1 = '40'.
              WA_NODE-TCOLOR1 = '1'.
             WA_NODE-TPOS1 = '45'.
              WA_NODE-TPOS1 = '40'.
              CLEAR WV_VALUE.
              WV_VALUE = WT_OB-AC.
              CONDENSE WV_VALUE.
              WA_NODE-TEXT2 = WV_VALUE.
              WA_NODE-TLENGTH2 = '15'.
              WA_NODE-TCOLOR2 = '1'.
             WA_NODE-TPOS1 = '45'.
              WA_NODE-TPOS2 = '85'.
              CLEAR WV_VALUE.
              WV_VALUE = WT_OB-PC.
              CONDENSE WV_VALUE.
              WA_NODE-TEXT3 = WV_VALUE.
              WA_NODE-TLENGTH3 = '15'.
              WA_NODE-TCOLOR3 = '1'.
             WA_NODE-TPOS2 = '60'.
              WA_NODE-TPOS3 = '100'.
              APPEND WA_NODE TO WT_NODE.
              CLEAR WA_NODE.
              LOOP AT WT_CE WHERE AUFNR = WT_OB-AUFNR.
                WA_NODE-TYPE = 'P'.
                WA_NODE-TLEVEL = '06'.
                WA_NODE-TEXT = WT_CE-KSTAR.
                WA_NODE-TLENGTH = '10'.
                WA_NODE-TCOLOR = '1'.
                CLEAR WV_VALUE.
                WV_VALUE = WT_CE-AC.
                CONDENSE WV_VALUE.
                WA_NODE-TEXT1 = WV_VALUE.
                WA_NODE-TLENGTH1 = '15'.
                WA_NODE-TCOLOR1 = '1'.
                WA_NODE-TPOS1 = '85'.
                CLEAR WV_VALUE.
                WV_VALUE = WT_CE-PC.
                CONDENSE WV_VALUE.
                WA_NODE-TEXT2 = WV_VALUE.
                WA_NODE-TLENGTH2 = '15'.
                WA_NODE-TCOLOR2 = '1'.
                WA_NODE-TPOS2 = '100'.
                APPEND WA_NODE TO WT_NODE.
                CLEAR WA_NODE.
              ENDLOOP.
            ENDLOOP.
          ENDLOOP.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " BUILD_TREE
    *&      Form  DISPLAY_TREE
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_TREE .
    **Constructing the ALV Tree using Func Mod RS_TREE_CONSTRUCT*
      CALL FUNCTION 'RS_TREE_CONSTRUCT'
    EXPORTING
      INSERT_ID                = '000000'
      RELATIONSHIP             = ' '
      LOG                      =
        TABLES
          NODETAB                  = WT_NODE
       EXCEPTIONS
         TREE_FAILURE             = 1
         ID_NOT_FOUND             = 2
         WRONG_RELATIONSHIP       = 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.
    **Displaying the ALV Tree using Func Mod RS_TREE_LIST_DISPLAY*
      IF WT_FINAL_TEMP[] IS INITIAL.
        MESSAGE 'No Data Available' TYPE 'S'.
      ELSE.
        CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
          EXPORTING
            CALLBACK_PROGRAM      = 'ZPM714'
           CALLBACK_USER_COMMAND = 'USER_COMMAND'
      ENDIF.
    ENDFORM.                    " DISPLAY_TREE
    Regards,
    Bhavika

  • Single Click on simple tree node

    Hi Experts,
    I have a problem ,please help me.
    I need event is trigger on single click on node of simple tree.There is event of double click but i need on single click only.
    If you have any test program please forward it also.
    Ankur Garg.

    i dont think for single click you can get any event in simple list... you can make hotspot on by this way single click will trigger the at line-selection event.
    REPORT  ZSPDEXDET LINE-SIZE 200 line-count 19(4).
    TABLES : MAST,STPO,MARA,MARC.
    INCLUDE <SYMBOL>.
    DATA : BEGIN OF I_BOM OCCURS 0.
            INCLUDE STRUCTURE STPOX.
    DATA : END OF I_BOM.
    DATA : BEGIN OF ITAB OCCURS 0,
           STUFE LIKE STPOX-STUFE,
           IDNRK LIKE STPOX-IDNRK,
           WEGXX LIKE STPOX-WEGXX, "NODE NO
           TTIDX LIKE STPOX-TTIDX, "NODE NO WITH PARENTNODE + 1
           VWEGX LIKE STPOX-VWEGX, "NODE NO OF PARENT
           MENGE LIKE STPOX-MENGE,
           SYMBOL,
           END OF ITAB.
    DATA : ITAB1 LIKE ITAB OCCURS 0 WITH HEADER LINE,
           ITAB2 LIKE ITAB OCCURS 0 WITH HEADER LINE.
    DATA : V_PARENTID LIKE STPOX-VWEGX,
           V_WEGXX LIKE STPOX-WEGXX,
           V_STUFE LIKE STPOX-STUFE,
           PREV_STUFE LIKE STPOX-STUFE.
    DATA : V_OFFSET TYPE I VALUE 1,
           V_CONTENT TYPE I,
           TABIX LIKE SY-TABIX,
           V_TABIX LIKE SY-TABIX,
           T_TABIX LIKE SY-TABIX,
           V_SYMBOL,
           V_LINE LIKE SY-TABIX,
           T_INDEX TYPE I.
    DATA :  V_PAGE LIKE SY-PAGNO,
            T_PAGE LIKE SY-PAGNO,
            V_LIN LIKE SY-LILLI.
    PARAMETERS : P_MATNR LIKE MAST-MATNR,
                 P_WERKS LIKE MARC-WERKS.
    PERFORM BOM_EXPLODE.
    ITAB1[] = ITAB[].
    READ TABLE ITAB1 INDEX 1.
    APPEND ITAB1 TO ITAB2.
    PERFORM PRINT TABLES ITAB2.
    AT LINE-SELECTION.
      V_LIN = SY-LILLI.
      T_PAGE = V_PAGE.
      PREV_STUFE = ITAB2-STUFE.
      V_STUFE = ITAB2-STUFE + 1.
      V_WEGXX = ITAB2-WEGXX.
      V_SYMBOL = ITAB2-SYMBOL.
      IF ITAB2-SYMBOL = '+'.
        ITAB2-SYMBOL = '-'.
        MODIFY ITAB2 INDEX V_TABIX.
      ELSEIF ITAB2-SYMBOL = '-'.
        ITAB2-SYMBOL = '+'.
        MODIFY ITAB2 INDEX V_TABIX.
      ENDIF.
      LOOP AT ITAB WHERE STUFE = V_STUFE AND VWEGX = V_WEGXX.
        V_TABIX = V_TABIX + 1.
        IF V_SYMBOL = '+'.
          MOVE-CORRESPONDING ITAB TO ITAB2.
          ITAB2-SYMBOL = '+'.
          INSERT ITAB2 INDEX V_TABIX.
        ELSEIF V_SYMBOL = '-'.
         IF V_TABIX GT 2.
          LOOP AT ITAB2 FROM V_TABIX WHERE STUFE = PREV_STUFE.
            T_TABIX = SY-TABIX.
            T_TABIX = T_TABIX - 1.
            EXIT.
          ENDLOOP.
           IF V_TABIX LE T_TABIX.
            DELETE ITAB2 FROM V_TABIX TO T_TABIX.
           ELSE.
            LOOP AT ITAB2 FROM V_TABIX.
    *          T_TABIX = T_TABIX + 1.
              IF ITAB2-STUFE GT PREV_STUFE.
               DELETE ITAB2 INDEX SY-TABIX.
              ELSE.
                EXIT.
              ENDIF.
            ENDLOOP.
    *        DELETE ITAB2 FROM V_TABIX WHERE STUFE LT V_STUFE.
           ENDIF.
           EXIT.
          ELSE.
            DELETE ITAB2 FROM V_TABIX.
            EXIT.
          ENDIF.
        ENDIF.
      ENDLOOP.
      SY-LSIND = 0.
      T_INDEX = 1.
      PERFORM PRINT TABLES ITAB2.
      SCROLL LIST INDEX T_INDEX TO PAGE T_PAGE . " LINE V_LIN .
    *&      Form  BOM_EXPLODE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM BOM_EXPLODE .
      CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
        EXPORTING
          CAPID                 = 'PP01'
          DATUV                 = SY-DATUM
          MEHRS                 = 'X'
          MTNRV                 = P_MATNR
          WERKS                 = P_WERKS
        TABLES
          STB                   = I_BOM
        EXCEPTIONS
          ALT_NOT_FOUND         = 1
          CALL_INVALID          = 2
          MATERIAL_NOT_FOUND    = 3
          MISSING_AUTHORIZATION = 4
          NO_BOM_FOUND          = 5
          NO_PLANT_DATA         = 6
          NO_SUITABLE_BOM_FOUND = 7
          CONVERSION_ERROR      = 8
          OTHERS                = 9.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      ITAB-IDNRK = P_MATNR.
      ITAB-MENGE = '1'.
      ITAB-STUFE = '0'.
      ITAB-WEGXX = '0'.
      ITAB-TTIDX = '0'.
      ITAB-VWEGX = '-1'.
      ITAB-SYMBOL = '+'.
      APPEND ITAB.
      CLEAR ITAB.
      LOOP AT I_BOM.
        MOVE-CORRESPONDING I_BOM TO ITAB.
        APPEND ITAB.
        CLEAR ITAB.
      ENDLOOP.
    ENDFORM.                    " BOM_EXPLODE
    *&      Form  PRINT
    *       text
    *      -->P_ITAB1  text
    FORM PRINT  TABLES   P_ITAB1 STRUCTURE ITAB.
      DATA : V_ID LIKE STPOX-VWEGX.
      DATA : T_LINE LIKE SY-TABIX,
             V_LINE TYPE I,
             V_HLINE TYPE I.
      DATA : PAGE TYPE I.
      DESCRIBE TABLE P_ITAB1 LINES V_LINE.
      T_LINE = V_LINE - 1.
      LOOP AT P_ITAB1.
        V_OFFSET = P_ITAB1-STUFE * 3.
        V_CONTENT = P_ITAB1-STUFE * 6.
        V_LINE = P_ITAB1-STUFE * 4.
        IF P_ITAB1-STUFE NE 0.
          V_HLINE = V_LINE + 2.
        ELSE.
          V_HLINE = 2.
        ENDIF.
    *    T_INDEX = T_INDEX + 1.
        COMPUTE PAGE = SY-TABIX MOD 13.
        IF PAGE EQ 0.
          NEW-PAGE.
          V_PAGE = SY-PAGNO.
    *     T_INDEX = 0.
        ENDIF.
        V_TABIX = SY-TABIX.
        IF P_ITAB1-SYMBOL = '+'.
           WRITE : /.
            WRITE AT : V_OFFSET  SYM_PLUS_FOLDER AS SYMBOL
                    COLOR 4 INTENSIFIED HOTSPOT.
            WRITE : AT V_CONTENT P_ITAB1-IDNRK,P_ITAB1-MENGE.
          HIDE : P_ITAB1,V_TABIX,V_PAGE.
        ELSEIF P_ITAB1-SYMBOL = '-'.
          WRITE : /.
          WRITE AT V_OFFSET SYM_MINUS_FOLDER AS SYMBOL
                    COLOR 4 INTENSIFIED HOTSPOT.
          WRITE : AT V_CONTENT P_ITAB1-IDNRK,P_ITAB1-MENGE.
          HIDE : P_ITAB1,V_TABIX,V_PAGE.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " PRINT
    regards
    shiba dutta

  • Double click in alv tree

    hi!
    I wrote an ALV report using some parts of the code from BCALV_TREE_DEMO.
    I added a new icon to the status of the screen.
    I want to add a function that when standing on the line with cursor and then  pressing the new button,  I will use the call transaction passing some of the values from the line which i selected to the call transaction.
    how can i do it?
    If someone has a code for it , it will be great.
    thanks
    Yifat

    Hi,
    You can use the method " GET_SELECTED_ITEM "/ "GET_SELECTED_NODES " of CL_GUI_ALV_TREE to identify the selected items. I am assuming that you have used this class to construct your tree.
    How you identify the item depends on the logic you used to construct your tree i,e if you have somehow stored the info of the node you select on the tree.
    For ex, you have a tree displaying Sales orders. You can either give the NODE KEY as the Sales ord num itself or you may give the sales order num in the NODE TEXT so that you can retrieve that later.
    Take a look at SLIS package for detailed examples on ALV tree's.
    Now regarding the call transaction part, you can use the below format :
          set parameter id 'VL' field [your_field].
          call transaction 'VL03N' and skip first screen.
    Identify your field & the transaction.
    Regards,
    Sharat.

  • Single click on alv calls details in another alv

    i have one alv where i can display main data. after i mak a click on the line in the alv i want to see ather details according to the first alv in a second alv.
    is that possible?

    Hi,
    Refer the below program
    class lcl_event_receiver definition deferred.
    data: ok_code like sy-ucomm,
          save_ok like sy-ucomm,
          g_max type i value 100,
          gt_sflight type table of sflight,
          gt_sbook type table of sbook,
          g_repid like sy-repid,
          gs_layout   type lvc_s_layo,
          cont_for_flights   type scrfname value 'BCALV_GRID_02_100',
          grid1  type ref to cl_gui_alv_grid,
          custom_container type ref to cl_gui_custom_container,
          grid2  type ref to cl_gui_alv_grid,
    * reference to dialogbox container.
          dialogbox_container type ref to cl_gui_dialogbox_container,
    * reference to local class that handles events of GRID1 and
    * DIALOGBOX_CONTAINER
          event_receiver type ref to lcl_event_receiver.
    * Set initial dynpro
    set screen 100.
    * LOCAL CLASSES: Definition
    *===============================================================
    * class lcl_event_receiver: local class to handle event DOUBLE_CLICK
    *                           and CLOSE.
    * Definition:
    * ~~~~~~~~~~~
    class lcl_event_receiver definition.
      public section.
        methods:
        handle_double_click
            for event double_click of cl_gui_alv_grid
                importing e_row e_column,
        handle_close
            for event close of cl_gui_dialogbox_container
                importing sender.
      private section.
       data: dialogbox_status type c.  "'X': does exist, SPACE: does not ex.
    endclass.
    * lcl_event_receiver (Definition)
    *===============================================================
    * LOCAL CLASSES: Implementation
    *===============================================================
    * class c_event_receiver (Implementation)
    * In this example, only event DOUBLE_CLICK is caught
    class lcl_event_receiver implementation.
    * §3.At doubleclick(1): The event DOUBLE_CLICK provides
    *    parameters of the clicked row and column.
    *    Use row parameter to select a line of the
    *    corresponding internal table.
      method handle_double_click.
        data: ls_sflight like line of gt_sflight.
    * read selected row from internal table gt_sflight
        read table gt_sflight index e_row-index into ls_sflight.
    * §4.At Doubleclick(2): Select booking data
        perform select_table_sbook using ls_sflight
                                   changing gt_sbook.
    * §5.At doubleclick(3): Create dialogbox to show detail list
    *   (if not already existent)
        if dialogbox_status is initial.
          dialogbox_status = 'X'.
          perform create_detail_list.
        else.
          call method dialogbox_container->set_visible
                           exporting visible = 'X'.
          call method grid2->refresh_table_display.
        endif.
      endmethod.
      method handle_close.
    * §6.Handle the CLOSE-button of the dialogbox
    * set dialogbox invisible
    * (the dialogbox is destroyed outomatically when the user
    * switches to another dynpro).
        call method sender->set_visible
              exporting visible = space.
    * In this example closing the dialogbox leads
    * to make it invisible. It is also conceivable to destroy it
    * and recreate it if the user doubleclicks a line again.
    * Displaying a great amount of data has a greater impact on performance.
      endmethod.
    endclass.
    * lcl_event_receiver (Implementation)
    *===================================================================
    *       FORM EXIT_PROGRAM                                             *
    form exit_program.
      call method custom_container->free.
      call method cl_gui_cfw=>flush.
      if sy-subrc ne 0.
    * add your handling, for example
        call function 'POPUP_TO_INFORM'
             exporting
                  titel = g_repid
                  txt2  = sy-subrc
                  txt1  = 'Error in FLush'(500).
      endif.
      leave program.
    endform.
    *&      Module  PBO_100  OUTPUT
    *       text
    module pbo_100 output.
      set pf-status 'MAIN100'.
      set titlebar 'MAIN100'.
      g_repid = sy-repid.
    * §1.Create one ALV Control that shows the first table.
      if custom_container is initial.
    * select data from table SFLIGHT
        perform select_table_sflight changing gt_sflight.
    * create a custom container control for our ALV Control
        create object custom_container
            exporting
                container_name = cont_for_flights
            exceptions
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
        if sy-subrc ne 0.
    * add your handling, for example
          call function 'POPUP_TO_INFORM'
               exporting
                    titel = g_repid
                    txt2  = sy-subrc
                    txt1  = 'The control could not be created'(510).
        endif.
    * create an instance of alv control
        create object grid1
             exporting i_parent = custom_container.
    * Set a titlebar for the grid control
        gs_layout-grid_title = 'Flights'(100).
        call method grid1->set_table_for_first_display
             exporting i_structure_name = 'SFLIGHT'
                       is_layout        = gs_layout
             changing  it_outtab        = gt_sflight.
    * ->Create Object to receive events and link them to handler methods.
    * When the ALV Control raises the event for the specified instance
    * the corresponding method is automatically called.
        create object event_receiver.
        set handler event_receiver->handle_double_click for grid1.
      endif.                               "IF custom_container IS INITIAL
      call method cl_gui_control=>set_focus exporting control = grid1.
    * Control Framework flushes at the end of PBO automatically!
    endmodule.                             " PBO_100  OUTPUT
    *&      Module  PAI_100  INPUT
    *       text
    module pai_100 input.
      save_ok = ok_code.
      case save_ok.
        when 'BACK'.
          perform exit_program.
        when 'EXIT'.
          perform exit_program.
      endcase.
      clear save_ok.
    endmodule.                             " PAI_100  INPUT
    *&      Form  SELECT_TABLE_SFLIGHT
    *       text
    *      <--P_GT_SFLIGHT  text
    form select_table_sflight changing p_gt_sflight like gt_sflight[].
      select * from sflight into table p_gt_sflight up to g_max rows.
    endform.                               " SELECT_TABLE_SFLIGHT
    *&      Form  SELECT_TABLE_SBOOK
    *       text
    *      -->P_LS_SFLIGHT  text
    *      <--P_GT_SBOOK  text
    form select_table_sbook using    p_ls_sflight like line of gt_sflight
                            changing p_gt_sbook like gt_sbook[].
      select * from  sbook into table p_gt_sbook
             where  carrid  = p_ls_sflight-carrid
             and    connid  = p_ls_sflight-connid
             and    fldate  = p_ls_sflight-fldate.
    endform.                               " SELECT_TABLE_SBOOK
    *&      Form  create_detail_list
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form create_detail_list.
    * create dialogbox container as dynpro-instance
    * When the user switches to another screen, it is
    * destroyed by lifetime mangagement of CFW
          create object dialogbox_container
              exporting
                top = 150
                left = 150
                lifetime = cntl_lifetime_dynpro
                caption = 'Bookings'(200)
                width = 800
                height = 200.
          create object grid2
              exporting i_parent = dialogbox_container.
    * Register ABAP OO event 'CLOSE'. It is not necessary to register this
    * event at the frontend (this is done during creation).
          set handler event_receiver->handle_close for dialogbox_container.
    * display data
          gs_layout-grid_title = space.
          call method grid2->set_table_for_first_display
               exporting i_structure_name = 'SBOOK'
                         is_layout        = gs_layout
               changing  it_outtab        = gt_sbook.
          call method cl_gui_control=>set_focus exporting control = grid2.
    endform.
    Regards,
    Nandha

  • Single click in ALV Grid display

    Hi All,
    I need to trigger an event at the instant when a whole row is selected in ALV.
    Not any HOTSPOT.
    Is there any SY-UCOMM when a single row will be selected in ALV?
    Thanks in advance,
    Tabraiz

    Hi,
    In the below function module:
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
       I_INTERFACE_CHECK                 = ' '
       I_BYPASSING_BUFFER                = ' '
       I_BUFFER_ACTIVE                   = ' '
          i_callback_program                = sy-repid
          i_callback_pf_status_set          = 'PF_STATUS'
          i_callback_user_command           = 'COMM'      -->this statement is used to catch the user command actions , i.e a subroutine will be created of this name  
       i_callback_top_of_page            = 'TOP'
       I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
       I_CALLBACK_HTML_END_OF_LIST       = ' '
       I_STRUCTURE_NAME                  =
       I_BACKGROUND_ID                   = ' '
          i_grid_title                      = it_grid_title
       I_GRID_SETTINGS                   =
          is_layout                         = it_layout
          it_fieldcat                       = it_field
       it_excluding                      = itab_exclude
       IT_SPECIAL_GROUPS                 =
          it_sort                           = itab_sort
       IT_FILTER                         =
       IS_SEL_HIDE                       =
       I_DEFAULT                         = ''
        I_SAVE                            = 'A'
        IS_VARIANT                        = SVARIANT
          it_events                         = itab_events
    -->The subroutine created is like:
    FORM comm USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
      DATA: okcode TYPE sy-ucomm.
      okcode = ucomm.
      CASE okcode.
        WHEN 'REF'.
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel         = 'MANSI'
            txt1          = 'CREATED BY'
            txt2          = SY-UNAME
          TXT3          = ' '
          TXT4          = ' '
    endcase.
    Hope it helps you
    Regrds
    Mansi

Maybe you are looking for

  • Music On Console Tray Icon

    MocIcon http://mocicon.archuser.com Today, I wrote a program called MocIcon *music on console icon* which is a gtk app written in C that gives you access to basic moc functions in the tray. Inspired by Moc-tray, I wrote this app primarily because I h

  • Tuning row lock contention wait events

    Hello everyone, Working on 10g/windows Top 5 events EVENT TOTAL_WAITS TIME_WAITED AVG_MS PERCENT CPU 9462339 48 enq: TX - row lock contention 12531 3660728 2921.34 18 control file parallel write 1300731 3088079 23.74 16 log file parallel write 151050

  • How can I extract a piece of video from a DVD ?

    Dear all, I recorded a DVD of a TV broadcast. I'd like to get an extract from it and use it in a presentation later (such as powerpoint). How can I extract the piece of video ? Is is possible to record it with quicktime (for example) or any other app

  • ORA-39095: Dump file space has been exhausted

    Hello Friends, DB Version : 10.2.0.4 OS : SUN Solaris 10 We have a server with 10 RAC databases running on it. From 1st node we have a scheduled export job for all the databases. All the databases are using a common script and we are passing paramete

  • What ink cartrige do I use for the HP deskjet 1000 J10a ch340c

    what ink cartrige is used for HP deskjet 1000 J10a model  ch340c