Web Dynpro Tree expanding

Hi there!
I am using the tree element in web dynpro.
Not the tree in the table.
I need to expand a part of the tree during loading
I do not find an example.
Any help is warmly appreciated.
Thanks in advance, Frank

Hi,
the "dynamic" tree expansion depends on who you populate the tree content e.g. how you load the data to your tree.
In my application, I have choosen to load the root nodes, first - all over sub-nodes (including items) are loaded "on demand" that means the user clicks on the node. This click will trigger the the action onLoadChildren which pulls the data from a data provider and binds the retrieved data to the corresponding
context node.
This expansion can be perfomed automatically by a recursive method which is called when a user pushes a button called "Expand all"....
I don't have much time to explain the details, but I will provided the source code..., hope it helps!
Darko
Source Code -
Import to the Method:
i_node_ref type IF_WD_CONTEXT_NODE = Reference to the context node
METHOD nav_tree_expand_all.
Data declaration
  DATA node_elements TYPE wdr_context_element_set.
  DATA node_element  LIKE LINE OF node_elements.
  DATA child_node    TYPE REF TO if_wd_context_node.
  DATA ls_tree_attr  TYPE zlm_str_tree_gen.
  DATA lt_tree       TYPE zlm_tty_tree_gen.
Get all node elements
  node_elements = i_node_ref->get_elements( ).
Loop over each element
  LOOP AT node_elements INTO node_element.
    " Get Static attributes
    node_element->get_static_attributes( IMPORTING static_attributes = ls_tree_attr ).
    " Check if data has already been loaded
    IF ls_tree_attr-children_loaded = abap_true.
      " now we know that the data has been loaded, only the elements have to be declared as expanded
      ls_tree_attr-is_expanded = abap_true.
      node_element->set_static_attributes( EXPORTING static_attributes = ls_tree_attr ).
      " get possible other nodes recursively
      child_node = node_element->get_child_node( 'SUBTREE' ).
      me->nav_tree_expand_all( EXPORTING i_node_ref      = child_node
                                         i_screen_id     = i_screen_id
                                         i_component_id  = i_component_id ).
    ELSE.
      " data has not been loaded yet...
      " First load the nodes...
     clear lt_tree.
      me->get_nav_tree_nodes( .....importing lt_tree.). Custom specific data retrieval
      IF lt_tree IS NOT INITIAL.
        child_node = node_element->get_child_node( 'SUBTREE' ).
        child_node->bind_table( lt_tree ).
        " Update Attributes of the node
        ls_tree_attr-is_expanded     = abap_true.
        ls_tree_attr-children_loaded = abap_true.
        node_element->set_static_attributes( EXPORTING static_attributes = ls_tree_attr ).
        " Call the method again recursively...
        me->nav_tree_expand_all( EXPORTING i_node_ref      = child_node
                                           i_screen_id     = i_screen_id
                                           i_component_id  = i_component_id ).
      ENDIF.
      " ... then load the items
      CLEAR lt_tree.
      me->get_nav_tree_items( .....importing lt_tree.).  Custom specific data retrieval
      IF lt_tree IS NOT INITIAL.
        " Update Attributes of the node
        ls_tree_attr-is_expanded     = abap_true.
        ls_tree_attr-children_loaded = abap_true.
        node_element->set_static_attributes( EXPORTING static_attributes = ls_tree_attr ).
        child_node = node_element->get_child_node( 'ITEM' ).
        child_node->bind_table( lt_tree ).
      ENDIF.
    ENDIF.
  ENDLOOP.
  RETURN.
Edited by: Darko Mocelj on May 7, 2008 8:57 PM

