
The user can print out the ALV output that is currently displayed. To do this, the user chooses Print Version in the toolbar. ALV then generates a standard PDF file from the ALV output data, starts Adobe Acrobat, and displays the generated PDF file.

There are two different ways to generate a PDF document.
Adobe Document Services (ADS)
SAP BI Export Library (SAP)
In Customizing (transaction code SIMGH ) for SAP Web Application Server you can maintain this setting under SAP List Viewer (ALV) . For more details see the documentation located there.
Using the Settings dialog box, the user can make various settings that determine how the PDF file is to be displayed. The same options are available in your application. Define the default settings for the PDF document as follows:
Specifying the Paper Format and Orientation
Specify the size of the print area
Scale columns and rows
Sending the output directly to the printer
Set up headers and footers
Copying Design Objects to the PDF File
You can also define whether a design object that you defined for the header or footer should also appear in the PDF file.
Specifying the Paper Format and Orientation
You can specify the paper format to be used in the PDF document. You can choose from the following paper formats:
DIN A4
Letter
You can also specify whether the PDF document is to be created in Portrait or Landscape format.
You use the methods of interface class IF_SALV_WD_PDF_SETTINGS for this (implementing class CL_SALV_WD_CONFIG_TABLE).
Methods for paper format and orientation
|
Function |
Method |
|
Define paper format |
SET_PAGE_SIZE |
|
Get paper format |
GET_PAGE_SIZE |
|
Set paper orientation |
SET_ORIENTATION |
|
Get paper orientation |
GET_ORIENTATION |
Specify the size of the print area
You can define the size of the print area for pages of your PDF document by specifying the width of the page margins. You also specify the unit of measurement for your settings. You use the methods of interface class IF_SALV_WD_PDF_SETTINGS for this (implementing class CL_SALV_WD_CONFIG_TABLE).
Methods relating to the printable area of a page
|
Function |
Method |
|
Define unit of measurement for margins |
SET_MARGINS_UNIT |
|
Get unit of measurement for margins |
GET_MARGINS_UNIT |
|
Define width of bottom, top, right, and left margins |
SET_MARGIN_BOTTOM SET_MARGIN_TOP SET_MARGIN_RIGHT SET_MARGIN_LEFT |
|
Get width of bottom, top, right, and left margins |
GET_MARGIN_BOTTOM GET_MARGIN_TOP GET_MARGIN_RIGHT GET_MARGIN_LEFT |
Scale columns and rows
By default, the columns in the PDF document have the same width as the width in the ALV output. If the page does not provide sufficient space for all columns, the table is split across two or more pages. In the same way, the rows are also distributed across the number of pages required to display them. You can modify the size of the columns and rows in line with the page size of your PDF document in the following ways:
Reduce the width of columns so that they fit onto one page.
The height of the table remains unchanged.
Reduce the width and the height of the table so that the entire table fits onto one page.
Leave both width and height unchanged.
If the columns are distributed across multiple pages, you can specify whether specific information is to appear on the first page only or whether it is also to be repeated on subsequent pages. You can choose from the following variants:
For unchanged column width (wallpaper): The column header is displayed on every page.
For adjusted column width: Column headers are repeated on subsequent pages
Regardless of scaling: Fixed columns are repeated on all subsequent pages.
You use the methods of interface class IF_SALV_WD_PDF_SETTINGS for this (implementing class CL_SALV_WD_CONFIG_TABLE).
Methods for scaling columns and rows
|
Function |
Method |
|
Define table scaling in PDF document |
SET_PAGE_LAYOUT |
|
Get table scaling in PDF document |
GET_PAGE_LAYOUT |
|
Repeat column titles if page width is adjusted |
SET_REPEAT_HEADERS_FIT_H |
|
Check whether column titles are repeated if page width is adjusted |
GET_REPEAT_HEADERS_FIT_H |
|
Repeat column titles for adjacent pages |
SET_REPEAT_HEADERS_WALLPAPER |
|
Check whether column titles are repeated for adjacent pages |
GET_REPEAT_HEADERS_WALLPAPER |
|
Repeat fixed columns on every page |
SET_REPEAT_KEY_COLUMNS |
|
Check whether fixed columns are repeated on every page |
GET_REPEAT_KEY_COLUMNS |
Sending the output directly to the printer
You can choose for the print version to be created as a PostScript file instead of a PDF document. The PostScript file is then sent directly to a printer of your choice.
If you do not specify an output device here, a PDF file is generated and displayed on the screen.
You use the methods of interface class IF_SALV_WD_PDF_SETTINGS for this (implementing class CL_SALV_WD_CONFIG_TABLE).
Methods for printing directly
|
Function |
Method |
|
Set ALV output to be printed immediately |
SET_PRINT_IMMEDIATE |
|
Check whether the ALV output is to be printed immediately |
GET_PRINT_IMMEDIATE |
|
Set printer |
SET_PRINTER |
|
Get printer |
GET_PRINTER |
Set up headers and footers
Using text modules, you can create headers or footers for your PDF document. These are displayed on every page of your document. When you create the header and footer, you specify the position of the text module (centered, left-justified, or right-justified).
You can place one of the following text modules at the required position:
No text
The current position remains empty.
Free text
The free text that you specified for the position is inserted at the current position.
Current date
Current date and time
Current page
Page 1 of ?
The number of the current page and the total number of pages are inserted at the current position.
You use the methods of interface class IF_SALV_WD_PDF_SETTINGS for this (implementing class CL_SALV_WD_CONFIG_TABLE).
Methods for placing text modules in headers and footers
|
Function |
Method |
|
Set Free Text text module for the different positions |
SET_FOOTER_CENTER_FREETEXT GET_FOOTER_LEFT_FREETEXT SET_FOOTER_RIGHT_FREETEXT SET_HEADER_CENTER_FREETEXT SET_HEADER_LEFT_FREETEXT SET_HEADER_RIGHT_FREETEXT |
|
Get Free Text text module for the different positions |
GET_FOOTER_CENTER_FREETEXT GET_FOOTER_LEFT_FREETEXT GET_FOOTER_RIGHT_FREETEXT GET_HEADER_CENTER_FREETEXT GET_HEADER_LEFT_FREETEXT GET_HEADER_RIGHT_FREETEXT |
|
Set text module for the different positions |
SET_FOOTER_CENTER SET_FOOTER_LEFT SET_FOOTER_RIGHT SET_HEADER_CENTER SET_HEADER_LEFT SET_HEADER_RIGHT |
|
Get text module for the different positions |
GET_FOOTER_CENTER GET_FOOTER_LEFT GET_FOOTER_RIGHT GET_HEADER_CENTER GET_HEADER_LEFT GET_HEADER_RIGHT |
Copying Design Objects to the PDF File
If you have defined a design object for a header or footer for the ALV output, you can define whether the content of this design object should also be copied into the PDF file. You use the methods of interface class IF_SALV_WD_PDF_SETTINGS for this (implementing class CL_SALV_WD_CONFIG_TABLE).
Methods for copying design objects into the PDF file
|
Function |
Method |
|
Copy design object for the PDF header |
SET_EXPORT_NO_TOL |
|
Check whether the design object is to be copied for the PDF header |
GET_EXPORT_NO_TOL |
|
Copy design object for the PDF footer |
SET_EXPORT_NO_EOL |
|
Check whether the design object is to be copied for the PDF footer |
GET_EXPORT_NO_EOL |