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 Output printing - Achieving page breaks

Former Member
0 Kudos

Hi,

We have an ALV program in which settings have been made for a page break on the first column of the output. When I take a print out, I get the output in multiple pages, which is what I need.

However, when we transport the same program to our consolidated

system and try to print, these page breaks disappear.

Is there some other setting which determines the page breaks. Like,

some print settings, etc.

Any help in this would be greatly appreciated.

(I am using the 'REUSE_ALV_GRID_DISPLAY' fm and passing the first columns name in the 'it_sort' table. Also, in the layout, I am saving this column name in the 'Sort Order')

Please let me know if more details are needed.

Regard,

Sudeep

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

You need to populate the sort table and send it to ALV function.

if you specify group = '*' then it will display in each page and print also for each sort combination.

wa_sort-group = '*'.

REPORT  ztest_alv.
 
TYPE-POOLS: slis.
 
DATA: BEGIN OF it_flight OCCURS 0,
       carrid  LIKE sflight-carrid,
       connid   LIKE sflight-connid,
       fldate   LIKE sflight-fldate,
       seatsmax LIKE sflight-seatsmax,
       seatsocc LIKE sflight-seatsocc,
      END OF it_flight.
DATA: it_fieldcat TYPE  slis_t_fieldcat_alv,
      wa_fcat like line of it_fieldcat,
      layout TYPE  slis_layout_alv.
data: IT_SORT TYPE  SLIS_T_SORTINFO_ALV,
       wa_sort like line of it_sort.
 
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_program_name         = sy-repid
    i_internal_tabname     = 'IT_FLIGHT'
    i_inclname             = sy-repid
  CHANGING
    ct_fieldcat            = it_fieldcat
  EXCEPTIONS
    inconsistent_interface = 1
    program_error          = 2.
 
SELECT carrid
       connid
       fldate
       seatsmax
       seatsocc
 FROM sflight
 INTO CORRESPONDING FIELDS OF TABLE it_flight
 UP TO 20 ROWS.
.
wa_fcat-do_sum = 'X'.
modify it_fieldcat from wa_fcat TRANSPORTING do_sum
 where fieldname = 'SEATSOCC' .
 
wa_sort-fieldname = 'CARRID'.
wa_sort-group = '*'.
wa_sort-up = 'X'.
append wa_sort to it_sort.
 
wa_sort-fieldname = 'CONNID'.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
append wa_sort to it_sort.
 
 
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'  "<- replace list with Grid also
  EXPORTING
    i_callback_program = sy-repid
    is_layout          = layout
    it_fieldcat        = it_fieldcat
    it_sort            = it_sort
  TABLES
    t_outtab           = it_flight
  EXCEPTIONS
    program_error      = 1.

Regards

Vijay Babu Dudla

2 REPLIES 2

former_member188685
Active Contributor
0 Kudos

You need to populate the sort table and send it to ALV function.

if you specify group = '*' then it will display in each page and print also for each sort combination.

wa_sort-group = '*'.

REPORT  ztest_alv.
 
TYPE-POOLS: slis.
 
DATA: BEGIN OF it_flight OCCURS 0,
       carrid  LIKE sflight-carrid,
       connid   LIKE sflight-connid,
       fldate   LIKE sflight-fldate,
       seatsmax LIKE sflight-seatsmax,
       seatsocc LIKE sflight-seatsocc,
      END OF it_flight.
DATA: it_fieldcat TYPE  slis_t_fieldcat_alv,
      wa_fcat like line of it_fieldcat,
      layout TYPE  slis_layout_alv.
data: IT_SORT TYPE  SLIS_T_SORTINFO_ALV,
       wa_sort like line of it_sort.
 
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    i_program_name         = sy-repid
    i_internal_tabname     = 'IT_FLIGHT'
    i_inclname             = sy-repid
  CHANGING
    ct_fieldcat            = it_fieldcat
  EXCEPTIONS
    inconsistent_interface = 1
    program_error          = 2.
 
SELECT carrid
       connid
       fldate
       seatsmax
       seatsocc
 FROM sflight
 INTO CORRESPONDING FIELDS OF TABLE it_flight
 UP TO 20 ROWS.
.
wa_fcat-do_sum = 'X'.
modify it_fieldcat from wa_fcat TRANSPORTING do_sum
 where fieldname = 'SEATSOCC' .
 
wa_sort-fieldname = 'CARRID'.
wa_sort-group = '*'.
wa_sort-up = 'X'.
append wa_sort to it_sort.
 
wa_sort-fieldname = 'CONNID'.
wa_sort-subtot = 'X'.
wa_sort-up = 'X'.
append wa_sort to it_sort.
 
 
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'  "<- replace list with Grid also
  EXPORTING
    i_callback_program = sy-repid
    is_layout          = layout
    it_fieldcat        = it_fieldcat
    it_sort            = it_sort
  TABLES
    t_outtab           = it_flight
  EXCEPTIONS
    program_error      = 1.

Regards

Vijay Babu Dudla

0 Kudos

Thanks for your reply.

But, I've already entered the settings when creating the ALV Grid

output. I'm setting the following values when entering the sort details:

wa_sortinfo-fieldname = 'W_CENTER'.

wa_sortinfo-up = 'X'.

wa_sortinfo-subtot = 'X'.

wa_sortinfo-group = '*'.

APPEND wa_sortinfo TO g_sortinfo.

However, I am still not getting the page breaks.

Please note: The same program gives the page breaks in another system.