You can switch layout sets within one print request. This may be necessary if, depending on the recipient, the output language changes or if, depending on the country, a different layout set layout is required.
You proceed as you would for starting a layout set again. However, when calling the function module START_FORM, you specify the name of the new layout set.
When switching layout sets, make sure that you use only those layout sets that have the same page format (for example, only DINA4 or only LETTER). However, you can easily mix layout sets with different page orientations (landscape or portrait format).


If SAPscript does not find the specified layout set, it automatically searches for another version of the same layout set. SAPscript proceeds as follows:

The SAPscript layout set processor can use generated layout sets only. It executes cross-client search only if the current client does not contain a generated version of the layout set. If during the search it finds a layout set in another client, it generates the layout set and stores it in the client from which the search started. If the layout set is started again, the composer finds it in the current client.
If you use layout sets delivered by SAP without any modifications, you need not copy these into your production client. SAPscript automatically searches for a layout set in client 0 if it does not exist in the current client. It then stores the generated version of the layout set in the production client. If you modify SAP layout sets, this modification always takes place in a client > 0. Thus, the original SAP version of the layout set is preserved in the client 0.


Text lines

To pass the text lines of a text to the output layout set, use the function module WRITE_FORM_LINES. You must include the text header. However, the SAPscript composer evaluates only the field containing the style (TDSTYLE). If it contains a style, SAPscript uses the layout specifications for paragraph and character formats of this style. If no style is specified, it formats the text according to the paragraph and character formats specified in the layout set. Paragraph formats that do not exist in the layout set are replaced by the valid default paragraph formats.
With WRITE_FORM_LINES, you can pass only texts in the SAPscript ITF format. The system does not accept text lines in other formats (field TDTEXTTYPE in the text header > SPACE). In the latter case, the system leaves the function module without further notice.

Text elements

To call text elements defined in the currently open layout set, use the function module WRITE_FORM, specifying the name of the desired text element.

Output to the BODY area of the main window
Output to a window of type VAR or CONST
Output to the TOP or BOTTOM areas of the main window
Call control statements

Output to the BODY area of the main window

If you omit the parameter WINDOW in the function calls for WRITE_FORM and WRITE_FORM_LINES, the system directs all output to the main window of the layout set. It immediately formats the the passed text or the desired text element and places them into the output queue. Once formatted output lines are in the output queue, you cannot delete them anymore.
The system ignores any entries for the parameter FUNCTION, that is, evaluates them as APPEND.

Output to a window of type VAR or CONST

If you want to write output to another window that the main window, you must use the parameter WINDOW to specify the name of that window. The window need not be defined on the current page.
All other window are processed after the main window. The system first gathers all output directed to them. It stores the text lines to be output in the ITF format; it does not format them at the moment when the function modules WRITE_FORM or WRITE_FORM_LINES are called. Only if the main window triggers a page break does the system format the texts in the other windows and places them in the output queue. This is of special importance when you use variables. They are replaced with the values valid after processing the main window.
The texts gathered for these windows are output again whenever the corresponding window reappears on a subsequent layout set page. To modify the text contents, you must set the appropriate values of the parameter FUNCTION:


Deletes all text lines placed into the window. The system stores the text lines or text element lines passed with the current call for future calls of the window.


The old window contents remain. New text lines are appended. APPEND is the default value of parameter FUNCTION.


You can use this function with WRITE_FORM only. It deletes the text element placed into this window using SET or APPEND.

You cannot delete text lines placed into the window using WRITE_FORM_LINES. To delete these lines, you must first delete the entire window contents using SET, and then write the required texts again.

Output to the TOP or BOTTOM areas of the main window

To write output into the TOP or BOTTOM areas of the main window, set the parameter TYPE to TOP or BOTTOM. You can use this parameter with WRITE_FORM and WRITE_FORM_LINES. As for all output to windows other than MAIN, you can use the parameter FUNCTION to control further text processing.

