Skip to Content
-1

ALV subtotal at bottom

Apr 09 at 06:32 AM

47

avatar image

Dear Expert;

I haved developed an ALV report with Subtotal and totals. The subtotal is displaying at the end of the sorted parameter. How can i have all the subtotal at the end os the list on the last page ? Please help.

for sorting I have this:

Clear: WA_SORT.
WA_SORT-spos = 20.
WA_SORT-fieldname = 'DFKKREP06-STPRZ'.
WA_SORT-up = ' '.
WA_SORT-subtot = 'X'.
* WA_SORT-
append WA_SORT TO T_SO

and the alv fm

clear g_variant.

g_variant-report = g_repid.

PERFORM sort_total.
SORT gt_outtab by dfkkrep06-STPRZ ASCENDING.



call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = g_repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = 'TOP_OF_PAGE'
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
IS_LAYOUT = l_layout
it_fieldcat = gt_fieldcat[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
IT_SORT = t_sort[]
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
i_save = 'X'
is_variant = g_variant
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* IT_ALV_GRAPHICS =
* IT_ADD_FIELDCAT =
* IT_HYPERLINK =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = gt_outtab

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Simone Milesi Apr 09 at 07:11 AM
0

This is how ALV technology works: if you use SubTotals, they are displayed at the end of the grouping factor (and it has a logic from my point on view).
At the end you have the grand total.


If you absolutely need the subtotals at the end, you have to work out programatically, calculating them and adding them as "fake lines" of your ALV.
Sadly this will impact the grand total.

Not knowing your scenario, a possibile workaround is to have a second ALV on the bottom part of the screen where to show just the subtotals (obviously calculated by you).
This requires to shift from old and obsolete FM to OOP

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks Simone;

when you have alv display when you double click on the subtotals from top to bottom you have what I am looking for. All subttotats goes at the end of the page

0
Flavien Gagoum Nteumagne Apr 10 at 08:58 AM
0

Hi Simone;

I have subtotal after every change on the variable for sort, after running if I go to setting -> define totals drilldown I have what I whant but because the program is runing at the bacground I what it strait on runing the program. Do you know how I can get around?

Thankks in advance

Share
10 |10000 characters needed characters left characters exceeded
Ganesh pandian Apr 12 at 12:17 PM
0

Sadly this is how ALV works!

If you need that anyways, Then do the subtotal and the Grand total as yourself in the loop and append those total line in the last.

If you want to make those total lines looks legit, just color those rows to yellow!

I Hope this helps you!

Share
10 |10000 characters needed characters left characters exceeded