Show TOC

PRINT_TEXTLocate this document in the navigation structure

Use

Use this function module to prepare the text module specified in the parameters HEADER and LINES for an output device and to output it. The system takes the required style and form specifications from the fields TDSTYLE or TDFORM of the text header.

Use the parameter OPTIONS to set different formatting and printing options. You specify the options in a structure like ITCPO by entering the desired values. The user can change some of these options on the optional print parameter screen (parameter DIALOG). This print parameter screen also appears, if no or invalid values for the required print options are specified in the parameter OPTIONS or the user master record.

Before printing a text, you can display it on the screen in the print format (from within the program, use field TDPREVIEW in the parameter OPTIONS; or the user can explicitly call the function on the print control screen).

If the field TDFORMAT in the text header contains SPACE, the SAPscript composer prepares the text for output by calling the function module PRINT_TEXT_FORMAT_xxx, where xxx is the contents of field TDFORMAT. This function module then calls the word processing program designed for that text format to prepare the text for printing. Which of the parameters passed with PRINT_TEXT the system evaluates, depends on this interface module and the called word processing program.

Function call:

CALL FUNCTION 'PRINT_TEXT'
        EXPORTING
                HEADER          = ?...
                DEVICE          = 'PRINTER'
                DIALOG          = 'X'
                OPTIONS         = SPACE
                APPLICATION     = 'TX'
                ARCHIVE_INDEX   = SPACE
                ARCHIVE_PARAMS  = SPACE
        IMPORTING
                RESULT          =
                NEW_ARCHIVE_PARAMS =
                TABLES LINES    = ?...
                OTFDATA         = ?...
        EXCEPTIONS
                CANCELED        =
                DEVICE          =
                FORM            =
                OPTIONS         =
                UNCLOSED        =
                UNKNOWN         =
                FORMAT          =
                TEXTFORMAT      =
                COMMUNICATION   =
            

Export parameters:

HEADER

The parameter contains the header of the text module which you want to prepare for printing. For the formatting process, the system uses only the entries in the header fields TDSTYLE and TDFORM.

Structure: THEAD

DEVICE

SAPscript can format a text for output on different device types. Enter the desired device type here.

Possible values:

  • 'PRINTER' print output

  • 'TELEX' Telex output

  • 'TELEFAX' Telefax output

  • 'ABAP' 'ABAP' screen output as ABAP list (interface of the calling program)

  • 'SCREEN' screen output as ABAP list

    (interface controlled by SAPscript, can be set with parameter APPLICATION)

The user can display output formatted for PRINTER, TELEX, or TELEFAX as print view on the screen. From within the program, you can set the field TDPREVIEW in the parameter OPTIONS, or the user can call the function on the print control screen.

Default value: 'PRINTER'

DIALOG

Use parameter DIALOG to determine whether to display a dialog box before printing, in which the user can set several spool parameters for print formatting.

Possible values:

  • ' ' display no print parameter screen

  • 'X' Display print parameter screen

Default value: 'X'

OPTIONS

Use parameter OPTIONS to set different options for print formatting. The parameter has the structure ITCPO. The user can change some of the defined settings on the print control screen.

Structure: ITCPO

Default value: SPACE

APPLICATION

For the device type SCREEN, the system displays the text formatting on the screen. This requires an interface in which the different menu entries are defined. The same applies if the user chooses to display a print view on the screen for the other device types.

Enter one of the interface names provided by SAPscript. You usually use the interface that is assigned to the respective text object in table TTXOB.

Reference field: TTXOB-TDAPPL

Default value: 'TX'

ARCHIVE_INDEX

Enter index information for the print output you want to archive. The system stores this information (DARA line) together with the print output in the archive. Thus, you can use the index information to access the print output directly in the archive.

Structure: TOA_DARA

Default value: SPACE

ARCHIVE_PARAMS

The system interprets the settings passed in this parameter when archiving the output. The archive parameters have the ABAP Dictionary structure ARC_PARAMS.

Structure: ARC_PARAMS

Default value: SPACE

Import parameter:

RESULT

The parameter contains results of the print formatting process. By comparing the corresponding fields of parameter OPTIONS with those of parameter RESULT, you can determine whether the user made changes to any settings on the print control screen.

Structure: ITCPP

NEW_ARCHIVE_PARAMS

The parameter contains results of the archiving process, including the archive parameters the user changed on the print control screen. The parameter has the ABAP Dictionary structure ARC_PARAMS.

Structure: ARC_PARAMS

Table parameters:

LINES

Enter the name of the table that contains the text lines you want to print.

Structure: TLINE

OTFDATA

If in the parameter OPTIONS the field TDGETOTF contains 'X', the system returns the formatted output in the OTF format in the optional table parameter OTFDATA.

In this case spool or printer output, screen display, or fax/telex/teletex output is not carried out.

Structure: ITCOO

Exceptions:

CANCELED

When starting SAPscript print formatting, the system displayed a selection screen, on which the user can enter settings for the output, such as:

  • Defining the printer name

  • Information on the cover page

  • Page Selection

  • Number of copies

  • etc.

The user did not call any subsequent actions allowed on this screen, but canceled the output formatting instead. The function module was ended without further action. No form is open for output anymore.

DEVICE

An invalid device type was specified in the parameter DEVICE.

FORM

The parameter FORM contains the name of a form which could not be found.

Possible causes:

  • The form does not exist.

  • There is no active version of this form.

SAPscript first searches for the form in the current client and in the specified language. If the form does not exist there, it tries the original language of the form. If the form is still not found, it searches in client 0, first in the specified language, than in the original form language.

FORMAT

Within a print output defined between OPEN_FORM and CLOSE_FORM, you must use forms of the same page format. The page format of the current form differs from that of the previously called forms.

Include only those forms into one spool request that have the same format (for example, DINA4). Page orientation is of no consequence; that means, you can mix pages in landscape and portrait format.

OPTIONS

The parameter OPTIONS contains invalid values for the formatting options.

Possible errors:

  • The output device specified in field TDDEST does not exist.

  • The field TDPAGESLCT for selecting the pages to be printed contains invalid characters.

UNCLOSED

You tried to open a new form although an form is active. The old form must be closed first (CLOSE_FORM or END_FORM).

TEXTFORMAT

The text lines passed to the function module are available in a format which cannot be processed in the current environment. The format is stored in the text header in the field TDTEXTTYPE.

Possible reasons for this exception can be:

  • The text format is not supported.

  • The text format cannot be processed on the current frontend since the word processor required is not installed.

  • The text format cannot be processed under batch input conditions since the word processing program involved does not have batch input capability.

  • The text format cannot be processed in the background since the word processing program involved cannot be initiated from background processes.

  • etc.

COMMUNICATION

The field TDTEXTTYPE of the text header is not empty, that is, it contains a text format which requires an external word processing program to be called. An error occurred when this word processor was called.

Possible causes:

  • The external word processor is not installed or is incorrectly installed on the frontend.

  • The word processor could not be started.

  • An error occurred during communication with the word processor.

  • An error occurred during transmission of the text data.

  • etc.

When processing texts in a non-SAPscript format, the system internally calls the function modules EDIT_TEXT_FORMAT_xxx or PRINT_TEXT_FORMAT_xxx, where xxx is the contents of field TDTEXTTYPE. These function modules ended with the exception COMMUNICATION. SAPscript passes this message to the print program without any further analysis.

UNKNOWN

An unknown error occurred. This exception is used only by the function module PRINT_TEXT, which, at former releases, passed all errors using this one exception. In the meantime, the exceptions of PRINT_TEXT were enhanced, so that the relevant error messages are covered by the module's own exceptions.