Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Default sorting in cl_gui_alv_tre

Former Member
0 Kudos

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,

Ferenc

4 REPLIES 4

Former Member
0 Kudos

Hi,

See this code


* Create emty tree-control
  CLEAR: it_emptytab.
  REFRESH: it_emptytab.
  CALL METHOD gd_tree->set_table_for_first_display
     EXPORTING
               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
     CHANGING
               it_outtab            =  it_emptytab      "Must be empty
               it_fieldcatalog      =  gd_fieldcat.

ENDFORM.                    " CREATE_EMPTY_ALVTREE_CONTROL

Check this lik for reference

http://www.sapdevelopment.co.uk/reporting/alv/alvtree.htm

Hope this helps.

0 Kudos

Hi,

Sorry but this seems to save only the displayed fields. the sorting is not saved.

Regards,

Ferenc

Former Member
0 Kudos

Hi,

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.

Regards,

Siva

0 Kudos

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,

Ferenc