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.

Caution

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:

 

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 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'

READ_LINES

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:

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 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.