2007 Dec 05 2:03 AM
Dear all,
Suppose I have the following data in an internal table:
Inv No. Date Customer Pack Load No. Tax Amt
9000000001 01.01.2007 ABCABCABC 24 1190020 100000
9000000001 01.01.2007 ABCABCABC 24 1190021 100000
9000000001 01.01.2007 ABCABCABC 24 1190031 100000
9000000002 11.01.2007 ABCABCABC 35 1190881 300000
9000000002 11.01.2007 ABCABCABC 35 1190882 300000
9000000002 11.01.2007 ABCABCABC 36 1190991 300000
9000000002 11.01.2007 ABCABCABC 36 1190992 300000
9000000002 11.01.2007 ABCABCABC 36 1190993 300000
How do I make the list look like below in ALV. I'm using FM REUSE_ALV_GRID_DISPLAY.
Inv No. Date Customer Pack Load No. Tax Amt
9000000001 01.01.2007 ABCABCABC 24 1190020 100000
1190021
1190031
Subtotal 24 100000
9000000002 11.01.2007 ABCABCABC 35 1190881 300000
1190882
36 1190991
1190992
1190993
Subtotal 71 300000
Thanks in advance.
Regards,
Goh Tiam Tjai
2007 Dec 05 2:21 AM
Set the DO_SUM for the field PACK and TAX_AMT in the your fieldcatalog.
Now you need to pass the SORT table.
DATA: ls_sort TYPE slis_sortinfo_alv.
data: xt_sort TYPE slis_t_sortinfo_alv.
ls_sort-fieldname = 'INV_NO'.
ls_sort-spos = 1.
ls_sort-up = 'X'.
ls_sort-subtot = 'X'.
APPEND ls_sort TO xt_sort.
CLEAR ls_sort.
ls_sort-fieldname = 'DATE'.
ls_sort-spos = 2.
ls_sort-up = 'X'.
ls_sort-subtot = 'X'.
APPEND ls_sort TO xt_sort.
CLEAR ls_sort.
ls_sort-fieldname = 'CUSTOMER'.
ls_sort-spos = 3.
ls_sort-up = 'X'.
ls_sort-subtot = 'X'.
APPEND ls_sort TO xt_sort.
CLEAR ls_sort.
Pass this SORT table into your FM:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_top_of_page = c_formname_top_of_page
i_callback_user_command = c_user_command
i_save = 'A'
is_variant = i_variant
it_sort = t_sort " <<
Regards,
Naimesh Patel
2007 Dec 05 2:53 AM
Hi Naimesh,
Thanks for the prompt response.
That way will make PACK and TAX_AMT to be summed for every line. For PACK, it supposes to be summed only for new value in the lines and TAX_AMT should be only one line (first line) for each Invoice No.
Any idea how I can do it?
Regards,
Goh Tiam Tjai