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

Default sorting in cl_gui_alv_tre

Hi there,

I have an application where I use cl_gui_alv_tree. The user can group the entries of the tree by selecting a button and deciding upon the field he wants to use. The function module LVC_SORT is used to do this. My questions is: can such a sorting value be saved, so that the user does not have to call the grouping functionality again when restarting the transaction (default sorting)? The layout seems to only save the displayed fields.

Thank you,


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Sep 29, 2005 at 05:06 AM


    See this code

    * Create emty tree-control
      CLEAR: it_emptytab.
      REFRESH: it_emptytab.
      CALL METHOD gd_tree->set_table_for_first_display
                   is_hierarchy_header  = gd_hierarchy_header
                   it_list_commentary   = gd_report_title
                   i_logo               = gd_logo
    *               i_background_id      = 'ALV_BACKGROUND'
    <b>               i_save               = 'A'</b>
    *               is_variant            = ls_variant
                   it_outtab            =  it_emptytab      "Must be empty
                   it_fieldcatalog      =  gd_fieldcat.

    Check this lik for reference

    Hope this helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2005 at 05:08 AM


    If you are sure that the same kind of sorting has to be done each time you run the transaction why don't you opt for sorting it programatically.

    Please reward points if this explanation useful.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Siva,

      I want to give the customer the possibility to decide which field he wants to use and to save this option. So the next time he does not have to select this again. As the selected field can differ from customer to customer, setting a standard field for it is not possible.

      Thanks anyway,


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.