SAP FORMAT_TEXTLINES Function Module for SAPscript: Format Text Lines
FORMAT_TEXTLINES is a standard format textlines 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: Format Text Lines 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 format textlines FM, simply by entering the name FORMAT_TEXTLINES into the relevant SAP transaction such as SE37 or SE38.
Function Group: STXL
Program Name: SAPLSTXL
Main Program: SAPLSTXL
Appliation area: S
Release date: 01-Jan-1970
Mode(Normal, Remote etc): Normal Function Module
Update:

Function FORMAT_TEXTLINES 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 'FORMAT_TEXTLINES'"SAPscript: Format Text Lines.
EXPORTING
* CURSOR_COLUMN = 0 "
* CURSOR_LINE = 0 "
* ENDLINE = 99999 "
* FORMATWIDTH = 72 "
* LINEWIDTH = 132 "
* STARTLINE = 1 "
* LANGUAGE = SY-LANGU "Language
IMPORTING
NEW_CURSOR_COLUMN = "
NEW_CURSOR_LINE = "
TABLES
LINES = "
EXCEPTIONS
BOUND_ERROR = 1
IMPORTING Parameters details for FORMAT_TEXTLINES
CURSOR_COLUMN -
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
CURSOR_LINE -
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
ENDLINE -
Data type:Default: 99999
Optional: Yes
Call by Reference: No ( called with pass by value option)
FORMATWIDTH -
Data type:Default: 72
Optional: Yes
Call by Reference: No ( called with pass by value option)
LINEWIDTH -
Data type:Default: 132
Optional: Yes
Call by Reference: No ( called with pass by value option)
STARTLINE -
Data type:Default: 1
Optional: Yes
Call by Reference: No ( called with pass by value option)
LANGUAGE - Language
Data type: SY-LANGUDefault: SY-LANGU
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for FORMAT_TEXTLINES
NEW_CURSOR_COLUMN -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NEW_CURSOR_LINE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for FORMAT_TEXTLINES
LINES -
Data type: TLINEOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
BOUND_ERROR -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for FORMAT_TEXTLINES 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_bound_error | TYPE TLINE, " | |||
| lv_cursor_column | TYPE TLINE, " 0 | |||
| lv_new_cursor_column | TYPE TLINE, " | |||
| lv_cursor_line | TYPE TLINE, " 0 | |||
| lv_new_cursor_line | TYPE TLINE, " | |||
| lv_endline | TYPE TLINE, " 99999 | |||
| lv_formatwidth | TYPE TLINE, " 72 | |||
| lv_linewidth | TYPE TLINE, " 132 | |||
| lv_startline | TYPE TLINE, " 1 | |||
| lv_language | TYPE SY-LANGU. " SY-LANGU |
|   CALL FUNCTION 'FORMAT_TEXTLINES' "SAPscript: Format Text Lines |
| EXPORTING | ||
| CURSOR_COLUMN | = lv_cursor_column | |
| CURSOR_LINE | = lv_cursor_line | |
| ENDLINE | = lv_endline | |
| FORMATWIDTH | = lv_formatwidth | |
| LINEWIDTH | = lv_linewidth | |
| STARTLINE | = lv_startline | |
| LANGUAGE | = lv_language | |
| IMPORTING | ||
| NEW_CURSOR_COLUMN | = lv_new_cursor_column | |
| NEW_CURSOR_LINE | = lv_new_cursor_line | |
| TABLES | ||
| LINES | = lt_lines | |
| EXCEPTIONS | ||
| BOUND_ERROR = 1 | ||
| . " FORMAT_TEXTLINES | ||
ABAP code using 7.40 inline data declarations to call FM FORMAT_TEXTLINES
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_endline) | = 99999. | |||
| DATA(ld_formatwidth) | = 72. | |||
| DATA(ld_linewidth) | = 132. | |||
| DATA(ld_startline) | = 1. | |||
| "SELECT single LANGU FROM SY INTO @DATA(ld_language). | ||||
| DATA(ld_language) | = SY-LANGU. | |||
Search for further information about these or an SAP related objects