‎2009 Mar 31 2:33 PM
hi
need to sort alv data, but the entries are like header and item
means first line is of header data and if has items then
the items will be displayed starting from second line but some columns for all items
will be empty (means header data at the top line refers)
now second header data comes and then its items.
in such case how to sort the ALV basing on the header number.
while sorting all the items are going at the bottom since it has no header number in its line
and header items are coming at the top
how to sort these entries correctly
‎2009 Mar 31 2:40 PM
Hi ajay r
Its not possible in normal ALV. Either you go for alv tree or handle the requirement programatically by writting the functionality of sort in your user command.
Venkat.
‎2009 Mar 31 2:59 PM
I didn't get your requirement properly. But if you have multiple header, then you can have a try with Block ALV, to accommodate multiple ALV in a single window, where you can sort ALV individually.
Kuntal.
‎2009 Mar 31 3:08 PM
Hi Ajay,
It is not possible. Instead you can do like this. Add one indicator field to your alv populating internal table. for the header information, give the indicator as 'H'. Then populate the sorting filed and correspondinging item details immediately.
I hope you need not populate the value (Sorting field value) as it is same for the line items also.
Other wise you can even use At new statement and populate the header and line items immediately.
In either of the ways you can do.
Regards,
Santosh Kumar Mukka.
‎2009 Mar 31 8:05 PM
‎2009 Apr 01 6:49 AM
hi can u send some sample easy hierarchial alv/tree avl
i think if i can color the text for items same as background color of alv cells then the standard sorting can be used without change
How to color the text rather than cell coloring
‎2009 Apr 01 7:06 AM
Hi,
Try this
DATA : gt_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv.
PERFORM fill_sort. " Filling sort of REUSE_ALV_GRID_DISPALY
FORM fill_sort .
wa_sort-fieldname = 'MATNR'.
wa_sort-up = c_x.
APPEND wa_sort TO gt_sort.
CLEAR wa_sort.
ENDFORM. " FILL_SORT
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_grid_title = text-012
is_layout = wa_slis_layout
it_sort = gt_sort[]
it_fieldcat = gt_fieldcat[]
i_save = 'A'
TABLES
t_outtab = <fs_table>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
‎2009 Apr 01 7:09 AM
Hi try using this .
wa_sort type lvc_s_sort,
lt_sort type lvc_t_sort.
wa_sort-fieldname = 'SFLAG'.
wa_sort-subtot = 'X'.
append wa_sort to lt_sort.
clear wa_sort.
Regards