Start of Content Area

PRINT_TEXT   Locate the document in its SAP Library structure

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 finally evaluates, depends on the interface function module and on the 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 print formatting, the system uses only the contents of the fields TDSTYLE and TDFORM of the header.

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' 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 several 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 the index information for the print output you want to archive. This information (DARA line) is stored in the archive together with the print output. 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 parameters:

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 table that contains the text lines you want to print.

Structure: TLINE

OTFDATA

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

In this case, the system does not output the text on printer, screen or fax/telex/teletex devices.

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:

  • Printer name
  • Information on the cover page
  • Page selection
  • Number of copies

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

DEVICE

The parameter DEVICE contains an invalid device type.

FORM

The parameter FORM contains the name of a form that the system could not find.

Possible reasons:

  • 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

The system was told to open a new form even though an old form is still active. The old form must be closed first (CLOSE_FORM or END_FORM).

TEXTFORMAT

The text lines passed to the function module have a format that cannot be processed by the current environment. The format is stored in the text header in the field TDTEXTTYPE.

Possible reasons:

  • The text format is not supported.
  • The text format cannot be processed on the current front-end, since the required word processing program is not installed.
  • The text format cannot be processed under batch input conditions, since the required word processing program cannot be used for batch input.
  • The text format cannot be used in background processing, since the required word processing program cannot be called from within background processes.

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. When calling this program, an error occurred.

Possible reasons:

  • The external word processing program is not or not correctly installed on the front-end.
  • Word processing could not be started.
  • During communication with this word processing program, an error occurred.
  • During text data transfer, an error occurred.

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.