Similar Messages

  • Problems with tutorial: "Creating a Web Dynpro Tree"

    Hi!
    I'm a rookie and therefore I'm practicing on compleating some tutorials like "Creating a Web Dynpro Tree" (https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0ec6622-8da5-2a10-349b-868b6a553efa)
    I did just as the tutorial told me to (I think) but still I get a java.lang.NullPointerException when I deploy and run my application.
    In the bold line is where it is something wrong:
    public static void wdDoModifyView(IPrivateTreeView wdThis, IPrivateTreeView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
           if (firstTime) {
                IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TreeNodeType");
                /* parameter mapping from parameter "path" to
    parameter "selectedElement"
                treeNode._mappingOfOnAction()._addSourceMapping("path", "selectedElement");
                /* parameter mapping from parameter "path" to
    parameter "element".
                treeNode._mappingOfOnLoadChildren()._addSourceMapping("path","element");
        //@@end
    What I don't understand is what the function/meaning of the parameter path is. The parameters selectedElement and element I do recognize and have written. And I don't understand why there is a difference between the two underscored line of code (see above) even though the comments claim that it does the same kind of mapping.
    Best regards
    /Johan

    I tried to get "addSourceMapping()." underscored so people would better understand what I was referring to but it didn't work and that's why it looked weired.
    Thanks for your help Armin, now it works fine.
    It was as you said.
    if (firstTime) {
    IWDTreeNodeType treeNode = (IWDTreeNodeType) view.getElement("TreeNodeType");
    When I changed "TreeNodeType" to it's real ID, "TheNode" I didn't get a nullPointerException. I think it must be wrong in the tutorial because I followed the instructions which said to name it "TheNode" but then the author mus have forgot to change it from the default ID ("TreeNodeType").
    Best Regards!
    /Johan

  • Web Dynpro, Tree

    Hi all,
    I implemented a recursive tree using the UI Element Tree. My customer wants to see this tree expanded up to the second level on the start of the view.
    Is there a possibility to manage it (expand 2 levels of the tree) in my ABAP program or somehow else?
    Kind regards,
    Oleksandr

    Hi,
    Refer this online help: http://help.sap.com/saphelp_nw70ehp1/helpdata/en/21/ad884118aa1709e10000000a155106/content.htm
    Also refer this standard component: WDR_TEST_EVENTS. Look for the tree views.
    I hope it helps.
    Regards
    Arjun

  • Web Dynpro Tree in the Component Controller

    Hi!!!
    I made a tree in the view. But to separating the view and the model I would like to create the tree in the component controller. Therefor I copy the code from the view to the controller and adapt them, but it doesn`t work. I get the first node and that`s it. I can`t add children, although I called the responsible method.
    Some ideas????
    Greets
    Roman

    Check your mapping between view & controller (actually, view controller & custom / interface / component controller) -- it seems that you have mapped only top-level node but not children.
    VS

  • Web Dynpro Tree with Hyperlink

    Hello experts,
    i´ve got a WebDynpro Abap application which conaints a tree - UI Element. This tree is filed with WD-Component names and by clicking a tree element the named WD-Component is loaded. Now i need a tree-node which sends the user to an external url, for example www.google.de
    Does anybody know if this is possible?

    Hi Benjamin,
    Here you can use the concept of exit plugs. Refer this online help: http://help.sap.com/saphelp_nw70/helpdata/EN/45/1bc575ba064574e10000000a114a6b/frameset.htm
    I hope it helps.
    Regards
    Arjun

  • Error testing Web Dynpro Callable Object (GP Interface)

    With reference to thread:
    Interactive form as  Callable object error on testing the object.
    FYI, I'm running NW04s, EP 7.0 SPS 13, JDK 1.4.2_14, Unix OS
    Hi All,
    I have created a Web Dynpro App with a Adobe Form as the frontend. I have included the caf/eu/gp/api as a DC and implemented the IGPWebDynproCO interface. Next I created a Web Dynpro Callable object in GP and ran a test and received the following error:
    Result: Technical Exception
    Details: Could not create web dynpro callable object component
    Output Parameters
    Callable object implementation did not return  output parameters
    Can anyone help me resolve this? Do I have to make a manual entry in the HOST file? If so, what is that entry? Are there alternatives?
    Thanks
    Kunal.

    Hi,
    For creating WD callable object you need to add following three DC in your WD DC project.
    In the Web Dynpro Explorer of the Web Dynpro Perspective, expand the node DC MetaData -> DC Definition, and select Used DCs.
    a.      To create a DC dependency, open the context menu and choose Add Used DC.
      b.      Select Local Development  -> SAP-EU  -> caf/eu/gp/api/wd  -> DC MetaData  -> Public Parts  -> GPWebDynproCO. For Dependency Type, select Build Time, Design Time, and Run Time. Choose weak from the dropdown list.
      c.      Repeat the previous step to define a dependency to DCs SAP-EU-> caf/eu/gp/api (public part external) and SAP-JEE -> com.sap.security.api.sda (public part default).
    You need to do one more thing like bellow.
    Select your Web Dynpro project and open its context menu. Choose Properties.
    1. Choose Web Dynpro References -> Library References.
    2.  Add a reference for library caf/eu/gp/api.
    I think this will help you.
    Thanks
    Chandan

  • Standard Web Dynpro copy

    I have just copied a standard Web Dynpro Abap, just changing the name for ZFITV_FPM_START.
    I've noticed some things have not been copied. For example, the web dynpro applications.
    So I've created a Web Dynpro Application for ZFITV_FPM_START, and called it ZFITE_EXPENSES, and copied the data in FITE_EXPENSES.
    It doesn't appear in the Web Dynpro tree, even after saving it and activating the Web Dynpro. What can the problem be?
    Thank you in advance.

    I had somehow created it in the original Web Dynpro. Thanks and sorry.

  • BW Hierarachies in Web Dynpro either using BI java SDK or Not

    Hello,
    I am working on a requirement to develop a web dynpro Tree for a BW Hierarchy. On This requirement I have following Questions.
    1. How can I retrieve Nodes/Hierarchies from BW Hierarchy into the query? Is it Query , Cube or RFC?.
    2. What is the standard way to retrieve the Hierarchy onto Web Dynpro?.
    I appreciate if somebody can help on this problem.
    Thanks,
    Raj Peddisetty.

    Raj,
    we used the following delivered function modules to read, add and delete the nodes:
    --ZRSBB_NODES_READ_WITH_FILTER
    --BX_FAVOS_ADD_OTHERS
    --BX_FAVOS_DELETE_NODE
    We created some wrapper function modules to call these above delivered fm's.
    Hope this helps.
    --MLS

  • Tree Hierarchy in Web Dynpro

    Hello All,
    I want to create a web dynpro application that implements some functionlity that I saw in the SAP backend system. In the backend, I have a transaction that allows me to drill down into nodes and add and remove them with a right click context menu. This is like a tree structure with the ability to add, remove and modify node elements. I want to present this to the front end user using web dynpro and possible in a nice table format. How can I go about doing this? Any suggestions?
    Thanks
    Marshall.

    Ok, I try to explain with a simple example.
    Say, your context has the following structure:
    WebDynproClass (node, cardinality=0:n)
    - expanded (boolean)
    - name (string)
    - SubClasses (recursive node -> Class)
    Then, you can build the following tree:
    UIElement (root)
    + AbstractCaption (e_1)
       + AbstractButton (e_1_1)
          + Button (e_1_1_1)
    + RadioButton (e_2)
    with code like
    /* helper method, put inside //@@begin others...//@@end section */
    private IWebDynproClassElement addSubClass(String name, IWebDynproClassElement parent)
      IWebDynproClassElement child = (parent == null)
        ? wdContext.nodeWebDynproClass().createAndAddWebDynproClassElement()
        : parent.nodeSubClasses().createAndAddWebDynproClassElement();
      child.setExpanded(true);
      child.setName(name);
      return child;
    /* builds initial tree, call from wdDoInit() */
    private void init()
      IWebDynproClassElement root = addSubClass("UIElement", null);
      IWebDynproClassElement e_1 = addSubClass("AbstractCaption", root);
      IWebDynproClassElement e_1_1 = addSubClass("AbstractButton", e_1);
      IWebDynproClassElement e_1_1_1 = addSubClass("Button", e_1_1);
      IWebDynproClassElement e_2 = addSubClass("RadioButton", root);
    Now if you want to add "Caption" as subclass of "AbstractCaption" later, you have to find the context element that represents the "AbstractCaption" class and add it as above:
    IWebDynproClassElement parent = find("AbstractCaption");
    addSubClass("Caption", parent);
    If you have to implement the find() method at all depends on your application. Maybe you want to
    - provide a context menu (available since 7.1) on the tree nodes to add child nodes, or
    - provide a static menu at the table cell editor (since 7.0)
    - you provide a toolbar button to add a child node to the currently selected tree node (since 6.40)
    Example for a static menu at a TextView cell editor:
    Table (dataSource = WebDynproClass)
    + TreeByNestingTableColumn (expanded = WebDynproClass.expanded)
       + TextView (text = WebDynproClass.name)
          + Menu
             + MenuItem (id = AddChildItem, onAction = AddChild, nodeElement -> AddChild.parent)
    Action "AddChild" has text "Add Child" and a parameter "parent" of type IWebDynproClassElement. Action handler is
      public void onActionAddChild(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.demo.rec.treetable.comp.wdp.IPrivateMainView.IWebDynproClassElement parent )
        //@@begin onActionAddChild(ServerEvent)
        addSubClass("Child #" + parent.nodeSubClasses().size() + " of " + parent.getName(), parent);
        //@@end
    Then you will get a menu at each tree node with an entry "Add Child" that adds a new child node with some generic text.
    Armin

  • Tree in Web Dynpro Abap

    Hi!
    I can´t insert any fields on the right side of a tree item.
    I have to do like a docking in SAP with a dynpro on the right side and move dinamically the right side if someone click on the tree.
    Can anyone help me?
    Tranks

    Sorry in Web dynpro Java!
    And if it´s not possible. How can I Communicate two Iviews?
    how can I pass parameters from an Iview to another?
    Thanks!

  • Recursive Tree  using Web Dynpro java

    Hi
    I've been trying to create a recursive tree using java in Web Dynpro.
    Can you please suggest a good example to try with?

    Hi,
    Check the below links....
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/integration%20of%20a%20tree%20structure%20in%20a%20web%20dynpro%20table.pdf
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/constructing%20a%20recursive%20and%20loadable%20web%20dynpro%20tree.pdf
    http://help.sap.com/saphelp_nw70/helpdata/en/13/4cde139306304480e89d815ffcf891/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/af/44ea406c9d3d43e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/21/ad884118aa1709e10000000a155106/frameset.htm
    Code Example,
    http://help.sap.com/saphelp_nw70/helpdata/en/16/1ec1814e566f4baf943c53ccf48552/frameset.htm
    null

  • Integration of a Tree Structure in a Web Dynpro Table

    Hi,
    I am implementing an Integration of a Tree Structure in a Web Dynpro Table.
    The Tree-Table os working as required, but I can not work with the OnLeadSelect Action of the table.
    The Action does not work as required, meanning, it returns all the time the first row and not the "lead select".
    As far as I read I should add some code to the wdDoModifyView method, but I did not figure out exactly what...
    Thanks in advance,
    Aviad

    check this URL:
    /people/valery.silaev/blog/2005/06/20/master-of-columns-part-ii

  • Formatting tree UI element in web dynpro

    Hi,
    I am new to web dynpro java.
    I want to format tree in web dynpro java.I mean i want to add spaces between the nodes of a tree or can i get something like hgutter functionality between the nodes.
    Regards,
    ujjwal kumar

    Hi
    No
    Only thing u can do is set Is Design to Emphasized (Bold) and add any images into Node and item both.
    depends on image size u will get some space between text of tree.
    (Applicable with CE 7.1 onwards not in 7.0)
    Tree  [help|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/de59f7c2-0401-0010-f08d-8659cef543ce]
    Best Regards
    Satish Kumar
    Edited by: satish jhariya on Mar 18, 2009 4:49 PM

  • Problem of refreshing a tree in web dynpro java

    hi all,
    I'm facing a problem for refreshing a tree in web dynpro java for SAP HR.
    I created a viewset with 2 cells( 1 view for each).
    In the 1st view I created a droplistbyindex to select the unit ID and in the 2nd view ( defaut=false)  I called a method to populate my tree according to my selection in the 1st view ( method called in wdInit).
    When I make the first selection everything is ok.
    But when I select another unit ID, the tree is not changed and I know the context is well changed according to my selection.
    So I think the method is executed only the first the view is called.
    In this case, how can I refresh my tree on real-time?
    Thanks for your help
    Yimin

    May be u can write the code wdDoModify instead.
    -Ashutosh

  • Expanding Web DynPro ALV Hierarchy

    Good day experts,
    Is it possible to default the hierarchy display on a web dynpro ALV to EXPANDED?
    Regards,
    Johan Kriek.

    Hi,
    Check out this link -
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/3e/904b2624534e0db707c7314a5e1e9d/frameset.htm
    Use this method of the CL_SALV_WD_CONFIG_TABLE IF_SALV_WD_TABLE_HIERARCHYSET_EXPANDED to show them in expanded mode.
    Regards,
    Lekha.

Maybe you are looking for

  • Black screen instead of login window

    Hello. I have a problem when booting a PowerBook G4 running Mac OS X 10.5.8. I turn it on, see the grey screen, see the Apple logo, see the loading icon, see (for a fraction of second) the blue screen and then....black screen and nothing more. I have

  • /WEB-INF/lib/reports_tld.jar

    /WEB-INF/lib/reports_tld.jar Elaboré una pagina JSP en Jdeveloper utilizando el Reports pero me pide /WEB-INF/lib/reports_tld.jar y no se como crearlo.

  • [FATAL] [INS-30508] Invalid ASM disks.

    Dear Gurus please help for troubleshoot the Invalid asm disk error on solaris Oracle Grid 11.2.0.3.0 Solaris10 with EMC Powerpath Partition -bash-3.2$ ./runInstaller -silent -responseFile /aaa/Oracle11g_SunSPARC_64bit/grid/response/grid_install.rsp S

  • Policy.properties and ORASSO.WWSSO_LS_CONFIGURATION_INFO$ Question

    Using 9.0.4.1.0. Can someone explain to me the relationship between ORASSO.WWSSO_LS_CONFIGURATION_INFO$ and the policy.properties file when it comes to login and signoff pages? From what I've read, 9.0.4.1.0 and greater use the file as opposed to the

  • User exit for WBS User status ?

    Hi All, I want to trigger emails from WBS user status settings. If the WBS user status is 'AA' it should trigger emails to a business unit with a message, if it is set to 'BB' it should trigger e-mail to another business unit with a message. Which us