Question:
Hi,
I've 3 columns to be sorted i.e col1, col2, and col3. and i need to group only by first 2 columns i.e col1 and col2.
I prepared a sort key with the combination of col1, col2 and col3, but the alv is by default grouping all the three columns.
How to group only two fields i.e col1, col2.
Please help me in this concern.
thanks in advance.
Answer:
Try this...
PERFORM f_build_sortfield USING t_alv_isort[].
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = d_repid
i_callback_pf_status_set = 'F_SET_PF_STATUS'
i_callback_user_command = 'F_USER_COMMAND'
is_layout = d_layout
it_fieldcat = t_alv_fieldcat[]
it_sort = t_alv_isort[]
.....
FORM f_build_sortfield USING fu_sort TYPE slis_t_sortinfo_alv.
DATA: ld_sort TYPE slis_sortinfo_alv.
CLEAR ld_sort.
ld_sort-fieldname = 'MATNR'.
ld_sort-up = ' '.
ld_sort-subtot = 'X'.
ld_sort-group = '* '.
APPEND ld_sort TO fu_sort.
ENDFORM.