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 fixed default sorting

Former Member
0 Likes
481

Hi!

In a customer report I use the REUSE_ALV_GRID_DISPLAY function module to display the output in ALV.

I would like to enter a fixed sorting criteria which cannot be changed by the user (e. g. via the IT_SORT parameter). He/she shall however be able to sort further according to additional criteria.

Is there an exit or something similar to do this?

Regards

Bastian Rohde

3 REPLIES 3
Read only

Former Member
0 Likes
351

Hi,

What you need to do is take out the SORT buttons from the application toolbar.

That can be done, by passing the function codes of the SORT buttons to the IT_EXCLUDING parameter of the function.

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

Former Member
0 Likes
351

I think u have to pass It_sort only and make use of IT_Excluding parameter ..see demo -

data : WA_SORT TYPE SLIS_SORTINFO_ALV.

perform sort_list.

form sort_list .

CLEAR WA_SORT.

WA_SORT-FIELDNAME = 'DOB'.

WA_SORT-SPOS = '1'.

WA_SORT-UP = 'X'.

WA_SORT-SUBTOT = 'X'.

APPEND WA_SORT TO IT_SORT.

CLEAR WA_SORT.

WA_SORT-FIELDNAME = 'NAME'.

WA_SORT-SPOS = '1'.

WA_SORT-UP = 'X'.

APPEND WA_SORT TO IT_SORT.

CLEAR WA_SORT.

endform.

Message was edited by:

Amit Tyagi

Read only

Former Member
0 Likes
351

Hi!

Thank you very much for the quick replies.

However due to the fact that the user shall be able to sort according to other criteria I cannot hide the sort buttons.

But I found a parameter in the IT_SORT table which allows a criterion to be obligatory. The sort buttons obey this setting, but the layout button does not.

Therefore your tip with the excluding parameter was really helpful nevertheless.

I now excluded the layout button leaving the user with the sorting I want and only being able to add other sort criteria.

Thank you very much!

Regards

Bastian Rohde