Start of Content Area

REFER_TEXT   Locate the document in its SAP Library structure

You can create SAPscript texts as references to the text lines of other text modules. In this case, the system does not store text lines but only the references to the other text module. Changes to the reference text now affect the calling text module as well. You can create a reference chain over several levels.

The text module specified in the header refers to 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.

Usually, you will refer to a text that exists in the database. The system can then return the text lines of the reference text in the LINES table using READ_LINES. If the text exists in the text memory only and has not yet been written to the database, you can create the reference but not use READ_LINES to read the text lines of the reference text.


REFER_TEXT does not trigger a SAVE_TEXT function call. To save a reference text, you must explicitly call SAVE_TEXT after executing REFER_TEXT.


Handling in the Editor

In the fullscreen editor, you cannot edit the text lines of the reference text read into table LINES. The editor can only display them. If you want to make changes, you must unlock the text in the editor. In this case, however, the connection to the original reference text is lost.

The user can resolve the connection to the reference text in the editor by choosing Text Unlock. 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:





REF_NAME = ?...

REF_ID = ?...








Export parameters:


Enter the text header of the text for which you want to create a reference to another text.

Structure: THEAD


The parameter contains the text object of the reference text.

Reference field: THEAD-TDOBJECT


Enter the name of the reference text.

Reference field: THEAD-TDNAME


REF_ID contains the ID of the reference text.

Reference field: THEAD-TDID


The parameter indicates whether you want the system to check the existence of the reference text.

Possible values:

' ' no check

'X' the system checks whether the reference text exists.

The system always executes the check if you want to read the lines of the reference text.

Default value: 'X'


Indicates whether to return the lines of the reference text in table LINES.

Possible values:

' ' do not read text lines

'X' read text lines

Default value: 'X'


Import parameters:


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:


The table contains the text lines of the reference text, provided the parameter READ_LINES has the value 'X'.

Structure: TLINE




The system did not find the specified text module.


The text module to be read has no text lines of its own but refers to the lines of another text module. This reference chain can include 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.