Skip to Content

alv sort option

Hi Folks .

can anyone tell me how can i disable the column sort option ?

i mean that when i point with the cursur on the column header appears a little downside arrow that can sort the column asc or dsc .

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2005 at 06:03 PM

    You can disable standard functions by:

    wa_toolbar_excld1 = cl_gui_alv_grid=>MC_FC_SORT.

    APPEND wa_toolbar_excld1 TO t_toolbar_excld1.

    wa_toolbar_excld1 = cl_gui_alv_grid=>MC_FC_SORT_ASC.

    APPEND wa_toolbar_excld1 TO t_toolbar_excld1.

    wa_toolbar_excld1 = cl_gui_alv_grid=>MC_FC_SORT_DSC.

    APPEND wa_toolbar_excld1 TO t_toolbar_excld1.

    where

    Data:

    t_toolbar_excld1 type ui_functions, "buttons to exclude

    wa_toolbar_excld&1 like line of t_toolbar_excld1.

    Then pass the toolbar exclude table in the ALV call:

    CALL METHOD r_alv_grid1->set_table_for_first_display

    EXPORTING is_variant = w_is_variant1

    is_layout = w_is_layout1

    i_save = c_alv_save_cd

    it_toolbar_excluding = <b>t_toolbar_excld1</b>

    CHANGING it_outtab = my_table

    it_fieldcatalog = t_fieldcat1.

    This will disable sorting on all columns.

    If you only want to disable sorting for specific columns, then a different technique is needed.

    There is an event called BEFORE_USER_COMMAND that executes some of your code before doing the standard ALV code. Your code could detect the sort request, determine the column being requested, and then override the UCOMM field using method set_user_command if you did not want the sort to continue.

    Lot of details missing here and I do not know how a sort request on multiple columns would be handled so some testing would be required.

    Serdar Simseklaer's "An Easy Reference for ALV GRID CONTROL" should also be helpful. Available at http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an easy reference for alv grid control.pdf

    Could anyone tell me how to post links in these messages in a cleaner way? Also, how to post code so the indentation does not get lost?

    Add a comment
    10|10000 characters needed characters exceeded

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.