Single click on tree control navigation

Hello I have a tree control where I have include the navigation, I know that there is a method
HANDLE_NODE_DOUBLE_CLICK FOR G_TREE
but is there an method for only one click, I want to change my alv grid data when I click on several nodes in my tree control

Hello Muhammet
I have re-written my sample report ZUS_SDN_TWO_ALV_GRIDS into ZUS_SDN_TREE_AND_GRID_CONTROL which is now display a tree control together with the ALV grid.
When you analyze this new report you will see that every step of the program logic is as I described in my previous e-mails.
*& Report  ZUS_SDN_TWO_ALV_GRIDS
*& Screen '0100' contains no elements.
*& ok_code -> assigned to GD_OKCODE
*& Flow logic:
*  PROCESS BEFORE OUTPUT.
*    MODULE STATUS_0100.
*  PROCESS AFTER INPUT.
*    MODULE USER_COMMAND_0100.
*& Thread: single click on tree control navigation
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1143770"></a>
REPORT  zus_sdn_tree_and_grid_control.
TYPE-POOLS: abap, cntl.
TYPES: node_table_type LIKE STANDARD TABLE OF mtreesnode
         WITH DEFAULT KEY.
* CAUTION: MTREESNODE is the name of the node structure which must
* be defined by the programmer. DO NOT USE MTREESNODE!
CONSTANTS:
  BEGIN OF c_nodekey,
    root   TYPE tv_nodekey VALUE 'Root',                    "#EC NOTEXT
    child1 TYPE tv_nodekey VALUE 'Child1',                  "#EC NOTEXT
*    child2 type tv_nodekey value 'Child2',                  "#EC NOTEXT
    new1   TYPE tv_nodekey VALUE 'New1',                    "#EC NOTEXT
    new2   TYPE tv_nodekey VALUE 'New2',                    "#EC NOTEXT
*    new3   type tv_nodekey value 'New3',                    "#EC NOTEXT
*    new4   type tv_nodekey value 'New4',                    "#EC NOTEXT
  END OF c_nodekey.
DATA:
  gd_okcode        TYPE ui_func,
  gd_repid         TYPE syst-repid,
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_splitter      TYPE REF TO cl_gui_splitter_container,
  go_cell_left     TYPE REF TO cl_gui_container,
  go_cell_right    TYPE REF TO cl_gui_container,
  go_tree          TYPE REF TO cl_gui_simple_tree,
  go_grid1         TYPE REF TO cl_gui_alv_grid,
**  go_grid2         TYPE REF TO cl_gui_alv_grid,
  gs_layout        TYPE lvc_s_layo.
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
*       CLASS LCL_APPLICATION DEFINITION
CLASS lcl_application DEFINITION.
  PUBLIC SECTION.
    CLASS-DATA:
      md_event       TYPE string     READ-ONLY,
      md_node_key    TYPE tv_nodekey READ-ONLY.
    CLASS-METHODS:
      handle_node_double_click
        FOR EVENT node_double_click
        OF cl_gui_simple_tree
        IMPORTING node_key,
      handle_expand_no_children
        FOR EVENT expand_no_children
        OF cl_gui_simple_tree
        IMPORTING node_key.
ENDCLASS.                    "LCL_APPLICATION DEFINITION
*       CLASS LCL_APPLICATION IMPLEMENTATION
CLASS lcl_application IMPLEMENTATION.
  METHOD  handle_node_double_click.
    " this method handles the node double click event of the tree
    " control instance
    " show the key of the double clicked node in a dynpro field
    md_event = 'NODE_DOUBLE_CLICK'.
    md_node_key = node_key.
    " Trigger PAI and set ok-code = 'DETAIL'
    CALL METHOD cl_gui_cfw=>set_new_ok_code
      EXPORTING
        new_code = 'DETAIL'
