WebDynpro ABAP tree node collapse trigger event of row selection

Hello expert,
I have a table in my WD abap view, I use MasterColumn to display the tree structure, everything works just fine.
However I encounter one problem:
If I open the tree structure and select one node (table row selection), the event onLeadSelectis triggered, this is correct. However if I collapse any  parent nodes (along the tree path) of the selected node, WD puts the selection on the clicked parent and thus the event onLeadSelect is triggered for the parent. This is a strange behavior, because when I collapse a node, I certainly don't want to trigger the onLeadSelect event for the node, becaseu this would invoke the function linked to the event which is only supposed to be triggered when you explicitly select the table row.  (BTW, if you don't select any child nodes, then collapse the parent, it does NOT trigger the event).
I've looked into the wdevent data to see if I can differentiate between the event of node collapsing and row selecting, event data is exact same for both cases, thus I have no way to stop the event handler in case of node collapsing.
Anyone had this issue and a solution for this?
Thanks
Jayson

Hi Jayson,
Its the behavior of the tree element, the lead selection of child is carried over to the parent.
Whenever there is lead selection set and on toggling of tree node, first OnToggle event triggers and then OnLeadSelect triggers. So you can control the execution of onLeadSelect by using EXPANDED parameter of event OnToggle.
Please refer the below steps:
Create an action ON_TOGGLE for the vent OnToggle of tree element and it will be having parameter EXPANDED
Create an attribute in view-->attributes tab GV_EXPANDED
Collect the parameter EXPANDED into gv_expanded
          wd_this->gv_expanded = expanded.
Now, you can use wd_this->gv_expanded to control the execution of LEADSELECT logic
Hope this helps you.
Regards,
Rama

