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: 

Page-Break while printing

Former Member
0 Kudos

Hi all,

is it possible in ALV to have a page-break with header and footer while printing???

2 REPLIES 2

Former Member
0 Kudos

You can use the option of Grouping to achieve this.

For more details, read the documentation of the data element SLIS_CTRLS, which is used for the structure field slis_sortinfo_alv-group.

slis_sortinfo_alv is the line type of the parameter IT_SORT of the FM REUSE_ALV_GRID_DISPLAY.

If you use '*' as the value for slis_sortinfo_alv-group, it will initiate a page break and if you use 'UL', the ALV will use Underline to differentiate between the group.

Example:

sort-spos = '10'.

SORT-FIELDNAME = 'Years'.

SORT-TABNAME = 'DATA_TAB2'.

sort-UP = 'X'.

sort-subtot = 'X'.

SORT-GROUP = '* '.

APPEND SORT. CLEAR SORT.

In the It_SOET internal table write:

IT_SORT-Group = 'X'.

It will give a page break...

reward point if helpful.

Former Member
0 Kudos

Hi,

I hope the following steps will solve your problem :

1. Merge the data from the 3 tables into a single table (say gt_outtab).

2. The table gt_outtab should have a field (say tab ) to indicate the table from which the data has come . Depending on the tables conatining the initial data , you can assign 1, 2 , 3 into the new field (tab).

3. Bulid the fieldcatalog with the particular column (TAB) of the output table as no_out='X'.

gs_fieldcat-COL_POS = lv_line.

gs_fieldcat-fieldname = 'TAB'.

gs_fieldcat-outputlen = 1.

gs_fieldcat-just = 'L'.

gs_fieldcat-coltext = 'Table'.

gs_fieldcat-seltext = 'Table'.

gs_fieldcat-NO_OUT = 'X'.

APPEND gs_fieldcat TO lt_fcat.

4. Define the data of type lvc_s_print

DATA: gs_print TYPE lvc_s_prnt.

5. Before calling the method set_table_for_first_display assign grpchgedit of the structure gs_print as 'X'

gs_print-grpchgedit = 'X'.

CALL METHOD gr_grid->set_table_for_first_display

EXPORTING

is_print = gs_print

is_layout = ls_layo

CHANGING

it_outtab = gt_outtab[]

it_fieldcatalog = lt_fcat.

6. Run the report . The particular column is not displayed in the list.

7. Go to Print Preview mode. Press the sort ascending or descending button on toolbar (without selecting a column).A dialog box appears asking for sort order.

8. Add the field(TAB), from the available list on right hand side.

9. In the last column titled NG of this sort order dialog box, write * for page feed .

10. Press the copy button .

Reward points if found helpful…..

Cheers,

Chandra Sekhar.