*      IMPORTING
*        rc       =
    MESSAGE md_node_key TYPE 'I'.
  ENDMETHOD.                    "HANDLE_NODE_DOUBLE_CLICK
  METHOD handle_expand_no_children.
    " this method handles the expand no children event of the tree
    " control instance
    DATA: node_table TYPE node_table_type,
          node TYPE mtreesnode.
    " show the key of the double clicked node in a dynpro field
    md_event = 'EXPAND_NO_CHILDREN'.
    md_node_key = node_key.
    IF node_key = 'Child1'.
* add two nodes to the tree control (the children of 'Child1')
* Node with key 'New1'
      CLEAR node.
      node-node_key = c_nodekey-new1.
      node-relatkey = c_nodekey-child1.
      node-relatship = cl_gui_simple_tree=>relat_last_child.
      node-isfolder = ' '.
      node-text = 'New1'(ne1).
      APPEND node TO node_table.
* Node with key 'New2'
      CLEAR node.
      node-node_key = c_nodekey-new2.
      node-relatkey = c_nodekey-child1.
      node-relatship = cl_gui_simple_tree=>relat_last_child.
      node-n_image = '@10@'.
      node-expander = ' '.
      node-text = 'New2'(ne2).
      APPEND node TO node_table.
      CALL METHOD go_tree->add_nodes
        EXPORTING
          table_structure_name           = 'MTREESNODE'
          node_table                     = node_table
        EXCEPTIONS
          failed                         = 1
          error_in_node_table            = 2
          dp_error                       = 3
          table_structure_name_not_found = 4
          OTHERS                         = 5.
      IF sy-subrc <> 0.
**        MESSAGE A000.
      ENDIF.
    ENDIF.
  ENDMETHOD.                    "HANDLE_EXPAND_NO_CHILDREN
ENDCLASS.                    "LCL_APPLICATION IMPLEMENTATION
START-OF-SELECTION.
  SELECT        * FROM  knb1 INTO TABLE gt_knb1 UP TO 100 ROWS
         WHERE  bukrs  = '1000'.
  PERFORM init_controls.
* Display data
  gs_layout-grid_title = 'Customers: Sales Areas'.
  CALL METHOD go_grid1->set_table_for_first_display
    EXPORTING
      i_structure_name = 'KNVV'
      is_layout        = gs_layout
    CHANGING
      it_outtab        = gt_knvv
    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
  gd_repid = syst-repid.
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = gd_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_grid1->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.
  TRANSLATE gd_okcode TO UPPER CASE.
  CASE gd_okcode.
    WHEN 'BACK' OR
         'END'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.
*   User has pushed button "Display Details"
    WHEN 'DETAIL'.
      MESSAGE gd_okcode TYPE 'I'.
      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.
  IF ( gt_knvv IS INITIAL ).
    SELECT        * FROM  knvv INTO TABLE gt_knvv
    FOR ALL ENTRIES IN gt_knb1
       WHERE  kunnr  = gt_knb1-kunnr.
  ELSE.
    REFRESH: gt_knvv.
  ENDIF.
ENDFORM.                    " ENTRY_SHOW_DETAILS
*&      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 splitter container
  CREATE OBJECT go_splitter
    EXPORTING
      parent            = go_docking
      rows              = 1
      columns           = 2
*      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_left.
  CALL METHOD go_splitter->get_container
    EXPORTING
      row       = 1
      column    = 2
    RECEIVING
      container = go_cell_right.
* Create ALV grids
  CREATE OBJECT go_grid1
    EXPORTING
      i_parent = go_cell_right
    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.
  PERFORM create_and_init_tree.
ENDFORM.                    " INIT_CONTROLS
*&      Form  CREATE_AND_INIT_TREE
*       text
*  -->  p1        text
*  <--  p2        text
FORM create_and_init_tree .
  DATA: lt_node_table TYPE node_table_type,
        lt_events TYPE cntl_simple_events,
        ls_event TYPE cntl_simple_event.
* create a tree control
  CREATE OBJECT go_tree
    EXPORTING
      parent                      = go_cell_left
      node_selection_mode         = cl_gui_simple_tree=>node_sel_mode_single      " single node selection is used
    EXCEPTIONS
      lifetime_error              = 1
      cntl_system_error           = 2
      create_error                = 3
      failed                      = 4
      illegal_node_selection_mode = 5.
  IF sy-subrc <> 0.