SET All lines of the TOP or BOTTOM area are replaced with the text lines or text element lines passed with this call.
APPEND The old contents of the TOP or BOTTOM area remain; the new text lines are appended. The value APPEND is the default for the parameter FUNCTION.
DELETE You can use this function with WRITE_FORM only. It deletes the text element placed in the TOP or BOTTOM area using SET or APPEND.
You cannot delete text lines placed into the window using WRITE_FORM_LINES. To delete these lines, you must first delete the entire TOP or BOTTOM area using SET, and then write the required texts again.


To pass control statements, such as an unconditional page break, use function module CONTROL_FORM. Control statements are always directed to the main window of the layout set, where the system interprets and executes them immediately.


This section explains about the most important structures and interdependencies of the programming interface to word processing. This part of the documentation is designed mainly for developers, administrators, and consultants, who have gathered some knowledge working with SAPscript and want to integrate their own applications according to their requirements.

Structure of texts
Grouping texts
Attributes of texts
Structure of the text key
Store text components
SAPscript data formats
Authorization checks
Store texts
Text memory
Work areas for texts

The topic below describes the most important steps of integrating SAPscript into an application program, using graphics and examples for better understanding.
This topic is partly based on information given in previous topics. Therefore, it is advisable to read the SAPscript documentation consecutively from the beginning.

SAPscript in Detail
SAPscript Function Modules


A SAPscript text module is an object constructed from an administrative information component--the text header--and a table that contains the actual text lines. With many function modules of the SAPscript programming interface, you must specify both components. It makes no difference whether you store the texts with SAPscript or whether you use other text files.
Text header
Text lines


The text header is a structure. It contains administrative information such as:

• Title of the text module
• Creation data (date, time, creator)
• Change information (date, time, user who made last change)
• Allocated style and/or allocated layout set
• Text format


The lines of a text are stored in an internal table. Each line consists of a format field and a field with the actual line contents. The contents of these fields is determined by the text format specified in the field TDTEXTTYPE of the text header. Texts may have SAPscript format as well as other formats (for example, WinWord DOC or RTF format).

• SAPscript format (ITF format)

A text has SAPscript format if the field TDTEXTTYPE is empty. The texts are stored in the line table exactly as they appear in the SAPscript text editor. This SAPscript format is called ITF format. It consists only of those system characters that can be displayed on the screen and does not contain any hexadecimal codes to control formatting.
The two-character format field specifies the paragraph type for the subsequent text line. The possible paragraph formats as well as the underlying formatting options are defined in the style or layout set. Special paragraph formats determine whether the line contents are SAPscript control statements or, for example, comment lines. These paragraph formats are valid for all text modules. The text line field contains either text or a SAPscript statement, if it is a command line.
The ITF format is no final format; that means, you need the SAPscript composer to create the output format (OTF format) using the layout definitions of the style and the layout set.

• Non-SAPscript formats

You can use SAPscript to maintain texts that have a format SAPscript cannot process. The field TDTEXTTYPE in the header of these texts then specifies the respective text format. The text lines of these tests are nevertheless stored in an internal table, which has the structure TLINE. The structure of the individual text lines depends on the respective format. To pass texts in a non-SAPscript format, you can use only the following SAPscript function modules:


You cannot mix texts in SAPscript format with texts in another format. This results in restrictions for using texts in other formats:

• You cannot output non-SAPscript texts in SAPscript layout sets.
• You cannot INCLUDE them in SAPscript texts.
• Variables in the SAPscript syntax are not replaced in these texts.
• All editing functions that depend on an interpretation of the text format cannot be used with these text modules:

- ...

SAPscript does not interpret the contents of the text line table, but passes the table to the corresponding word processing program, which is designed to process the respective text format. The transfer happens automatically due to the function modules EDIT_TEXT or PRINT_TEXT, which internally call the function modules EDIT_TEXT_FORMAT_xxx or PRINT_TEXT_FORMAT_xxx (xxx = contents of field TDTEXTTYPE). These function modules provide the connection to the corresponding word processing programs.



No comments :

Post a Comment