ABAP WD: Fully expand a Tree

Hi all,
I'm having a very hard time achieving the following:
I would like to FULLY EXPAND a WD tree in code.
Allthough it sounds easy i dont get it to work.
What have i tried allready:
- the 'Expanded' property of the treenode at designtime.
- if_wd_context_node->SET_LEAD_SELECTION
- if_wd_context_element->set_selected
- fiddled with the 'Initialisation Lead Selection' property
Any suggetsions?
Thanks alot!
Joris Bots

Roberto,
Thanks for the quick help.
I dont have a recursive node, since my tree is allways 2 levels deep, so i have a tree with 1 TreeNodeType and 1 TreeElementType.
What i dont get to work is to get a reference to the (instantiated) nodes at runtime.
all i get is a Table with the nodeTYPES (the metadata of the Tree)
Please have a look at this:
<u>my tree in RUNTIME looks like this</u>
Root
   N1
     item1
     item2
     item3
   N2
     item1
     item2
     item3
   N2
     item1
     item2
     item3
<u>my tree in designtime looks like this</u>
MY_TREE
   NodeType1
   ElementType1
what you are saying is that i need to set the EXPANDED property of <b>N1, N2 and N3</b> at runtime instead of setting the property of <b>NodeType1</b> designtime, right?
I dont know how to get the Ref's to the N1..3 object.
Hope you can help me,
Thanks
Joris Bots

