SAP TEXT_INCLUDE_REPLACE Function Module for SAPscript: Expand INCLUDEs in text
TEXT_INCLUDE_REPLACE is a standard text include replace SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for SAPscript: Expand INCLUDEs in text processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for text include replace FM, simply by entering the name TEXT_INCLUDE_REPLACE into the relevant SAP transaction such as SE37 or SE38.
Function Group: STXE
Program Name: SAPLSTXE
Main Program: SAPLSTXE
Appliation area:
Release date: 16-Jan-1995
Mode(Normal, Remote etc): Normal Function Module
Update:

Function TEXT_INCLUDE_REPLACE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'TEXT_INCLUDE_REPLACE'"SAPscript: Expand INCLUDEs in text.
EXPORTING
* ALL_LEVEL = 'X' "Expand nested INCLUDES
* ENDLINE = 99999 "End line for INCLUDE replacement
HEADER = "Text header
* STARTLINE = 1 "Start line for INCLUDE replacement
* PROGRAM = ' ' "Program name for symbol replacement
IMPORTING
CHANGED = "Indicator if text was changed
ERROR_TYPE = "Error type
NEWHEADER = "Text header (new)
TABLES
LINES = "Text lines
IMPORTING Parameters details for TEXT_INCLUDE_REPLACE
ALL_LEVEL - Expand nested INCLUDES
Data type:Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
ENDLINE - End line for INCLUDE replacement
Data type: SY-TABIXDefault: 99999
Optional: Yes
Call by Reference: No ( called with pass by value option)
HEADER - Text header
Data type: THEADOptional: No
Call by Reference: No ( called with pass by value option)
STARTLINE - Start line for INCLUDE replacement
Data type: SY-TABIXDefault: 1
Optional: Yes
Call by Reference: No ( called with pass by value option)
PROGRAM - Program name for symbol replacement
Data type: SY-REPIDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for TEXT_INCLUDE_REPLACE
CHANGED - Indicator if text was changed
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ERROR_TYPE - Error type
Data type: SY-TABIXOptional: No
Call by Reference: No ( called with pass by value option)
NEWHEADER - Text header (new)
Data type: THEADOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for TEXT_INCLUDE_REPLACE
LINES - Text lines
Data type: TLINEOptional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for TEXT_INCLUDE_REPLACE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lt_lines | TYPE STANDARD TABLE OF TLINE, " | |||
| lv_changed | TYPE TLINE, " | |||
| lv_all_level | TYPE TLINE, " 'X' | |||
| lv_endline | TYPE SY-TABIX, " 99999 | |||
| lv_error_type | TYPE SY-TABIX, " | |||
| lv_header | TYPE THEAD, " | |||
| lv_newheader | TYPE THEAD, " | |||
| lv_startline | TYPE SY-TABIX, " 1 | |||
| lv_program | TYPE SY-REPID. " SPACE |
|   CALL FUNCTION 'TEXT_INCLUDE_REPLACE' "SAPscript: Expand INCLUDEs in text |
| EXPORTING | ||
| ALL_LEVEL | = lv_all_level | |
| ENDLINE | = lv_endline | |
| HEADER | = lv_header | |
| STARTLINE | = lv_startline | |
| PROGRAM | = lv_program | |
| IMPORTING | ||
| CHANGED | = lv_changed | |
| ERROR_TYPE | = lv_error_type | |
| NEWHEADER | = lv_newheader | |
| TABLES | ||
| LINES | = lt_lines | |
| . " TEXT_INCLUDE_REPLACE | ||
ABAP code using 7.40 inline data declarations to call FM TEXT_INCLUDE_REPLACE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| DATA(ld_all_level) | = 'X'. | |||
| "SELECT single TABIX FROM SY INTO @DATA(ld_endline). | ||||
| DATA(ld_endline) | = 99999. | |||
| "SELECT single TABIX FROM SY INTO @DATA(ld_error_type). | ||||
| "SELECT single TABIX FROM SY INTO @DATA(ld_startline). | ||||
| DATA(ld_startline) | = 1. | |||
| "SELECT single REPID FROM SY INTO @DATA(ld_program). | ||||
| DATA(ld_program) | = ' '. | |||
Search for further information about these or an SAP related objects