**    MESSAGE a000.
  ENDIF.
* define the events which will be passed to the backend
  " node double click
  ls_event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
**  ls_event-appl_event = 'X'. " process PAI if event occurs
  " NOTE: Do NOT register as application event !!!!!
  APPEND ls_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 a000.
  ENDIF.
  SET HANDLER:
    lcl_application=>handle_node_double_click   FOR go_tree,
    lcl_application=>handle_expand_no_children  FOR go_tree.
* add some nodes to the tree control
* NOTE: the tree control does not store data at the backend. If an
* application wants to access tree data later, it must store the
* tree data itself.
  PERFORM build_node_table USING lt_node_table.
* node_table_structure_name     = 'MTREESNODE'
*   A programmer using the tree control must create a structure in the
*   dictionary. This structure must include the structure TREEV_NODE
*   and must contain a character field with the name 'TEXT'.
  CALL METHOD go_tree->add_nodes
    EXPORTING
      table_structure_name           = 'MTREESNODE'
      node_table                     = lt_node_table
    EXCEPTIONS
      failed                         = 1
      error_in_node_table            = 2
      dp_error                       = 3
      table_structure_name_not_found = 4
      OTHERS                         = 5.
  IF sy-subrc <> 0.
**    MESSAGE a000.
  ENDIF.
ENDFORM.                    " CREATE_AND_INIT_TREE
*&      Form  build_node_table
*       text
*  -->  p1        text
*  <--  p2        text
FORM build_node_table
  USING
    node_table TYPE node_table_type.
  DATA: node LIKE mtreesnode.
* Build the node table.
* Caution: The nodes are inserted into the tree according to the order
* in which they occur in the table. In consequence, a node must not
* occur in the node table before its parent node.
* Node with key 'Root'
  node-node_key = c_nodekey-root.
  " Key of the node
  CLEAR node-relatkey.      " Special case: A root node has no parent
  CLEAR node-relatship.     " node.
  node-hidden = ' '.        " The node is visible,
  node-disabled = ' '.      " selectable,
  node-isfolder = 'X'.      " a folder.
  CLEAR node-n_image.       " Folder-/ Leaf-Symbol in state "closed":
  " use default.
  CLEAR node-exp_image.     " Folder-/ Leaf-Symbol in state "open":
  " use default
  CLEAR node-expander.      " see below.
  node-text = 'Root'(roo).
  APPEND node TO node_table.
* Node with key 'Child1'
  node-node_key = c_nodekey-child1.
  " Key of the node
  " Node is inserted as child of the node with key 'Root'.
  node-relatkey = c_nodekey-root.
  node-relatship = cl_gui_simple_tree=>relat_last_child.
  node-hidden = ' '.
  node-disabled = ' '.
  node-isfolder = 'X'.
  CLEAR node-n_image.
  CLEAR node-exp_image.
  node-expander = 'X'. " The node is marked with a '+', although
  " it has no children. When the user clicks on the
  " + to open the node, the event
  " expand_no_children is fired. The programmer can
  " add the children of the
  " node within the event handler of the
  " expand_no_children event
  " (see method handle_expand_no_children
  " of class lcl_application)
  node-text = 'Child1'(ch1).
  node-style = cl_gui_simple_tree=>style_emphasized_positive.
  APPEND node TO node_table.
ENDFORM.                    " build_node_table
Regards
  Uwe