Similar Messages

  • Fully expanded tree using tree model

    Hi every body,
    I have represented into jtree form after reading xml document using the tree model. But I want to displayed
    the fully expanded tree at the screen when program run.
    Please help me.
    Thanks
    Edited by: ahmadgee on Jul 11, 2008 3:42 AM

    Thanks for your help
    For get the the tree in expanded form, I am using the expandAPath funtion by the following way.
    public class XMLTreePanel extends JPanel {
           private JTree tree;
           private XMLTreeModel model;
           public XMLTreePanel() {
                    setLayout(new BorderLayout());
            model = new XMLTreeModel();
         tree = new JTree();
         tree.setModel(model);
         tree.setShowsRootHandles(true);
         tree.setEditable(false);
         expandAPath(tree);
         JScrollPane pane = new JScrollPane(tree);
         pane.setPreferredSize(new Dimension(300,400));
         add(pane, "Center");
         final JTextField text = new JTextField();
                    text.setEditable(false);
         add(text, "South");
         tree.addTreeSelectionListener(new TreeSelectionListener() {
              public void valueChanged(TreeSelectionEvent e) {
              Object lpc = e.getPath().getLastPathComponent();
              if (lpc instanceof XMLTreeNode) {
                   text.setText( ((XMLTreeNode)lpc).getText() );
    public void expandAPath(JTree tree){               
         for(int i=1; i<tree.getRowCount(); ++i) {
              tree.expandRow(i);            
    public void setDocument(Document document) {
         model.setDocument(document);
    public Document getDocument() {
         return model.getDocument();
    }

  • Box model experts, why wouldnt this layout allow for a container div to fully expand?

    Box model experts, why wouldnt this layout allow for a container div to fully expand?
    Please see attached jpg.
    Live site is at http://www.theminnternet.com/

    You have an answer for the height issue, you may also be interested in this article that talks about cutting down on the stylesheet size... you have a lot of styles in your stylesheet that can really be trimmed down by using shorthand rules.
    http://www.communitymx.com/content/article.cfm?cid=A43B828960590F55

  • How do I make my dataGrid fully expand?

    I am trying to make my dataGid fully expand. I mean I don't
    want to see scroll. If it has 5 rows, then its height will be
    exactly fit 5 rows. If it has 10 rows, then its height will be
    exactly fit 10 rows.
    How do I do that?
    Thanks.

    "cpthk" <[email protected]> wrote in message
    news:gnvskp$6ih$[email protected]..
    >I am trying to make my dataGid fully expand. I mean I
    don't want to see
    >scroll.
    > If it has 5 rows, then its height will be exactly fit 5
    rows. If it has 10
    > rows, then its height will be exactly fit 10 rows.
    > How do I do that?
    rowCount?

  • Macking button to expand the tree and collapse tree and another to add node

    macking button to expand the tree and collapse tree and another to add node and saving the changes in the database ( this is problem)
    and finally delete node from database
    so what is proper code for those buttons
    thanks my mail is :
    [email protected]

    Hello,
    Use the ftree package's functions
    code to expand all nodes:
    PROCEDURE explose_tree IS
    node    ftree.node;
    htree   ITEM;
    state   varchar2(30);
    BEGIN
       -- search the tree ID --
       htree := Find_Item('BL_TREE.TREE_1');
        -- search the root --
           node  := Ftree.Find_Tree_Node(htree, '');
        -- expand all nodes --
       WHILE NOT Ftree.ID_NULL(node) LOOP
          state := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_STATE);
          IF state = Ftree.COLLAPSED_NODE THEN
            Ftree.Set_Tree_Node_Property(htree, node, Ftree.NODE_STATE, Ftree.EXPANDED_NODE);
          END IF;
          node := Ftree.Find_Tree_Node(htree, '', ftree.find_NEXT,Ftree.NODE_LABEL,'', node);
       END LOOP;
    END;and to collapse all nodes:
    PROCEDURE Implose_tree IS
       node   ftree.node;
       htree  ITEM;
       state  varchar2(30);
    BEGIN
       -- search the root ID --
       htree := Find_Item('BL_TREE.TREE_1'); 
       -- search the root --
       node  := Ftree.Find_Tree_Node(htree, '');  
       -- Collapse all nodes --
       WHILE NOT ftree.ID_NULL(node) LOOP
         state := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_STATE);
         IF state = Ftree.EXPANDED_NODE THEN
          Ftree.Set_Tree_Node_Property(htree, node, Ftree.NODE_STATE, Ftree.COLLAPSED_NODE);
         END IF;
        node := Ftree.Find_Tree_Node(htree, '', Ftree.FIND_NEXT,Ftree.NODE_LABEL, '', node);
       END LOOP;
    END; Francois

  • Why when I fully expand the screen contents do I lose the red,yellow,and green options at the top left

    why when i fully expand my screen contents do i lose the red, yellow, and green buttons at the top left used to close, expand, and minimize

    That's just the way it is in full screen mode. You need to come out of FS to see the dots again.

  • Expand the tree like I want

    A JTree like this:
    0:model
    0.1:jsp1
    0.2:jsp2
    I want to add jsp1's child node-jspchild1,so the tree will turn into:
    0:model
    0.1:jsp1
    0.1.1:jspchild1
    0.2:jsp2
    But when I finished adding,the jsp1 is collapsed,how can I expand the tree to the level of my new node?Thank you.

    tree.expandPath(new TreePath(((DefaultMutableTreeNode)jspchild1.getParent()).getPath()));Denis

  • Collape/expand in tree display.

    hi experts,
    how to implement expand/collapse function key in tree display.
    thanks in advance.
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Nov 6, 2011 3:47 PM

    Hi Charu,
    Go through below sample.
    Link: [ALV TREE|http://wiki.sdn.sap.com/wiki/display/ABAP/CallFMtogeneratealvtreeanddealwithuseraction].
    Regards,
    Maruthi

  • How to expand a tree at a specific node/item?

    Hi,
    we have a tree and the nodes/items were binded to context with this code
    lo_nd_nvccmp = wd_context->get_child_node( name = wd_this->wdctx_nvccmp ).
    lo_nd_tree = lo_nd_nvccmp->get_child_node( name = wd_this->wdctx_tree ).
    lo_el_tree = lo_nd_tree->bind_structure( new_item = ls_tree set_initial_elements = abap_false ).
    We want that the tree is expanded at a specific node/item?
    The structure has the field is_expanded of type WDY_BOOLEAN. I think that if the field of the right structure is 'X' then the tree should expanded. How can we find the right structure in the context and change this field to 'X'?
    Code is appreciated.
    Thanks, regards
    Susanne

    Oh, apparently if you try that call right after you create
    the Tree, it will throw a null reference exception. That might
    count as a bug in the flex api...
    If you create a Tree, and give it's dataProvider some xml
    data, and then add it to the stage (addChild), and then you call
    expandItem or expandChildrenOf() right after, you will get a null
    object exception. You have to wait... for something. I don't know
    what.
    I even tried calling _tree.invalidateList() before the
    expandItem, but it will still throw the error...
    I wonder what the Tree needs to wait for? Is this a bug for
    Adobe to fix?

  • Expand the tree by default

    Hi,
    I have a tree component  in my Application and I have given the dataprovider as XMLListCollection. I would like to have the entire tree as expanded mode(all children) by default. To achieve this, I tried expandItem() method but I couldn't see the entire tree as expanded when I load my application.
    Any solution will be helpful for me a lot!
    Thanks in Advance,
    Srinivasan S

    A more elegant solution ( in my opinion ) would be to extend the Tree component and implement the desired behavior in a much nicer fashion. It is true that we already have expandChildrenOf(); method that is really great, but if we want to have a nice feature that instantaneously expands or collapses the whole tree more easily ( without having to rewrite the same conditions and who knows what each time we want such a functionality ) then I think that it would be much nicer to extend the Tree component, add the desired feature and start using that custom component instead.
    Here's a fast example ( make sure to place this class into a "components" folder if you want to test it ):
    package components
        import mx.controls.Tree;
        * Custom <code>Tree</code> class with custom behavior.
        public class ExpandableTree extends Tree
            * Flag telling if the tree is expanded or not.
            protected var _isExpanded:Boolean = false;
            * Constructor.
            public function ExpandableTree()
                super();
            * Used to expand or collapse the <code>Tree</code>.
            * @param value Flag telling if we should expand or collapse the <code>Tree</code>.
            protected function expandCollapseTree(value:Boolean):void
                // Return if there's no data to expand or collapse.
                if (this.dataProvider == null)
                    // The flag should be "false" if no expanding has occurred.
                    _isExpanded = false;
                    return;
                // Expand or collapse the children.
                this.expandChildrenOf(this.dataProvider[0], value);
            //  Overridden methods
            * @inheritDoc
            override protected function updateDisplayList(w:Number, h:Number):void
                // Expand or collapse the Tree.
                expandCollapseTree(_isExpanded);
                super.updateDisplayList(w, h);
            //  Setters and getters
            * Set a flag telling if the <code>Tree</code> should be expanded or callapsed.
            public function set expanded(value:Boolean):void
                // Make sure that the passed value is not the current state.
                if (value == _isExpanded) return;
                _isExpanded = value;
                // Invalidate the display list to signal the change.
                this.invalidateDisplayList();
            * Returns the current state of the <code>Tree</code>.
            public function get expanded():Boolean
                return _isExpanded;
    Obviously, you can always extend this "skeleton component" and add even more features. Also, there's another fast example to demonstrate the usage of the component I've just posted above ( it's really simple ):
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
        xmlns:mx                    = "http://www.adobe.com/2006/mxml"
        xmlns:components            = "components.*"
        backgroundColor             = "0xFFFFFF"
        backgroundGradientColors    = "[0xFFFFFF, 0xFFFFFF]"
        layout                      = "vertical">
        <mx:XMLList id="treeData">
            <node label="Mail Box">
                <node label="Inbox">
                    <node label="Marketing"/>
                    <node label="Product Management"/>
                    <node label="Personal"/>
                </node>
                <node label="Outbox">
                    <node label="Professional"/>
                    <node label="Personal"/>
                    <node label="Outbox">
                        <node label="Professional"/>
                        <node label="Personal"/>
                    </node>
                </node>
                <node label="Spam"/>
                <node label="Sent"/>
            </node>   
        </mx:XMLList>
        <components:ExpandableTree
            id              = "cmpExpandableTree"
            width           = "400"
            height          = "300"
            showRoot        = "false"
            expanded        = "true"
            labelField      = "@label"
            dataProvider    = "{treeData}"/>
        <mx:HBox width="400">
            <mx:Button
                label       = "Collapse"
                width       = "100%"
                click       = "cmpExpandableTree.expanded = false;"/>
            <mx:Button
                label       = "Expand"
                width       = "100%"
                click       = "cmpExpandableTree.expanded = true;"/>
        </mx:HBox>
    </mx:Application>
    So, this would be the "neater solution" ( in my opinion ). But simply using expandChildrenOf(); and passing in the item from where you want to rest of the nodes to expand is just as valid.
    With kind regards,
    Barna Biro

  • Web Dynpro ABAP application  - Fully Qualified Domain Names (FQDN) error

    I have created a Web Dynpro ABAP application. On executing it, I get Fully Qualified Domain Names (FQDN) error. I have host name of my server.
    I do not know domain name of my server. How can I detect it?
    I want to know in  Windows XP and Windows 7.
    Please help me asap.

    Hi,
    On your server run command ipconfig /all
    FQDN = Hostname + Primary DNS Suffix
    The make sure the profile parameters SAPLOCALHOSTFULL and icm/host_name_full reflect the same.
    Regards,
    Srikishan

  • WD ABAP:  Need beginner help on TREE UI ELEMENT

    Hi all,
    I'm struggling with the Tree element in Webdynpro (ABAP!).
    Can anyone provide me with a help/tutorial/examplecode on how to correctly bind a tree to context, and how to fill the context
    I have an IT with a field (int) that descibes on what level the item has to go into the Tree.
    i hope i can use this to populate the context
    example IT:
    0 my cars
    1 trucks
    2 red Dodge
    2 blue RangeRover
    1 sportscars
    2 red ferrai
    2 blue porsche

    Tina,
    This is indeed what i needed.
    Thank you!
    point awarded
    Joris Bots
    PS.
    Here a link to the document described by Tina:
    <a href="http://sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/constructing%20a%20recursive%20and%20loadable%20web%20dynpro%20tree.pdf">http://sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/constructing%20a%20recursive%20and%20loadable%20web%20dynpro%20tree.pdf</a>
    Message was edited by: Joris Bots

  • Problem in function module for expand in tree display

    hi all,
    i have found a function module which can expand all nodes of the tree.
    it is TREEV_EXPAND_ROOT_NODES.
    CALL FUNCTION 'TREEV_EXPAND_ROOT_NODES' "Expands all Root Nodes
      EXPORTING
        handle =                    " cntl_handle   Handle for Tree Control
        level_count =               " i             Number of Levels to be Expanded
        expand_all_children =       " c
      no_flush =                  " c
      EXCEPTIONS
        FAILED = 1                  "               General Error
        ILLEGAL_LEVEL_COUNT = 2    . "               LEVEL_COUNT Must Be GE 0
    for above function call what value should i give for "handle parameter".
    thanks.

    Hi,
    Please pass the value as below with minor changes as per your requirement.
    DATA: tree TYPE cntl_handle, 
    DATA: TREE_HANDLE TYPE CNTL_HANDLE.
    data: local_rep like sy-repid,
    local_scr like sy-dynnr.
    constants: dynpro_default       type i value -1.
    data: node_table type node_table_type,
    constants : TREEV_NODE_SEL_MODE_SINGLE TYPE I VALUE 0,
      call function 'TREEV_CREATE_SIMPLE_TREE'
           exporting
                owner_repid                    = local_rep
                dynnr                          = local_scr
                left                           = 0
                top                            = 0
                width                          = 45
                height                         = 22
                no_flush                       = space
                shellstyle                     = style
                parentid                       = dynpro_default
                node_selection_mode            = treev_node_sel_mode_single
                node_table_structure_name      = 'MTREESNODE'
           tables
                node_table                     = node_table
           changing
                handle                         = tree_handle
           exceptions
                create_error                   = 1
                tree_control_not_existing      = 2
                cntl_system_error              = 3
                failed                         = 4
                illegal_node_selection_mode    = 5
                missing_node_structure_name    = 6
                error_in_node_table            = 7
                dp_error                       = 8
                illegal_owner_repid            = 9
                table_structure_name_not_found = 10
                others                         = 11.
      if sy-subrc <> 0.
        message e645 with text-745 sy-subrc.
      endif.
    call function 'TREEV_EXPAND_ROOT_NODES'
           exporting
                handle              = tree_handle
                level_count         = 2
                expand_all_children = 'X'
                no_flush            = ' '
           exceptions
                failed              = 1
                illegal_level_count = 2
                cntl_system_error   = 3
                others              = 4.
      if sy-subrc <> 0.
        message e645 with text-743 sy-subrc.
      endif.
    If it is helpfull means reward me with some points.
    Regards
    Chitra

  • WD ABAP: Recursion Nodes that Repeat Tree Nodes with Embedded Tables ???

    At Rich H's suggestion, I'm posting this here as well as in the blogs.
    Suppose you've got a tree context with a node that has a table embedded under it. (For example, the TREE_WITH_TABLE view of WDR_TEST_EVNT has this kind of context substructure.) Call this node "NODE_WITH_TABLE."
    You now define a recursion node underneath "NODE_WITH_TABLE" and specify "NODE_WITH_TABLE" as the repeated node for this recursion node. Call this recurion node "RECURSION_NODE".
    Lo and behold - the table fills properly when you're on any instance of "NODE_WITH_TABLE", but not when you're on an instance of "RECURSION_NODE".
    I'm hoping that:
    a) I'm doing something wrong;
    OR
    b) There's an easy work-around/alternative I'm not seeing
    OR
    c) SAP will give recursion nodes enough memory to carry any table(s) embedded in the nodes they're repeating.
    'Cause I sure don't want to have to define "n" levels of tree-nodes that have different copies of the same table(s) embedded in them.
    Message was edited by: Armin Reichert

    /people/david.halitsky/blog/2006/08/16/recursion-nodes-that-repeat-tree-nodes-with-embedded-tables-in-wd-abap-not
    Maybe you might want to back out your weblog as it is not really a place to ask these types of questions.  Think of it this way,  if you are allowed to do this type of weblog,  what is stopping any other weblogger.  Hence the weblogs would just be another forum, which I don't think anyone wants. 
    Regards,
    Rich Heilman

  • Expand/Contract Tree Issue

    Hi all,
    I have a tree, which is a collection of all the pages in my application. I am using 2 level tabs as well. I want my tree to expand only that node page which is currently being clicked from the tab i.e when i click the tab in two level tabs, the page with the current node should open and rest all gets collapsed. Pls help.
    With Regards,
    Sunil Bhatia

    Hi all,
    Strange that noone has replied to this forum, anyways can anyone just let me know, is it possible or impossible to do this?
    I just want that when a tab gets clicked, then there should be 2 request set in my code i.e CONTRACT, CONTRACT_ALL and EXPAND, TAB_NAME which will open my tree. These are working fine individually, but when i try to set 2 requests simultaneously, it doesnt renders. Pls do help me.
    Thanks,
    Sunil Bhatia

Maybe you are looking for

  • Customer open item transfer

    Hi gurus, We have business requirement to transfer customer open invoice from exicting normal reconcialation account to new reconlication account. The reason to do so is there are some cutomer who are bankrupt and we want to transer  open item for th

  • [SOLVED] How to restart services compatibly with SysVinit

    I'm collaborating on a Kubuntu user's package of scripts for Thinkpad X220 Tablets.  As part of the installation process of the package, the acpid daemon must be restarted to reload newly installed ACPI hooks.  On Kubuntu, the command to restart acpi

  • How do I stop Firefox from opening a blank page before my selected PDF viewer opens a pdf email attachment?

    When I receive an Outlook PDF attachment and open it, Firefox starts and a blank page opens. After Firefox has opened and the blank page opens, the PDF viewer I am using opens the PDF. I have the options settings set to use Filecenter.exe as the PDF

  • Project Engineer needed - San Rafael, CA

    Cal-Bay Systems, Inc. is a small, rapidly-growing company headquartered in beautiful Marin County, CA. We specialize in PC-based custom automation systems and have a varied customer base that includes medical device, semiconductor and aerospace compa

  • What happened to autotrace statistics in the new release?

    just downloaded the new version praying for less bugs when i select autotrace it doesnt give me the statistics like previous versions did has it just been moved? i need to see my consistent gets thanks