Similar Messages

  • Tree node collapse is not working

    Hi
    I created tree node, i am able to display data in that node, But collapse is not working.
    i kept this part of code in collapse event, event is triggering, but it is not collapsing.
      DATA: lr_node     TYPE REF TO if_bsp_wd_tree_node,
            lv_size     TYPE sytabix,
            lv_index    TYPE sytabix VALUE 1.
      DATA: lv_event_thtmlb TYPE REF TO cl_thtmlb_tree.
      TRY.
          lv_event_thtmlb ?= htmlb_event_ex.
          typed_context->querynetrs->collapse_node( lv_event_thtmlb->row_key ).
        CATCH cx_root.
      ENDTRY.
    (  or  below part)
      DESCRIBE TABLE me->typed_context->querynetrs->node_tab LINES lv_size.
      WHILE lv_index <= lv_size.
        lr_node = me->typed_context->querynetrs->get_node_by_index( lv_index ).
        IF lr_node IS NOT INITIAL.
          lr_node->collaps_node( ).
        ENDIF.
        lv_index = lv_index + 1.
      ENDWHILE.
    please let me know why collapse is not working.
    thanks
    ram.
    ram

    HI Ram,
    did you try to do a reread afterwards?
    If you look at the component IBHIER view TreeEnhanced it uses a global variable node_modified that is set after the collapse.
    Then afterwards in the DO_PREPARE_OUTPUT this variable is checked and used to reread the entity.
      IF me->node_modified = abap_true AND me->entity IS BOUND.
        me->entity->reread( ).
      ENDIF.
    Maybe also add this part of coding in your method and in the DO_PREPARE_OUTPUT.
    KR,
    Micha

  • Tree node collapses

    I created a JTree, added 4 nodes to it (depth first, as shown below). Expanded all of the nodes. So Root, Level 1, Level 2 nodes are expanded, and Level 3 is a leaf.
    I wrote a logic which basically when a node is deleted, it will attach its child to its parent, in the following case, if Level 1 node is deleted, then Level 2 node is attached to the Root node. so the tree will be (Root -> Level 2 -> Level 3).
    The problem i have is with the expansion state of the child node which gets appended (in this case Level 2). This is lost, so when i attach Level 2 to Root node, Level 2 node collapses (there by not able to see Level 3 node, unless again expanded). EXP:: as i am re using the Level 2 node, i would expect the node to not change its expansion state, i.e node to not collapse.
    Any suggestions. Included is my source code.
    --> Root
    ----> Level 1
    ------> Level 2
    ---------- Level 3
    import java.awt.BorderLayout;
    import javax.swing.*;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.DefaultMutableTreeNode;
    import java.awt.event.*;
    class TreeFrame extends JFrame
    private JTree tree ;
    private DefaultTreeModel model ;
    private JScrollPane jsp;
    private int MAX_DEPTH = 3;
    public TreeFrame ()
    initData();
    initGUI();
    private void initData()
    DefaultMutableTreeNode topNode = new DefaultMutableTreeNode("Root");
    model = new DefaultTreeModel(topNode);
    insertChildNodes(topNode,1);
    private void initGUI()
    this.getContentPane().setLayout(new BorderLayout());
    tree = new JTree(model);
    jsp = new JScrollPane(tree);
    this.getContentPane().add(jsp, BorderLayout.CENTER);
    tree.addKeyListener(new KeyAdapter()
    public void keyReleased(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_DELETE)
    deleteKeyPressed();
    private void deleteKeyPressed()
    System.out.println("Delete Key Pressed");
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)
    tree.getLastSelectedPathComponent();
    if (node == null)
    return;
    if (node.isRoot()||
    node.isLeaf())
    return;
    DefaultMutableTreeNode parent = (DefaultMutableTreeNode)node.getParent();
    DefaultMutableTreeNode child = (DefaultMutableTreeNode)node.getChildAt(0);
    model.insertNodeInto(child, parent, 0);
    model.removeNodeFromParent(node);
    private void insertChildNodes(DefaultMutableTreeNode node, int depth)
    if (depth > MAX_DEPTH)
    return;
    DefaultMutableTreeNode child = new DefaultMutableTreeNode("Level "+depth);
    model.insertNodeInto(child,node,0);
    insertChildNodes(child, depth+1);
    public static void main(String[] args)
    TreeFrame tf = new TreeFrame();
    tf.setSize(200,500);
    tf.setVisible(true);

    Is my question really Un doable or, did I not phrase it correctly, so that it is understandable.

  • ABAP Tree / Node

    hi,
    my requirement is related to HR ABAP,
    theres a feature called PINCH,
    which has following tree/node present...
    PINCH
    |___TCLAS
    |____A Master Date and time
    |___________Position
    now currently the client doesnt have the Position which i have shown in the fig above, they want that to be added into the node,
    my question is if we can add the Position node on the tree, what effect will it have on business.
    and if it handles the HR requirement properly, how do i add such a node in that tree.
    cheers,
    Aditya.

    Hi aditya,
    1. Its not directly possible.
    2. The reason is that the Structure behind this PINCH
       does not have this field.
    3. Even if we try to add the field,
       it would amount to change in sap standard.
    4. Further, there is no guarantee, that there will be any value in this field.
    regards,
    amit m.

  • Contextual Event on row selection in the table

    Hi,
    My taskflow has just a view activity which queries a view object and displays results as a table. This taskflow is inserted in the main page as a region. I have set up a selection listener on the table, to map to a method in a managed bean. I have made this method binding a producer of my contextual event. and another method binding on the main page as a consumer. I have mapped producer and the consumer on a event map on the main page.
    My problem is when a row is selected in the table, I see the method (in the selection listener) is called but the event is not fired and the consumer method is not called. I don't know, if it is because the producer method (selection listener) takes SelectionEvent as a parameter?.
    I added just to test, a button on my view activity and mapped the action listener to another method(with out parameters) on the same managed bean and made this a producer. In this situation the event got fired and the consumer method got called.
    Why is the selection listener method not firing the event?
    Thanks in advance.

    Hi,
    the two events that are supported for ADF Faces component events are ActionEvent and ValueChangeEvent. So if you have a selection event, you need to take this infromation and create an ActionEvent from it.
    http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/event/ActionEvent.html
    Frank

  • Handling event for Tree Control Collapse

    Hi,
    Can any one suggest how to handle an event for 'Tree Node Collapse' . I have checked with all the exised tree events.
    thanks,
    Venu

    Hi Venugopal,
        If you are doing tree control programmin then i can suggest you a approach for tree node collapse and expand.
    for doing this follow these steps.
    1. create a toolbar (use class cl_gui_toolbar), add a button and assign a FCODE to it.
    2. here you register the following the event for the toolbar.
    gs_event-eventid = cl_gui_toolbar=>m_id_function_selected.
    3. here you set the handler for the toolbar events
      SET HANDLER  gref_application->handle_function_selected
                FOR  gref_toolbar.
    4. now in your class for gref_application you write a definition and implementation.
    definition
    handle_function_selected FOR EVENT handle_function_selected OF cl_gui_toolbar IMPORTING fcode.
    implementation
    CASE fcode.
       when 'collapse'.
          CALL METHOD xref_tree->collapse_all_nodes.
    this method might change depending upon the class you use for creating the tree.
    i hope this will help you.
    in case of clarification do get back to me.
    regards,
    Kinshuk Saxena
    PS mark helpful answers

  • Organizational Structure Search Help in Webdynpro ABAP

    Hi,
    I need an organizational structure search help in webdynpro abap.
    It should list the organizational structure in tree view like RH_OBJID_REQUEST lists.
    I tried to use RH_OBJID_REQUEST function in webdynpro but I got " A RAISE statement in the program
    "CL_GUI_CUSTOM_CONTAINER=======CP" raised theexception condition "CNTL_ERROR" short dump.
    Is there such a function for webdynpro abap and  how can I achive this with select options?
    Thanks in advance..
    MERAL

    Great article.  I also had this probelm a year ago. My problems questions are:
    Is it possible to select more then one entry in the tree?
    What about selecting all childrens with one click?
    In my solution I inserted this tree, into a table and the table had a checkbox, row, so the user can check the required org units, (more then one) and there was a separate button, for "select all children"

  • RowRepeater UIElement in Webdynpro ABAP

    Hello,
    I want to create a RowRepeater UI Elements in Webdynpro ABAP and fill a certain number of rows at runtime. I looked at the standard component wdr_test_events -> Row_Repeater View in which there is a node in the context bound to the 'datasource' property of the RowRepeater Element and the node is filled using the supply function which has the following code.:
    data l type if_row_repeater=>element_row_repeater_data.
      data t type if_row_repeater=>elements_row_repeater_data.
      data i type string.
      define st.
        concatenate `[ Row` i `: Element &1 ]` into l-&1.
      end-of-definition.
      l-first_line_visible = abap_true.
      do 55 times.
        i = sy-index.
        condense i.
        l-element_1 = 'ICON_STATUS_OK'.
        st element_2_tv1.
        st element_2_tv2.
        st element_2_tv3.
        st element_2_tv4.
        st element_2_in1.
        st element_3_tv1.
        st element_3_tv2.
        st element_3_tv3.
        concatenate `RowDescription for row ` i into l-row_description.
        insert l into table t.
        l-first_line_visible = abap_false.
      enddo.
      node->bind_table( t ).
    It's very hard to understand what this code is doing exactly  like the statement:
    concatenate `[ Row` i `: Element &1 ]` into l-&1.
    like what is the meaning of l-&1?
    Any help would be highly appreciated.
    Thanks.

    data l type if_row_repeater=>element_row_repeater_data.
    this statement declares a structure of type if_row_repeater=>element_row_repeater_data
    data t type if_row_repeater=>elements_row_repeater_data.
    this creates a tbale of the same type as above.
    define st.
    concatenate ` Row` i `: Element &1 ` into l-&1.
    end-of-definition.
    this is a macro definition in abap
    it is using &1 to pass the parameters when you call this macro
    using st <paramvalue>  this passed paramvalue will replace the placeholder &1 in the macro.
    e.g. when you call it using
    st element_2_tv1.
    the macro will replace this statement like
    concatenate ` Row` i `: Element element_2_tv1 ` into l-element_2_tv1.
    thanks
    sarbjeet singh

  • WHEN-TREE-NODE-SELECTED

    Hello alllll
    i have a master-detail block besides a tree block
    All i wanna do Simply and logically is to select a tree node then a Master-Detail records related to this tree node is to be retrieved...
    _i have the following code in the WHEN-TREE-NODE-SELECTED Trigger as follow:_
    DECLARE
      htree ITEM;
       node_value VARCHAR2(100);
    BEGIN
    IF :SYSTEM.TRIGGER_NODE_SELECTED = 'TRUE' THEN
    -- Find the tree itself.
    htree := FIND_ITEM ('BL_TREE.IT_TREE');
    -- Find the value of the node clicked on.
    NODE_VALUE := FTREE.GET_TREE_NODE_PROPERTY( htree, :SYSTEM.TRIGGER_NODE ,  Ftree.NODE_LABEL );
       GO_BLOCK ('STP_COMPANIES');  
    EXECUTE_QUERY;
        END IF;
    END;The above code retrieved data as a whole
    but i want 2 filter the data selected from the tree node as i said 2 be displayed as filtered by the tree selection.
    so i used the following code as follow:
    GO_BLOCK ('GL_COST_CENTERS');  
       set_block_property('GL_COST_CENTERS', DEFAULT_WHERE, 'COMPANY_ID ='||
       ftree.get_tree_node_property('BL_TREE.IT_TREE', :SYSTEM.TRIGGER_NODE, FTREE.NODE_VALUE));
    EXECUTE_QUERY;Any help will be appreciated...
    Thanks in Advance..
    Regards,
    Abdetu...

    Hello thanks for reply,
    STP_COMPANIES your detail block? no it's the master
    gets the "Label" of the tree node not the value of the selected nodei tried both but nothing retrieved...!
    i thought that the value is the serial of the node and the lable is the text displayed on the tree node no ?
    Is this code in the same When-Tree-Node-Selected trigger or a different trigger?yes WHEN-TREE-NODE-SELECTED as my post titled...
    is GL_COST_CENTERS the master block? no it's the detail ; every company --- has many <- cost centers
    are the tables related? yes
    just query the master table and the detail table will automatically be filter through the relationship?i did and it works filtering through the company_id, But what i wanna do is 2 filter the data displayed in the two block Master-Detail according 2 the selection of the tree
    Say i selected the ....
                               + Assets node
                               |
                               |------ - Furnitures    's node is selected so alll the related details of the furniture is displayed in the Master-BLock
                               |         |
                               |         +----chairs
                               |         |
                               |         +----tables
                               |        
                               +----- LAnds
                               |So the Tree is used 2 Query or retrieved the selected node's data accordingly...
    hope i well explained my issue ..!
    is it possible 2 do that ?!
    Thanks Again..
    Regards,
    Abdetu...

  • Tree Node - Open new FORM

    Dear all.
    How can i open new FORM, when i double click at (tree) node.
    Best Regards
    node
    |__node1
    |__node11 <-- double click and open new FORM
    |__node12
    |__node2
    |__node21
    Message was edited by:
    First_Step

    Whe-tree-node-activated trigger
    declare
         pl_id paramlist;
         value1 varchar2(100) ;
    begin
    -- Checks whether the trigger node is a leaf not or not if yes
    -- Call the Corresponding form else do nothing
    if (Ftree.Get_Tree_Node_Property('tree_block.tree1', :SYSTEM.TRIGGER_NODE, Ftree.NODE_STATE)= 0) THEN
    --CREATE PARAM LIST FOR CALL_FORM     
         pl_id:=get_parameter_list('userparam');
    if(id_null(pl_id)) then
         pl_id:=create_parameter_list('userparam');
    else
    destroy_parameter_list(pl_id);
         pl_id:=create_parameter_list('userparam');
    end if;
    --ADD NEEDED PARAMETERS
    add_parameter(pl_id,'user_name',text_parameter,:parameter.user_name);
    --HERE NODE VALUE IS FORM NAME
    value1:=Ftree.get_tree_node_property('tree_block.tree1',     :system.trigger_node,ftree.node_value);
    call_form(value1,hide,no_replace,no_query_only,pl_id);
    END IF;
    end;
    jeneesh

  • Call forms and reports through a hierarchical tree node.

    Hello,
    I am new in pl/sql programming and I have some dificulties. I have created a hierarchical tree, in order to use it as a menu in an application that I am trying to develope. The problem is that I do not know how can I make the last nodes to be either a form or a report and when somebody double clicks on these nodes the form or the report will run. What is more, should I use the when-tree-node-selected trigger or the when-tree-node-activated? I use forms 6i.
    Thank you in advance,
    Vag
    Message was edited by:
    user537672

    Thank you very much for your reply. I tried what you said and managed to create a when-tree-node-activated trigger that works fine. The only problem is that I do not know how to find the last 3 characters of every node in order to make the form understand if it is a form or a report. I mean that the name of each node maybe of different length so I do not know how exactly to use the substr().
    Thank you
    Vag

  • Deleting Tree Node

    Hello All
    I am Creating a Tree and It is going to Populate only when the Node is Expanded.
    I.E. the Child records are created only when the Node is Expanded.
    What we Did is that when we are creating a Parent Node, we are populating a dummy child node to the Parent Node, so that the + sign will be shown.
    Now when I am Expanding the + sign, it has to delete the Dummy child node and then create the Child nodes under the Dummy one.
    For this One I am unable to Find a solution.
    PLEASE HELP ME REGARDING THIS ONE.
    THIS PROBLEM IS RELATING TO FORMS

    In the when-tree-node-expanded trigger.
    Store the system.trigger_node. This is the parent.
    Search, starting with the parent, for a child which has the value/label that you gave the dummy node. Did you find one? If yes then delete it.
    If you didn't find one then you stop as you've already expanded this node I guess.
    After you delete the child you must then add the new children. So loop through the code that produces the list of new children you want, and add them under the parent that you started with.
    Hope this helps.

  • Call a form by click a tree node

    Hi,
    How can I created tree and i wanna call form when tree node selected
    Thank you
    MNH

    Hi ,
    Use the "WHEN-TREE-NODE-ACTIVATED" Trigger , and you can retrive the selected node using :
    - FTREE.GET_TREE_SELECTION.
    - FTREE.GET_TREE_NODE_PROPERTY.
    Regards,

  • Best way for binding tables from webdynpro Abap with FlashIsland

    Hi,
    We've found several ways to access ArrayCollection columns in a Flex application embedded in an Abap Webdynpro.
    The SAP System is SAP Netweaver 7.01 SP7 and the flex application is compiled with SDK 3.0.
    1/ Syntax like MyArrayCollection[n][Column1]. In this case, the GACProperty's name of the GACDataSource must be "Column1" and it is case sensitive
    2/ Syntax like MyArrayCollection[n].COLUMN1 where COLUMN1 is the attribute's name in the webdynpro Abap context node. In this case, the GACProperty's name seems to not be important, and the column's names of the ArrayCollection must be upper case.
    Do you know which is the best way to do the binding and why?

    Check the Explan Plans for indexes, join orders
    and also check the link
    http://forums.oracle.com/forums/thread.jspa?messageID=2222015&#2222015
    Regards
    Singh

  • What is the difference between WHEN-TREE-NODE-ACTIVATED and

    Hello
    Pls tell me, what is the difference between:
    WHEN-TREE-NODE-ACTIVATED Trigger and
    WHEN-TREE-NODE-SELECTED Trigger
    Best Regards,
    Abdetu..

    in the WHEN-TREE-NODE-SELECTED trigger:
    When selecting
    IF :SYSTEM.TRIGGER_NODE_SELECTED = 'TRUE' THEN
      :GLOBAL.VARIABLE := <a value>;
      :PARAMETER.PARAM1 := <a value>;
      GO_BLOCK('BLOCK_B');
      EXECUTE_QUERY;
    END IF;
    When deselecting
    IF :SYSTEM.TRIGGER_NODE_SELECTED = 'FALSE' THEN
      ERASE('GLOBAL.VARIABLE');
      :PARAMETER.PARAM1 := NULL;
      GO_BLOCK('BLOCK_B');
      CLEAR_BLOCK(NO_VALIDATE);
    END IF;Of course this is a simple example.
    Tony

Maybe you are looking for