Skip to Content
avatar image
Former Member

Need to create a third level node in tree view

Hi All,

My requirement is to create a three level value node in tree view. I have create the first level (root node) and second level (first child node). But how to add the third level (child node for first child node).

When i debugged i found that the get_children method of the first child node is not getting called, why is it so since i have not set the value is_leaf in the first child node.

Is there any special place i need to write the coding to append the second child node?

Thanks in advance.

Regards,

Sathiya.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Sep 04, 2013 at 11:13 AM

    Hi,

    Please have a look at this example , it might help your question

    Step 1: Context node for the tree

    First of all you need a context node for the tree, which holds the displayed entities and defines the tree columns. It basically reflects the complete UI state of the tree control in the model.

    In our example this is CASEHISTORY context node, which inherits from CL_BSP_WD_CONTEXT_NODE_TREE:  Its method GET_TABLE_LINE_SAMPLE defines the tree columns available for display:

    Here define a column as NODE_NAME which will be the node column (See screen shot for HTML Code). Of special importance is the REFRESH method of the tree, since it initializes the display:The built-in node factory is used here to create a root node for each BOL entity to be displayed in the tree.

    The BOL entities for tree display come from the tree context node itself.

    Step 2: Context nodes for the top level entries in the tree

    In order to display entries in the tree you need a class which defines its top level and which inherits from the CL_BSP_WD_TREE_NODE_PROXY class. In the CRM workbench this class appears as “Tree Node Proxy” beneath the tree node “CASEHISTORY” under “Tree Structure”.

    Besides the usual Getters and Setters used for display during runtime the context node offers a GET_CHILDREN method called when the user would like to see

    Redefine method GET_NODE_NAME to display the text for the NODE. Redefine method GET_ICON to display the required ICON.

    Step 3 : Basic Tag Tree

    To get the tree rendered the simple tree sample application uses the tag in its html page ( IbaseTree.htm).  For your current development, please use   The content of the tree comes from the CASEHISTORYcontext node with in the Table attribute via binding: table = “//CASEHISTORY/Table”. The node table, which knows about selected, opened and closed nodes, etc. also comes from the tree context node. It is handed over with the “nodeTable” attribute:

    Step 4 : Tree event handling

    When a node is collapsed on the UI for example a “collapse” event (see attribute “onCollapseNode” above) is raised; this is processed in the DO_HANDLE method of the controller:  It delegates the event to the tree context node.

    Collapse or expand tree node Call the COLLAPSE_NODE method of the tree context node when a tree node is collapsed on the UI.

    Eventually call EXPAND_NODE. 

    Since the tree context node is available in your event handlers these methods can be used to collapse or expand nodes programmatically.    

    Regards,

    Sumeet

    Message was edited by: Sumeet Gehlot


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Sathiya,

      Handling of the Column title is same as that of Table view i.e. can be verified in Cofiguaration tab

      Please check the 'nodeTextColumn' attribute of ConfigTree in.htm page, as the column name mentioned there would be displayed at the first.

      Thanks & Regards,

      Dedipya

  • avatar image
    Former Member
    Sep 05, 2013 at 04:25 AM

    Hi Sathiya,

    For getting the 2nd child node you need to write the code in 1st child GET_CHILDREN method and Make sure that you have not made the 1st child as leaf node in the root node proxy get_children method.

    I think the mistake that you did is in the root node proxy class GET_CHILDREN method you wrote the code like this

    lr_child-is_leaf = abap_true.  " This means that this is the last node or leaf node of the tree.

    append lr_child to rt_children.

    As you want 2nd child node you should not make the 1st child as the leaf node.

    Thanks & Regrads,

            DP.

    Add comment
    10|10000 characters needed characters exceeded