Referring to Texts
You use text references, if you also want to refer to the allocated application object. You use this procedure, for example, when creating an order and a similar order already exists, part of whose data you can reuse.
You refer to texts from within the program; that is, to establish a text reference the application program must call the SAPscript function module REFER_TEXT. A text that refers to another text module may itself not contain any further text lines. The reference is established by storing the referred text in the fields TDREFOBJ, TDREFNAME, and TDREFID of the text header of the current text. The system automatically sets the language of the referred text to the language of the current text.
For text references, the system stores only the text header. The text lines are filled when the system reads the reference text. A reference can extend over several levels, that is, a referred text can itself refer to another text. In this case, when reading the texts, the system works through the entire reference chain and uses the text lines of the text at the end of the chain.
For text references, there are no restrictions concerning the text object, text ID or text name. The application program that establishes the reference must make sure that it refers to the correct texts. SAPscript does not execute an authorization check.
As for including texts, for printing or displaying the reference text in the editor the system always uses the current text version. In contrast to INCLUDE texts, the SAPscript editor displays all lines of the referred text. However, the text area in the editor is input-disabled, so that you can neither change the text nor insert other text lines. If you want to change the text, you must first unlock it. In the editor choose Text → Unlock. The system then resolves the reference and copies the lines, as for including, into the current text module. The text lines of the editor are now input-enabled, but there is no more link to the original reference text.
If you want to resolve a reference from within the program, you must first make sure that the text lines of the reference text are stored in the corresponding lines table. Then simply delete the fields TDREFOBJ, TDREFNAME, and TDREFID in the text header.
If a reference text no longer exists, the system ends the corresponding function module, for example, READ_TEXT with the exception REFERENCE_CHECK. The SAPscript composer ignores missing reference texts when formatting a text for printing.