Similar Messages

  • OK CODE FOR SINGLE CLICK IN DYNPRO

    HEY GUYS,
    CAN YOU PLEASE TELL ME WHATS THE OKCODE FOR SINGLE CLICK.
    IF I MAKE SINGLE CLICK IN TABLE CONTROL COLUMN HEADER ITS NOT GOING TO PAI FLOW LOGIC.
    PLEASE SUGGEST ME ..HOW TO GO WITH PAI USING SINGLE CLICK ACTION WITH TABLE CONTROL COLUMN HEADER.
    IS THERE ANY FUNCTION CODE I HAVE MAKE TO ON READY TO STATUS AT TABLE CONTROL COLUMNS.
    THANKS IN ADVANCE.
    AMBICHAN

    Hi Chan,
    Instead of Single click better u can handle trying Double click...  Then PAI will definitely be triggered..
    Regards,
    Sridhar

  • 30EA1 /2.*: Double-clicking objects in the navigator tree

    Hi,
    There is an inconsistency in double-clicking objects in the navigator tree:
    When Preferences - Database - ObjectViewer - Open Objects on Single Click is checked, double-clicking e.g. a table in the navigator will still open it the same way as single-clicking it.
    However, when Preferences - Database - ObjectViewer - Open Objects on Single Click is not checked, double-clicking the table in the navigator will open it, and expand the columns. The latter is quite irritating, especially on large tables.
    Can this be bugged, so double-clicking the table in the navigator will just open it?
    Thanks,
    K.

    The node is expanded on double click irrespective of what the preferenceIs this a typo or does it really expand always for you? For me it only expands with "single click objects" disabled.
    windows explorer also does the sameYes, and I'd even say that's the desired behaviour, especially since it's the only action taken.
    Common sense and standards are against taking 2 different actions at the same time. One should override the other.
    Ideally, double click with "single click objects" disabled would just open the object, and double click with "single click objects" enabled could expand the node as in the Windows Explorer (but doesn't have to).
    So that's almost completely the other way around as we get it now.
    Thanks,
    K.

  • 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

  • How to Flex tree control using folder click event  to pass coldfusion to get data from dynamiclly ?

    Hi friends.........
                Iam using flex tree control data coming from coldfusion file to display grid. As i click the tree folder to change the data from dynamic from grid.
    How to pass the folder id from coldfusion file.. Is it possible ?.. Means give any example please....
    Any One Help Me......
    With Regards.,
    Lingu.......

    When you set the dataProvider for your tree control, you actually pass an array or arraycollection or whatever to that property. The array contains objects coming from your server, right? Each object should contain a property with the folder id, something like:
    var arr:Array = [{id: 1, folderID: 34, name: "..."}, {id: 2, folderID: 4, name: "..."}, ...];
    Now, when you click an item in your tree or your dataGrid, you can access the folder id by:
    myTree.selectedItem.folderID
    Hope this helps
    Dany

  • 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

  • Implementing tree control in third level navigation

    Hello
    1. Is it possible to Implement a tree control inside third level navigation ?
    2. How can I make selecting one of the nodes change the display in another iview on the same page ?
    (How do they pass data to one another)
    3. Is it possible to select several nodes at once ?
    P.S
    Is there a how to guid out there ?
    Thanks
    Ziv.

    Hi,
    I undestand you want to hide/show tree nodes on demand.
    in the standard DTN (detailed navigation) it isn't possible.
    There are two options -
    1. As suggested you can modify the DTN provided by SAP - all the code is under com.sap.portal.navigation.detailedtree.par and the iView name is also com.sap.portal.detailedNavigationTree
    2. create this tree from scratch, and put it on the left side instead of the DTN or as a dynamic navigation iView.
    For creating navigation iViews by yourself, you can start from here:
    http://help.sap.com/saphelp_nw70/helpdata/EN/43/0174a642406db7e10000000a422035/frameset.htm
    Regards,
    Tal.
    Edited by: Tal Haviv on Aug 15, 2008 12:55 PM

  • 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

  • Tree Control Double Click Functionality

    Hi All,
    I'm trying to get a tree control to operate a case structure, and I cannot seem to get the Double Click invoke node to output my tags from the tree.   Anyone know what I may be doing wrong?!
    Thanks,
    Derek
    Solved!
    Go to Solution.
    Attachments:
    TreeControl.vi ‏9 KB

    Identical functionality as an event loop shown for an additional example
    Jeff
    Attachments:
    TreeControl[1] rev 1.vi ‏9 KB

  • Change the selection of tree control with a right click

    How is it possible to change the item selected in a tree control (LabVIEW7) with a mouse right click ?

    Filippo,
    Here is a popup menu toolkit, with an additional example for a listbox. If I
    understand your problem, it shouldn't be hard to change it to a tree
    control.
    Regards,
    Wiebe.
    "Filippo" wrote in message
    news:[email protected]..
    > Sorry for my english ! If you can send me an example, it could be very
    > useful for me.
    > My e-mail is : [email protected]
    > Thanks.
    > Regards,
    >
    > Filippo
    [Attachment Menu 042004.zip, see below]
    Attachments:
    Menu_042004.zip ‏175 KB

  • Tree control double click default behavior

    Hi all,
    Tree control have default behavior that expand/ collapse item when double click event occurs on parent item.
    How do I to avoid this behavior to use custom double click event without open close nodes?
    Thanks,
    regards
    Solved!
    Go to Solution.

    Hi,
    I was not able to disable the default event however I realized a VI that could be useful for you.
    I've used a method to force all the tree items to be collapsed.
    Take a look at the attached image.
    Regards,
    Alex
    Attachments:
    treecontrol.png ‏15 KB

  • Single click folder name to expand folder in folder view?

    As with prior versions, in [Windows] Explorer's main window, you can enable hovering to select and single clicking to expand the folder (but that is a pain in the rear when working with files). Windows XP folder view nicely allowed single clicking the folder name to expand the folder. Was that removed from Windows 7? Looks like the only way to expand a folder in folder view is to either click on the small plus sign or to double click on the folder name.  Or is there a switch somewhere I am missing? Thanks.

    "...Things are worse than that now... When you single click on a folder name in the folder list, the folder contents show in the right hand file window, as usual. But, when you use an arrow key to move to a folder name in the folder list, the folder
    contents no longer show in the right hand file window...."
    The option  seems to be disabled. It is in Explorer>tools>folder options>navigation pane>"automatically expand to current folder" (win7 v6.1
    Excluding this extremely useful feature really cripples Win7Explorer. I was spoiled by w9x and XP explorers. I am new to MS forums. Is there a moderated microsoft forum where this question can be posted, in the hope that a patch is produced?
    I asked this in 2007 and I was answered <<WE DON'T GIVE A SH*T OF WHAT YOU WANT>>
    See here:
    http://connect.microsoft.com/WindowsServerFeedback/feedback/details/313066/explorer-should-expand-folder-tree-the-windows-xp-way

  • Problem while working wwith tree control

    hi all
    i am working with tree control the prolems i have been facing are
    i am not able o get the event for a single click on the tree node .
    i am displaying the purchase order in the tree and once i select on sinlge click a purchase order ,now i want to create the sales order on the another screen and once i click on the button it should call another screen on which i have to create the sales order ,
    please help

    hi gandhivarun,
    i am posting the code which will give idea on Tree display.
    REPORT  ZALVGRID_PG.
    TABLES: SSCRFIELDS.
    DATA: V_BELNR TYPE RBKP-BELNR.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: IRNO FOR V_BELNR.
    PARAMETERS: P_GJAHR TYPE RBKP-GJAHR.
    SELECTION-SCREEN END OF BLOCK B1.
    DATA: WA TYPE ZALVGRID_DISPLAY,
          ITAB TYPE STANDARD TABLE OF ZALVGRID_DISPLAY.
    DATA: IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: L_IDENTITY TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: L_TREE TYPE REF TO CL_GUI_ALV_TREE_SIMPLE.
    TYPE-POOLS: SLIS,SDYDO.
    DATA: L_LOGO TYPE SDYDO_VALUE,
          L_LIST TYPE SLIS_T_LISTHEADER.
    END-OF-SELECTION.
    CLASS CL_LC DEFINITION.
      PUBLIC SECTION.
        METHODS: DC FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN.
    ENDCLASS.
    CLASS CL_LC IMPLEMENTATION.
      METHOD DC.
        DATA: WA1 TYPE ZALVGRID_DISPLAY.
        READ TABLE ITAB INTO WA1 INDEX E_ROW-INDEX.
        BREAK-POINT.
        SET PARAMETER ID 'BLN' FIELD WA1-BELNR.
        CALL TRANSACTION 'FB02'.
      ENDMETHOD.                    "DC
    ENDCLASS.
    DATA: OBJ_CL TYPE REF TO CL_LC.
    START-OF-SELECTION.
      PERFORM SELECT_DATA.
      IF SY-SUBRC = 0.
        CALL SCREEN 100.
      ELSE.
        MESSAGE E000(0) WITH 'DATA NOT FOUND'.
      ENDIF.
      INCLUDE ZALVGRID_PG_STATUS_0100O01.
      INCLUDE ZALVGRID_PG_LOGOSUBF01.
      INCLUDE ZALVGRID_PG_SELECT_DATAF01.
    INCLUDE ZALVGRID_PG_USER_COMMAND_01I01.
    ***INCLUDE ZALVGRID_PG_STATUS_0100O01 .
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'AB'.
    *  SET TITLEBAR 'xxx'.
      IF IDENTITY IS INITIAL.
        CREATE OBJECT IDENTITY
        EXPORTING
          CONTAINER_NAME = 'ALVCONTROL'.
        CREATE OBJECT GRID
        EXPORTING
          I_PARENT = IDENTITY.
        CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
             I_STRUCTURE_NAME              = 'ZALVGRID_DISPLAY'
          CHANGING
            IT_OUTTAB                     = ITAB.
        CREATE OBJECT OBJ_CL.
        SET HANDLER OBJ_CL->DC FOR GRID.
        ENDIF.
        IF L_IDENTITY IS INITIAL.
          CREATE OBJECT L_IDENTITY
          EXPORTING
            CONTAINER_NAME = 'LOGO'
          CREATE OBJECT L_TREE
          EXPORTING
            I_PARENT = L_IDENTITY.
          PERFORM LOGOSUB USING L_LOGO.
          CALL METHOD L_TREE->CREATE_REPORT_HEADER
            EXPORTING
              IT_LIST_COMMENTARY    = L_LIST
              I_LOGO                = L_LOGO.
         ENDIF    .
    ENDMODULE.                 " STATUS_0100  OUTPUT
    ***INCLUDE ZALVGRID_PG_LOGOSUBF01 .
    FORM LOGOSUB  USING    P_L_LOGO.
      P_L_LOGO = 'ERPLOGO'.
    ENDFORM.                    " LOGOSUB
    ***INCLUDE ZALVGRID_PG_SELECT_DATAF01 .
    FORM SELECT_DATA .
      SELECT RBKP~BELNR
             RBKP~BLDAT
             RSEG~BUZEI
             RSEG~MATNR
             INTO TABLE ITAB
             FROM RBKP INNER JOIN RSEG
        ON RBKP~BELNR = RSEG~BELNR
        WHERE RBKP~BELNR IN IRNO
        AND RBKP~GJAHR = P_GJAHR.
    ENDFORM.                    " SELECT_DATA
    ***INCLUDE ZALVGRID_PG_USER_COMMAND_01I01 .
      CASE SY-UCOMM.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
           EXIT.
           ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Warm Ragrds,
    PavanKumar.G
    Edited by: pavankumar.g on Jan 30, 2012 11:02 AM

  • In XP single-click mode, hovering overwrites filenames in select downl loc

    My grandmother has arthritis, there's no way she can use double click mode. She gets pictures in the mail and she wants to save them to relevant folders. when she enters a subfolder with a bunch of other pictures, in just 1 second of not moving the mouse, the file name in the select download location window is overwritten because hovering for one second is treated like a single click. Is there any way around this problem?

    "...Things are worse than that now... When you single click on a folder name in the folder list, the folder contents show in the right hand file window, as usual. But, when you use an arrow key to move to a folder name in the folder list, the folder
    contents no longer show in the right hand file window...."
    The option  seems to be disabled. It is in Explorer>tools>folder options>navigation pane>"automatically expand to current folder" (win7 v6.1
    Excluding this extremely useful feature really cripples Win7Explorer. I was spoiled by w9x and XP explorers. I am new to MS forums. Is there a moderated microsoft forum where this question can be posted, in the hope that a patch is produced?
    I asked this in 2007 and I was answered <<WE DON'T GIVE A SH*T OF WHAT YOU WANT>>
    See here:
    http://connect.microsoft.com/WindowsServerFeedback/feedback/details/313066/explorer-should-expand-folder-tree-the-windows-xp-way

  • Selection on single-click with custom TreeCellEditor

    Hi,
    In a JTree with a custom treecell editor (contains checkbox, label with icon) that overrides abstractcelleditor, selection of nodes does not highlight the selection on a single click. The selection is highlighted on a double click. clicking on the checkbox works fine. any ideas? the treecellrenderer works fine. So if i remove the custom editor and only have the renderer (for checkbox, label and icon) selections are highlighted properly.
    Thanks!

    Ok, came up with a solution - it makes keyboard navigation and mouse-based multiple selection work. Here's the fixed code:
    creating the tree :
    JTree tree = new JTree( root  );
    tree.setUI( new MyTreeUI() );
    tree.setCellRenderer( new OverlayTreeCellRenderer() );
    tree.setCellEditor( new OverlayTreeCellRenderer() );
    tree.setEditable(true);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    tree.setInvokesStopCellEditing( true );
    scrollPane.setViewportView( tree );
    add( scrollPane );the renderer / editor:
      protected static class OverlayTreeCellRenderer extends JPanel implements TreeCellRenderer, TreeCellEditor
        protected Color selBdrColor = UIManager.getColor( "Tree.selectionBorderColor" );
        protected Color selFG = UIManager.getColor( "Tree.selectionForeground" );
        protected Color selBG = UIManager.getColor( "Tree.selectionBackground" );
        protected Color txtFG = UIManager.getColor( "Tree.textForeground" );
        protected Color txtBG = UIManager.getColor( "Tree.textBackground" );
        protected JCheckBox visibleCheckBox = new JCheckBox();
        protected JLabel overlayName = new JLabel();
        protected JCheckBox showLabelCheckBox = new JCheckBox();
        protected LinkedList<CellEditorListener> listeners = new LinkedList<CellEditorListener>();
        protected final ActionListener checkBoxListener = new ActionListener() {
          public void actionPerformed ( ActionEvent ae )
            if ( stopCellEditing() )
              fireEditingStopped();
        protected final MouseListener labelListener = new MouseAdapter() {       
          public void mouseReleased ( MouseEvent e )
            if ( stopCellEditing() )
              fireEditingStopped();
         * Constructor.
        public OverlayTreeCellRenderer ()
          setLayout( new BoxLayout( this, BoxLayout.LINE_AXIS ) );
          visibleCheckBox.setOpaque( false );
          showLabelCheckBox.setOpaque( false );
          add( visibleCheckBox );
          add( overlayName );
          add( showLabelCheckBox );
          setBackground( txtBG );
          setForeground( txtFG );     
          visibleCheckBox.addActionListener( checkBoxListener );
          showLabelCheckBox.addActionListener( checkBoxListener );
          overlayName.addMouseListener( labelListener );
         * Returns the renderer
        public Component getTreeCellRendererComponent ( JTree tree, Object value,
            boolean selected, boolean expanded, boolean leaf, int row,
            boolean hasFocus )
          DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;           
          OverlayDescriptor data = (OverlayDescriptor) node.getUserObject();
          overlayName.setText( data.overlayName );
          visibleCheckBox.setSelected( data.visible );
          showLabelCheckBox.setSelected( data.label );   
          if ( selected )
            setBackground( selBG );
            setForeground( selFG );
          else
            setBackground( txtBG );
            setForeground( txtFG );
          return this;
        // ------------------------------------------------- Cell Editor
        // Returns the editor
        public Component getTreeCellEditorComponent ( JTree tree, Object value,
            boolean isSelected, boolean expanded, boolean leaf, int row )
          return getTreeCellRendererComponent( tree, value, true, expanded, leaf, row, true );
        // Implement the CellEditor methods.
        public void cancelCellEditing ()
        // Stop editing only if the user entered a valid value.
        public boolean stopCellEditing ()
          requestFocusInWindow();
          return true;
        // This method is called when editing is completed.
        // It must return the new value to be stored in the cell.
        public Object getCellEditorValue ()
          return new OverlayDescriptor( overlayName.getText(), showLabelCheckBox.isSelected(), visibleCheckBox.isSelected() );
        // Start editing when the mouse button is clicked.
        public boolean isCellEditable ( EventObject eo )
          return true;
        public boolean shouldSelectCell ( EventObject eo )
          return true;
        // Add support for listeners.
        public void addCellEditorListener ( CellEditorListener cel )
          listeners.add( cel );
        public void removeCellEditorListener ( CellEditorListener cel )
          listeners.remove( cel );
        protected void fireEditingStopped ()
          if ( listeners.size() > 0 )
            ChangeEvent ce = new ChangeEvent( this );
            for ( CellEditorListener l : listeners )
              l.editingStopped( ce );
      }subclass of BasicTreeUI:
       * Fix multiple-selection handling in BasicTreeUI which doesn't appear to work
       * when the tree has a custom editor.
      protected static class MyTreeUI extends BasicTreeUI {   
        protected boolean startEditing ( TreePath path, MouseEvent event )
           * BasicTreeUI startEditing(..) method doesn't handle multiple selection
           * well. This circumvents that for when Ctrl or Shift is held down by
           * first saving the current selection, and then restoring it after calling
           * super.startEditing(..).
          ArrayList<TreePath> selectedPaths = null;
          if ( tree.getSelectionCount() > 0 && event.isControlDown() )
            selectedPaths = new ArrayList<TreePath>( tree.getSelectionCount() + 1 );
            for ( TreePath p : tree.getSelectionPaths() )
              selectedPaths.add( p );
            if ( !tree.isPathSelected( path ) )
              selectedPaths.add( path );
            else
              selectedPaths.remove( path );
          else if ( tree.getSelectionCount() > 0 && event.isShiftDown() )
            int endRow = tree.getRowForPath( path );
            int startRow = tree.getAnchorSelectionPath() == null ? endRow : tree
                .getRowForPath( tree.getAnchorSelectionPath() );
            if ( startRow > endRow )
              int temp = endRow;
              endRow = startRow;
              startRow = temp;
            selectedPaths = new ArrayList<TreePath>( endRow - startRow + 1 );
            for ( int row = startRow; row <= endRow; row++ )
              selectedPaths.add( tree.getPathForRow( row ) );
          boolean val = super.startEditing( path, event );
          if ( selectedPaths != null )
            tree.setSelectionPaths( selectedPaths.toArray( new TreePath[0] ) );
          return val;
      };

Maybe you are looking for

  • I want to install XP Pro SP2 on a Mac Mini from a 2003 RIS server.

    I want to install XP Pro SP2 on a Mac Mini from a 2003 RIS server. Is this possiIble? How is it done? The mac has 10.5 which has bootcamp to enable Windows install. I have created a partition but the bootcamp utility asks for a CD. I want to install

  • I'm very pleased

    Forums like this tend to be filled mostly with issues and complaints, so I thought I'd try inject a positive vibe here.... Though I did have a couple hurdles to overcome with my new iPod Touch, it is working very well for me, and I have very few comp

  • Some get there $200 back, some don't

    From what I've read if you bought your iPhone from the Apple online store, you can get a $200 credit or refund. However, if you bought your phone through AT&T, you're pretty much screwed. And that really adds an extra layer of insult to this injury.

  • Embedding Chinese Characters and File Size

    Hello, Recently my company commissioned a Flash based eLearning module from a vendor. The module was in English. We then contracted a version in Chinese. When we got the files back we noticed a dramatic increase in the file size of the relevant resou

  • Upgrade many CS4 flas to CS5 XFLs using JSFL ?

    Hello, This is my first post on these forums, even though I read many of them in the past. I work as a Flash developper for a e-learning company. I'm using Adobe Flash Professional CS5 on a MacBook Pro with Mac OS X 10.5.8 (Leopard). I've been happil