
SAPscript texts can be created as a reference to the text lines in another text module. In this case, no text lines are saved, only a reference to the specified text module. Changes to the references text module then affect the calling text as well. This reference chain can extend over several levels.
The text module specified in the header is to reference another text module. This text is specified using the parameters REF_OBJECT, REF_NAME, and REF_ID. The language of the reference text is always the same as the language of the calling text.
The referenced usually exists already in the database. The text lines of the referenced text can then be returned using the parameter READ_LINES in the LINES table. If the text exists in the text memory, i.e. was not yet committed, the reference can be configured although the text lines of the referenced text cannot be imported using READ_LINES.
REFER_TEXT does not execute SAVE_TEXT. To save the reference text permanently, SAVE_TEXT must be called after REFER_TEXT.
Using the editor:
The lines of the referenced text module which are placed in the table LINES cannot be processed with the fullscreen editor; they are only displayed. If you wish to make changes, the text must be unlocked in the text editor. The reference to the originally referenced text module is then lost.
The user can resolve the connection to the reference text in the editor by choosing . The text lines are then ready for editing. However, any connection to the original reference text is lost.
To resolve the reference from within the program, simply delete the fields TDREFOBJ, TDREFNAME, and TDREFID in the text header.
Function call:
CALL FUNCTION 'REFER_TEXT'
EXPORTING
HEADER = ?...
REF_OBJECT = ?...
REF_NAME = ?...
REF_ID = ?...
CHECK_REFERENCE = 'X'
READ_LINES = 'X'
IMPORTING
NEWHEADER =
TABLES
LINES = ?...
EXCEPTIONS
NOT_FOUND =
REFERENCE_CHECK =
Export parameters:
|
HEADER |
Enter the text header of the text for which you want to create a reference to another text. Structure: THEAD |
|
REF_OBJECT |
The parameter contains the text object of the reference text. Reference field: THEAD-TDOBJECT |
|
REF_NAME |
Enter the name of the reference text. Reference field: THEAD-TDNAME |
|
REF_ID |
REF_ID contains the ID of the reference text. Reference field: THEAD-TDID |
|
CHECK_REFERENCE |
The parameter defines whether the existence of the referenced text module should be checked. Possible values:
The check is generally carried out when the lines of the referenced text are to be read. Default value: 'X' |
|
READ_LINES |
Indicates whether to return the lines of the reference text in table LINES. Possible values:
Default value: 'X' |
Import parameter:
|
NEWHEADER |
The field contains the modified header. The text header stores whether the text module refers to another text. Therefore, you must specify a corresponding structure; otherwise calling the function module REFER_TEXT has no effect. The structure is usually the same as the one used in the HEADER parameter. Structure: THEAD |
Table parameters:
|
LINES |
The table contains the text lines of the reference text, provided the parameter READ_LINES has the value 'X'. Structure: TLINE |
Exceptions:
|
NOT_FOUND |
The system did not find the specified text module. |
|
REFERENCE_CHECK |
The text module to be read does not have any text lines, but refers to the lines of another text module. This reference chain can have several levels. For the current text, the chain is interrupted, that is, one of the text modules referred to in the chain no longer exists. |