You must set print parameters before the printing process starts.
When printing lists after creating them, the system uses the print format specified in the print parameters to split the completed list and fit it onto the print pages, truncating it if necessary.
When printing lists while creating them, the system uses the print format to actually format the list in the program.
Print parameters are set either interactively by the user or from within the program.
Print Parameters - Overview
For each print process, the spool system needs a complete and consistent set of print parameters. In ABAP, the structure PRI_PARAMS (ABAP Dictionary) represents a set of print parameters.
When passing the print parameters interactively, the system displays the following dialog box after starting the executable program, on which the user has to enter the most important print parameters.
The table below shows which input fields of the Print List Output dialog window conform to which PRI_PARAMS components.
Input Field |
Component |
Meaning |
---|---|---|
Output device |
PDEST |
Name of a printer or fax (Default values taken from user defaults). |
Number of copies |
PRCOP |
Number of printed copies (Default value: 1) |
Name |
PLIST |
Name of the spool request. Set this only if you do not want to print immediately (default: report name ( sy-repid ) and the first three characters of the user name ( sy-uname )). |
Title |
PRTXT |
Description text of the spool request. This text appears on the standard cover page. PRTXT also replaces the name PLIST in the list of print requests ( ). |
Authorization |
PRBER |
Authorization for the spool request. Only users with this authorization can view the contents of the request. |
Print immediately |
PRIMM |
If you select this field, the system sends the spool request to the Output device immediately after completing it. (Default values taken from user defaults). |
Delete after print |
PRREL |
If you select this field, the system deletes the spool request immediately after outputting it on the Output device .Otherwise, it deletes the request after the Retention period expired (Default values taken from user defaults). |
New spool request |
PRNEW |
If you select this field, the system creates a new spool request. Otherwise, the system tries to append this spool request to a request that is not yet completed. In this case, the Name , Output device , Number of copies , and Format must be the same. |
Retention period |
PEXPI |
Number of days for which the system holds the spool request before deleting it. (Default value: 8). |
Archiving mode |
ARMOD |
Specify the archiving mode. You can choose a value from the input help only. Click the possible entries pushbutton to choose Print , Archive , and Print and archive (ARMOD is 1, 2, or 3). (Default value: Print ) |
SAP cover sheet |
PRSAP |
If this field contains 'X', the system creates a standard cover page containing several data. If it contains 'D', it depends on the setting of the output device whether a cover page is printed or not. If the field is empty, the system does not create a cover page. (Default value: 'D') |
Recipient |
PRREC |
Specify the recipient name for the SAP cover sheet . (Default value: User name) |
Department |
PRABT |
Specify the department name for the SAP cover sheet (Default value taken from user defaults) |
Lines |
LINCT |
Number of list lines. This field has the same effect as the LINE-COUNT option of the REPORT statement. You cannot specify 0 (unlimited number of lines) for printing. The maximum number in this field depends on the contents of the Format field. (Default value: Set internally). |
Columns |
LINSZ |
Number of characters per list line. This field has the same effect as the LINE-SIZE option of the REPORT statement. The maximum number in this field depends on the contents of the Format field. (Default value: Set internally). |
Formatting |
PAART |
This field actually determines the page format of the output. Depending on the printer connected, you can set different formats with different maximum page length and width values in this field. (Default value: Set internally). |
The Print List Output dialog box checks the input values for consistency and completeness. You cannot print if the print parameters are inconsistent (for example, using output formats the specified output device does not support).
The print parameters LINCT and LINSZ do not overwrite the LINE-COUNT and LINE-SIZE options of the REPORT or NEW-PAGE statements. If you use these options in your program, the values you specify there fill the components LINCT and LINSZ. The corresponding input fields in the Print List Output dialog box no longer accept input then. If the values you specify exceed the maximum values in the Format field, you cannot print the list.
In addition to the print parameters, there are archiving parameters. However, you must specify them only if optical archiving is turned on (archiving mode is Archive or Print and archive ). In ABAP, the structure ARC_PARAMS (ABAP Dictionary) represents a set of archiving parameters.
The table below shows which input fields of the Print List Output dialog window conform to which ARC_PARAMS components.
Input Field |
Component |
Meaning |
---|---|---|
Object type |
SAP_OBJECT |
Object type of the SAP object |
Document type |
AR_OBJECT |
Document type of the archiving object |
Information |
INFO |
Information short form of the archiving request |
Text |
ARCTEXT |
Description text of the archiving request |
You cannot archive a list unless the entries you make in the dialog box are consistent and complete. For optical archiving it can be a good idea to write index information into the list in order support a later search in the archived list. You can only do this while you are creating the list (see Archiving Lists Using SAP ArchiveLink ).
To set print and archiving parameters from within the program, you must use the function module GET_PRINT_PARAMETERS. The system does not accept any values directly assigned to the print and archiving parameters sets. If you assign values directly and use these values afterwards, a runtime error occurs.
Print Parameters - Setting Default Values
The Print List Output dialog window always appears after the user chooses
Execute + print on the selection screen.
Print on the list interface.
You cannot suppress the dialog box for these user actions.
However, you can set default values for the Print List Output dialog window from within the program. You use the function module SET_PRINT_PARAMETERS to do so. This function module has no export parameters and only takes effect when the list is printed using one of the user actions listed above.
For Execute + print on the selection screen, you must call SET_PRINT_PARAMETERS during the AT SELECTION-SCREEN event (or earlier). For Print on the list interface, you must call the function module before sending the list to the output screen (or earlier).
The table below shows how the import parameters of SET_PRINT_PARAMETERS are related to the print and archiving parameters:
Import Parameters |
Parameters |
Meaning |
---|---|---|
IN_PARAMETERS |
PRI_PARAMS |
Entire set |
IN_ARCHIVE_PARAMETERS |
ARC_PARAMS |
Entire set |
ARCHIVE_MODE |
PRI_PARAMS-ARMOD |
Archiving mode |
AUTHORITY |
PRI_PARAMS- PRBER |
Authorization |
COPIES |
PRI_PARAMS- PRCOP |
Number of copies |
COVER_PAGE |
PRI_PARAMS-PRBIG |
Selection cover page |
DATA_SET |
PRI_PARAMS-PRDSN |
Spool file |
DEPARTMENT |
PRI_PARAMS-PRABT |
Department name |
DESTINATION |
PRI_PARAMS-PDEST |
Output device |
EXPIRATION |
PRI_PARAMS-PEXPI |
Retention period |
IMMEDIATELY |
PRI_PARAMS-PRIMM |
Print immediately |
LAYOUT |
PRI_PARAMS-PAART |
Formatting |
LINE_COUNT |
PRI_PARAMS-LINCT |
Lines per page |
LINE_SIZE |
PRI_PARAMS-LINSZ |
Columns per line |
LIST_NAME |
PRI_PARAMS-PLIST |
Name of spool request |
LIST_TEXT |
PRI_PARAMS-PRTXT |
Description text |
NEW_LIST_ID |
PRI_PARAMS-PRNEW |
New spool request |
RECEIVER |
PRI_PARAMS-PRREC |
Recipient |
RELEASE |
PRI_PARAMS-PRREL |
Delete after print |
SAP_COVER_PAGE |
PRI_PARAMS-PRSAP |
SAP cover sheet |
TYPE |
PRI_PARAMS-PTYPE |
Type of spool request |
FOOT_LINE |
PRI_PARAMS-FOOTL |
Output footer line |
ARCHIVE_ID |
ARC_PARAMS-ARCHIV_ID |
Target archive |
ARCHIVE_INFO |
ARC_PARAMS-INFO |
Information |
ARCHIVE_TEXT |
ARC_PARAMS-ARCTEXT |
Description text |
AR_OBJECT |
ARC_PARAMS-AR_OBJECT |
Document type |
SAP_OBJECT |
ARC_PARAMS-SAP_OBJECT |
Object type |
You must assign structures with the structures PRI_PARAMS and ARC_PARAMS to the parameters IN_PARAMETERS and IN_ARCHIVE_PARAMETERS respectively. These field strings must either be initial or contain the results of the function module GET_PRINT_PARAMETERS.
The system only uses the FOOT_LINE parameter if the user chooses Print on the list interface. If this parameter equals 'X', the system outputs one system-defined footer line on each page.
To include the function module into your program, use
in the ABAP Editor.Setting Print Parameters from within the Program
When you use the print statements
NEW-PAGE PRINT ON
SUBMIT ... TO SAP-SPOOL
CALL FUNCTION 'JOB-SUBMIT'
you set the print parameters from within the program, using the corresponding options of the print statements. You can either display or suppress the Print parameters dialog box.
Function Module GET_PRINT_PARAMETERS
To ensure that the parameters are sent to the spool system properly and completely, you should always transfer the entire parameter set with the print statements. To create a parameter set, use the function module GET_PRINT_PARAMETERS.
The function module GET_PRINT_PARAMETERS has the following tasks:
Creating a complete set of print and archiving parameters.
The individual print and archiving parameters are tightly interconnected and must be complete. For example, for each output device, you must specify the layout format, which, in turn, requires the numbers of lines and columns to be set. Or, when setting the archiving mode Archive or Print and archive, the archiving parameters must be set.
Uncoupling the user dialog from the actual print statements.
The print statements ( NEW-PAGE PRINT ON, SUBMIT rep TO SAP-SPOOL ) support a user dialog, but with the disadvantage of not offering the Back function. Once you have started the print process using a print statement, the system cannot go back to before the print statement. The user can only end the process using End which terminates the entire program.
GET_PRINT_PARAMETERS executes the following functions:
You use the import parameters to set the print and archiving parameters. The function module receives any required values not set via import parameters from the system. These values correspond to the predefined values on the Print List Output dialog window, some of which are set in the user master record.
The function module, by default, displays the Print List Output dialog box for a user dialog. Here, the user can overwrite the fields filled with import parameters or predefined values.
The function module automatically sets the other values. If you set an import parameter, for example, for a certain layout, the system automatically sets the dependent parameters such as lines and columns instead of requesting them as import parameters.
The function module supplies you with complete sets of print and archiving parameters as export parameters. You can transfer these export parameters to the spool system, using the options of the print statements. These parameter sets are either completely filled or completely empty.
Import Parameters of GET_PRINT_PARAMETERS
The function module GET_PRINT_PARAMETERS has the same import parameters as the function module SET_PRINT_PARAMETERS, however, with the following exceptions:
GET_PRINT_PARAMETERS has no import parameter FOOT_LINE, since you need this parameter only if the user chooses Print on the output screen of the list.
GET_PRINT_PARAMETERS has the following additional import parameters:
MODE
This affects how the module works as follows:
MODE |
Effect |
---|---|
PARAMS |
This is the default setting. The user can choose Print or Cancel on the dialog window. |
PARAMSEL |
The dialog window contains the additional checkbox Selection cover page . If the user fills this field (print parameter PRBIG), the system includes a cover page into the output that contains the selections from the selection screen. |
DISPLAY |
The print parameters are displayed in the dialog box but cannot be changed. |
CURRENT |
Uses the function module to determine the print parameters during the current print process (after a print statement). These values correspond to the parameters set for printing. If no print process is in progress, the system uses the pre-set values. |
BATCH |
Uses the function module to determine the print parameters for a background job. The executable program to be started must be specified in the import parameter REPORT. If the REPORT statement for the program contains the options LINE-COUNT and LINE-SIZE , the system uses them as defaults in the dialog window. Instead of the Print pushbutton, the system offers the Save pushbutton in the dialog window. |
REPORT
The value contained in REPORT always influences the default value for the name in the spool request (component PLIST), which is otherwise determined by the sy-repid system field. This default value is itself overwritten by the import parameter LIST_NAME (if used).
If MODE is set to 'BATCH', the value in REPORT specifies the name of the executable program you want to start as a background job. GET_PRINT_PARAMETERS determines the print parameters for that this program and not for the current executable program.
NO_DIALOG
determines whether to display the dialog box. If NO_DIALOG contains 'X', the system suppresses the dialog.
Export Parameters of GET_PRINT_PARAMETERS
The function module GET_PRINT_PARAMETERS has the following export parameters:
OUT_PARAMETERS
This parameter either contains a complete set of print parameters or it is empty (see VALID).
OUT_ARCHIVE_PARAMETERS
This parameter either contains a complete set of archiving parameters or it is empty (see VALID).
VALID
This parameter shows whether the sets OUT_PARAMETERS and OUT_ARCHIVE_PARAMETERS are completely filled or empty. If VALID contains 'X', the parameter sets are complete. You can transfer them to the spool system. If VALID contains space , the parameter sets are empty. VALID is set to space if the user cancels the user dialog. Therefore, after a user dialog, always check VALID. If no user dialog occurs, VALID contains 'X'.
Exception Parameters of GET_PRINT_PARAMETERS
The function module GET_PRINT_PARAMETERS has the following exception parameters:
ARCHIVE_INFO_NOT_FOUND
The archiving data specified are not consistent or the archive specified does not exist in the system.
INVALID_PRINT_PARAMS, INVALID_ARCHIVE_PARAMS
The set of print or archiving parameters is invalid. You created an invalid parameter set by directly assigning values to the individual components of the parameter field strings and by using these structures to fill the import parameter IN_PARAMETERS or IN_ARCHIVE_PARAMETERS. The parameter field strings must always be the result of a previous call of GET_PRINT_PARAMETERS. Invalid import parameters, such as lines or columns set to 0, also create invalid parameter sets.
Using GET_PRINT_PARAMETERS: Notes
The function module GET_PRINT_PARAMETERS is the only method allowed by ABAP to assign values to the print and archiving parameter sets. Transferring parameter sets filled using GET_PRINT_PARAMETERS to the spool system prevents the program from being ended abnormally. This is of special importance for background processing. However, you must ensure that the export parameter VALID is unequal to space and that no exception occurred.
Note that for GET_PRINT_PARAMETERS, it is most important that the parameter sets are complete and that the system can therefore execute the print request. GET_PRINT_PARAMETERS does not execute a complete consistency check as does the Print List Output dialog window. It provides consistency only where it is needed to execute the print request. Inconsistent entries are partly ignored, partly replaced. For example, you can
set values using the import parameters LINE_SIZE, LINE_COUNT that do not go with the LAYOUT parameter. In a user dialog, the system finds this inconsistency. Without user dialog, these values may cause truncated printouts.
set an invalid value in the import parameter DESTINATION and, at the same time, set IMMEDIATELY to 'X'. In this case, the function module replaces the output device by a default value (LP01) and sets the component PRIMM to space . This causes the spool system to store the request using the settings that go with the default printer.
To include the function module into your program, use
in the ABAP Editor.It is reasonable to call the function module GET_PRINT_PARAMETERS several times in succession. For example, you can use GET_PRINT_PARAMETERS at the beginning of the program to trigger a user dialog, prompting the user for the basic setting. You then use the export parameters OUT_PARAMETERS and OUT_ARCHIVE_PARAMETERS as import parameters for further calls of the function module, in which you modify certain parameters from within the program (for example, to print wide lists in landscape format and narrow lists in portrait format).