‎2009 May 15 7:27 AM
Hi,
When i clicked on a column of the alv grid(on header of the grid), it should be sorted based on the clicked column.
It is available in sost transaction etc, how can i do this?
Thanks.
deniz.
‎2009 May 15 7:30 AM
hi,
Build Sort Catalog as below , For example to subtotal at MATNR
And Show only subtotal line
data gt_sort type slis_t_sortinfo_alv. "sort catalog
data sort type slis_sortinfo_alv.
Pass Sort sequence as below.
clear sort.
sort-fieldname = 'MATNR'.
sort-tabname = 'INTERNAL TABLE NAME'
sort-up = 'X'.
SORT-SUBTOT = 'X'.
SORT-EXPA = 'X'. " This will hide details lines
append sort to t_sort.
clear sort.
Pass This t_sort ITAB in FM REUSE_ALV_GRID_DISPLAY as
it_sort = t_sort[]
Otherwise, at output screen, Click the column you wish to sort and then click Sort Icon ( at the top header level above your column names) to arrange the column in ascending or decending order.
‎2009 May 15 7:30 AM
when click on the header of the column and u have to hit the sort button ascending or descing accordingly..
‎2009 May 15 7:32 AM
‎2009 May 15 7:34 AM
Hi,
Declare the I_sort internal table.
1) I_SORT TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE.
Assign the field to b sorted according to.
2) I_SORT-SPOS = 1.
I_SORT-FIELDNAME = 'MATDES'.
I_SORT-TABNAME = 'ITAB'.
I_SORT-UP = 'X'.
I_SORT-SUBTOT = 'X'.
APPEND I_SORT.
CLEAR I_SORT.
Assign sort table as follows-
3) CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
IT_FIELDCAT = FIELDCATALOG[]
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_LAYOUT = I_LAYOUT
IT_EVENTS = EVENTS[]
IT_SORT = I_SORT[]
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
‎2009 May 15 7:37 AM
Dear,
check this code
SORT ITAB BY PARAMETER_CODE.
In the:
FORM F9002_MODIFY_FIELD_CAT TABLES P_FIELDCAT STRUCTURE LVC_S_FCAT.
FIELD-SYMBOLS : <LFS_FIELDCAT> TYPE LVC_S_FCAT.
LOOP AT P_FIELDCAT ASSIGNING <LFS_FIELDCAT>.
CASE <LFS_FIELDCAT>-FIELDNAME.
WHEN 'PARAM_CODE'.
<b> <LFS_FIELDCAT>-NO_OUT = 'X'.</b>
ENDCASE.
ENDLOOP.
ENDFORM.
Cheers
fareed