03-14-2018 9:46 AM
Hi ABAP community,
I want to have a default sort order in my ALV Grid meaning that the data is already sorted when the ALV pops up the first time..
Does someone know how to do that?
Regards,
Thomas.
03-14-2018 12:35 PM
Hi Thomas,
it depends which ALV are you using. Below you can find explanation for the two most often used ALV types:
- if you are using CL_GUI_ALV_GRID then you should pass IT_SORT table (type LVC_T_SORT) when calling SET_TABLE_FOR_FIRST_DISPLAY.
- if you are using CL_SALV_TABLE then you should use CL_SALV_SORTS object to adjust initial sorts (get sort by calling GET_SORTS and then in simpliest case add necessary sorts with ADD_SORT method).
Best regards,
Marcin
03-14-2018 12:37 PM
Set it programmatically (e.g. CL_GUI_ALV_GRID->SET_SORT_CRITERIA or parameter IT_SORT of CL_GUI_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY, or CL_SALV_TABLE->GET_SORTS, etc.)