SAP SCRIPT 12

special character

Use this format to output a character that you cannot enter via the keyboard. Replace 'x' with the number of the SAP character. All characters valid in the SAP system have a unique number. However, you can print or display this character only, if it is defined in the system character set and if the character set of the corresponding output device also contains it.

Variables (or symbols) are placeholders for values that you set at the moment of actually formatting the text for output. To recognize variables, they must have a certain structure:

• Variables must be included in & characters.
• The variable name must not contain blanks.
• The entire variable must fit into the field TDLINE.


Example: Create work areas in the program

To define the work area for the text header, use a structure like THEAD:

DATA LIKE THEAD.

To define the work area of the lines table, use an internal table with the line structure TLINE:

DATA LIKE TLINE OCCURS WITH HEADER LINE.

You can use the above short forms for declaring work areas only, if you use release 3.0 or higher. They have the same effects as


DATA BEGIN OF .
INCLUDE STRUCTURE THEAD.
DATA END OF .
or
DATA BEGIN OF OCCURS .
INCLUDE STRUCTURE TLINE.
DATA END OF .

SAPSCRIPTS IN DETAIL

This section offers further details on some SAPscript areas. Besides a list of the control tables used, more information on how to control the printout and the editor is provided.
Integrate word processing into application programs
SAPscript control tables and structures
Control print output
Editor control

INTEGRATED WORD PROCESSING INTO APPLICATION PROGRAMS

This section deals with the explicit integration of word processing into application programs. Examples are used to clarify the explanations. Special tips may help you with problems.

Read texts
Save texts
Delete texts
Call the editor
Find texts
Copy texts
Insert text lines into application screens
Insert other texts
Process texts from within programs
Convert SAPscript texts
Consistency checks
Print texts

READ TEXTS

You can process texts only if they are stored in the internal work areas of the program. Therefore, you must first transfer a text into the work areas.
To transfer the text header of a text into the specified structure and the text lines into the specified lines table, use the function module READ_TEXT.


Usually, the system reads a text from the text file. However, for texts with storage in the update task, the system first looks into the text memory to see whether it contains a currently processed version. If so, the system reads this version of the text into the work area, otherwise the text version from the text file.


To read a text version stored in the archive, use the parameter ARCHIVE_HANDLE.


If the desired text does not exist, READ_TEXT ends with the exception NOT_FOUND. The contents of the work areas for text header and text lines are then undefined. To be able to use these work areas for another text, you must first initialize them with INIT_TEXT.


The function module READ_TEXT also handles text references. It reads the reference chain to its end and supplies the text lines of this text in the lines table as well.

SAVE TEXTS

To re-transfer texts from the internal work areas to the text file, use the function module SAVE_TEXT.
The application program does not know whether the text is new or a changed version of an existing text. To be able to find this out, the program must read the text file first.


If a text exists, the transferred text lines overwrite the old version. If it does not exist, the system creates it. If you know from the beginning that the text is new, you can suppress this read process using the parameter INSERT and thus improve performance.


A text you want to store in the text file must consist of at least one line whose paragraph format or line contents is unequal to SPACE. Otherwise the system automatically deletes this text from the text file.
Changes to the text file are valid at once if the text object of the text is set to direct storage. If it is set to storage in updat task, the text changes are temporarily stored in the text memory. The function module COMMIT_WORK then transfers them to the log file, from where they are updated with the next COMMIT WORK.


The function module SAVE_TEXT can handle only texts that are eventually stored in the text file, that is, text with storage mode 'D' or 'V'.

DELETE TEXTS

To explicitly delete texts from the text file, use DELETE_TEXT and specify the key of the desired text. You must not read the text first.


With DELETE_TEXT, you can specify the text name, text ID, and text language generically as well. This allows you to delete, for example, all texts belonging to an application object, in one call.

Delete all texts with company code 0001 for customer 4711.


CALL FUNCTION 'DELETE_TEXT'
EXPORTING OBJECT = 'KNB1'
NAME = '00000047110001'
ID = '*'
LANGUAGE = '*'.

Delete all company code-related texts of customer 4711.
CALL FUNCTION 'DELETE_TEXT'
EXPORTING OBJECT = 'KNB1'
NAME = '0000004711*'
ID = '*'
LANGUAGE = '*'.

The texts are deleted from the text file immediately, if the text object of the text(s) is set to direct storage. If it is set to storage in update task, the deletion request is stored in the text memory first. The function module COMMIT_WORK then transfers the request to the log file, from where it is executed with the next COMMIT WORK.


The function module DELETE_TEXT can handle only texts that are stored in the text file, that is, text with storage mode 'D' or 'V'.

CALL THE EDITOR

Use the function module EDIT_TEXT to branch to a (fullscreen) text editor that allows you to edit the transferred text. Depending on the text format in the text header (TDTEXTTYPE), the system calls the corresponding editor. If the format field is empty, it calls the SAPscript editor. Otherwise it internally calls the function module EDIT_TEXT_FORMAT_xxx, which is responsible for establishing the link to the text editor that can process texts in the format xxx.


The SAPscript editor offers several functions.
The editor interface, that is, the activated functions in the editor menus, are determined by the text interface allocated to the text object in table TTXOB. In addition, you can set certain attributes of the interface using the parameters CONTROL, DISPLAY, and EDITOR_TITLE when calling the function module EDIT_TEXT.

Call the editor without navigation

If you want to edit only one text in the editor, you should specify the interface TN for the corresponding text object in table TTXOB. After editing the text, you leave the editor and return to the application screen.

Call the editor with navigation

If you want to select several texts from the application screen and must, therefore, navigate in the text editor in this selection list, you must use the interface TA. This interface offers the functions Next text and Previous text in the Goto menu.

You can use them to move among the selected texts without having to leave the editor.
From within the program, you must call the function module in a loop. After editing one text, you end the function module and return to the calling program.

The program decides, depending on the parameter RESULT, field USEREXIT, which function the user used to leave the text editor, and then, depending on that function, either calls the text editor with another text or leaves the loop.
How to proceed:

1. Provide the desired text of the selection list by placing the text header and the text lines into the appropriate work areas.
2. Use the parameter CONTROL to specify which function Next text or Previous text you want to activate:

APP_NEXT = 'X', if the text passed for the subsequent editor call is not the last text in the selection list,
APP_PREV = 'X', if the text passed for the subsequent editor call is not the first in the selection list.

3. Call the text editor.
4. Check the return parameter RESULT, field USEREXIT to determine the next step:

- Go to the beginning of the loop if the value of the field is either 'N' (Next text) or 'P' (Previous text).
- Otherwise leave the loop.




RELATED POSTS

SAP SCRIPTS PART 13
CRM Middle ware System Architecture
CRM Middle ware Enhancement
CRM Middle ware Data Flow

No comments :

Post a Comment