Skip to Content
author's profile photo Former Member
Former Member

Changing the order of the nodes using the RS_TREE FMs

Dear developer community,

I'm generating a standard SAP tree structure using the

Function Modules RS_TREE_CREATE, RS_TREE_ADD_NODE and

RS_TREE_LIST_DISPLAY. The result looks good. The only thing that bothers me and prevents me from calling this job finished is that the sorting order on each hierarchy level is exactly top-down, the nodes added at last are displayed first and vice versa. In the FM-parameters as well as in the node-datastructures I don't find anything that seems to offer me to take influence on the sorting order. Anyway: Due to the very special way we collect the information that finally is supposed to be displayed hierarchically, changing the order of the node-generation unfortunetaly is not an option !

Does anybody have experience with this group of FMs who could tell me how this can be achieved ?

Thanks in advance

Andreas

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 04, 2006 at 07:36 AM

    Hi andreas,

    1. what i do is

    2. in the internal table

    SNODETEXT,

    there is a field NAME

    3. In that field, i pass

    a counter (data type i)

    and i keep on increasing the counter,

    every time i add a node to the tree.

    4. thats all.

    regards,

    amit m.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hello,

      in use the CL_COLUMN_TREE_MODEL class to build the column tree, then you can do it this way:

      lt_nodes-node_key = 'XXXXX'

      lt_nodes-relatship = cl_column_tree_model=>relat_last_child.

      ...

      This will insert the node as the last node of the parent node (lt_nodes-relatkey).

      There is a similar parameter "relationship" at the mentioned function model. I don't know exactly, but I can image that it works the same way.

      Best regards,

      Stefan

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.