Show TOC

Printing Lists from a Called ProgramLocate this document in the navigation structure

Use

To send the output of reports you call from within your program using SUBMIT to the spool system, you must use the SUBMIT statement with the TO SAP-SPOOL addition:

        


        
SUBMIT rep TO SAP-SPOOL
        
[params|SPOOL PARAMETERS pripar]
        
[ARCHIVE PARAMETERS arcpar]
        
[WITHOUT SPOOL DYNPRO].
        


        


        


        


        


         

The SUBMIT statement is described in detail in the section Calling Executable Programs . If you use the TO SAP-SPOOL option, the list is formatted for printing while it is being created, and then sent to the spool system. The remaining additions set the print parameters.

Setting the Print Parameters

To define the print parameters , proceed as described with the NEW-PAGE PRINT ON statement:

You may set each print parameter individually using one of the params additions (see keyword documentation) or use the SUBMIT statement to execute a user dialog; however, to determine the print parameters, use the function module GET_PRINT_PARAMETERS only. The function module GET_PRINT_PARAMETERS decouples the user dialog from the SUBMIT statement, and guarantees a complete parameter set even without executing the user dialog. To determine the parameters, use only the additions SPOOL PARAMETERS and ARCHIVE PARAMETERS and, to suppress the user dialog of the SUBMIT statement, use the WITHOUT SPOOL DYNPRO option.

The following executable program is connected to the logical database F1S.

          


          


          
REPORT sapmzts1.
          
TABLES spfli.
          
GET spfli.
          
NEW-LINE.
          
WRITE: spfli-mandt, spfli-carrid, spfli-connid,
          
spfli-cityfrom, spfli-airpfrom, spfli-cityto,
          
spfli-airpto, spfli-fltime, spfli-deptime, spfli-arrtime,
          
spfli-distance, spfli-distid, spfli-fltype.
            

The following program calls sapmzts1 and sends the output to the spool system:

          


          


          
REPORT demo_list_submit_to_spool NO STANDARD PAGE HEADING.
          
DATA: val(1) TYPE c,
          
pripar TYPE pri_params,
          
arcpar TYPE arc_params.
          
CALL FUNCTION 'GET_PRINT_PARAMETERS'
          
EXPORTING
          
layout = 'X_65_132'
          
line_count = 65
          
line_size = 132
          
IMPORTING
          
out_parameters = pripar
          
out_archive_parameters = arcpar
          
valid = val
          
EXCEPTIONS
          
archive_info_not_found = 1
          
invalid_print_params = 2
          
invalid_archive_params = 3
          
OTHERS = 4.
          
IF val <> space AND sy-subrc = 0.
          
SUBMIT demo_list_output TO SAP-SPOOL
          
SPOOL PARAMETERS pripar
          
ARCHIVE PARAMETERS arcpar
          
WITHOUT SPOOL DYNPRO.
          
ENDIF.
          


            

After starting the program, the function module GET_PRINT_PARAMETERS triggers a user dialog, displaying the area Output format of the Print List Output dialog window filled with the values from the import parameters:

After the user has entered and confirmed the print parameters, sapmzts1 is called. Here, the GET_PRINT_PARAMETERS export parameters are passed as print and archiving parameters. sapmzts1 does not create any screen display or user dialog. It sends the created list directly to the spool system. The user can view the stored spool request choosing Start of the navigation path System Next navigation step Services Next navigation step Print requests End of the navigation path. Using the output format specified above, the spool request may look like this: