Application Development and Automation 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: 
Read only

alv sort option

herzelhaimharel_gilor
Participant
0 Likes
1,062

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 .

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 .

4 REPLIES 4
Read only

Former Member
0 Likes
975

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?

Read only

0 Likes
975

ok . maybe i wasn't clear enough

so i'll explian again .

on every column header if you'l bring the mouse pointer to the header you'l get an tiny downside arrow pointer .

with this (mouse) pointer you can set the sort order of the column the you'r pointing on . (try it's work )

my question is how can i disable this tiny downside arrow when moving the cursor above the column header ?

Read only

0 Likes
975

If you mean you can right click on a column heading and select a sort option, then turning off sort via the toolbar mentioned earlier will also remove this from the context menu.

If I still misunderstand, could you please refer to a common example that I can try.

How about SE16 on table TRDIR and describe what you are trying to do? Please do a SETTINGS->USER PARAMETERS and let me know what kind of display you are referring to. Also, what is your system version?

Read only

0 Likes
975

In the Layout, try this:


ls_layout-SGL_CLK_HD = space.

Regards,

Subramanian V.