Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV - Do not page break before printing grand totals

Former Member
0 Kudos
74

Hi,

I have an ALV report that is sorted by vendor, then by material number. There are subtotals for each vendor/material combination.

After each new vendor, a page break occurs.

All is well and good, except that the grand totals are always being displayed on a new page, even though there is still room on the previous page.

Is it possible to stop the page-break before the grand totals?

Here is the code that I use to set the sorting and page breaks.


FORM f_set_alv_sorting .

* Page break by vendor
  gs_sort-spos      = '01'.
  gs_sort-fieldname = 'LIFNR'.
  gs_sort-tabname   = 'GT_OUTPUT'.
  gs_sort-up        = 'X'.
  gs_sort-group     = '*'.
  gs_sort-subtot    = 'X'.
  APPEND gs_sort TO gt_sort.
  CLEAR gs_sort.

* subtotal by vendor/material
  gs_sort-spos      = '02'.
  gs_sort-fieldname = 'MATNR'.
  gs_sort-tabname   = 'GT_OUTPUT'.
  gs_sort-up        = 'X'.
  gs_sort-subtot    = 'X'.
  APPEND gs_sort TO gt_sort.


ENDFORM.                    " f_set_alv_sorting

Any suggestions would be appreciated.

Thanks!

1 REPLY 1

former_member188685
Active Contributor
0 Kudos
47

May be it is a standard behaviour, i never tested the Print using Page break option.

are you giving any LINE-COUNT in Report statement , check it once.

Instead you can print the totals in the beginning it self.

layout-totals_before_items = 'X'.

Using that you can print the totals in the beginning .