ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Character String and Byte String Processing → Expressions and Functions for String Processing → string_exp - String Expressions → string_exp - String Templates
String Templates - control_characters
Other versions: 7.31 | 7.40 | 7.54
Syntax
... \n ... \r ... \t ...
Effect
String templates interpret the character combinations \n
, \r
, and \t
as control characters.
Control Character | Meaning | Hexadecimal value (UTF-8) |
---|---|---|
\n |
Line break | 0A |
\r |
Return | 0D |
\t |
Tabulator | 09 |
A control character is replaced by its hexadecimal value (appropriate to the current code page) in the memory of the character string created by the string template.
Notes
- If a control character is to be displayed as literal text, it can be escaped by being prefixed with the escape character
\
.
- The control characters in string templates replace the use of some attributes of the class CL_ABAP_CHAR_UTILITIES.
- The control characters have no effect on classical dynpros and lists. They appear in a list output as the # character. However, you can see the effect in the textedit control, for example.
Example
The following example generates in code
the representation of the results
of a string template with the three possible control characters in the code page UTF-8, namely
0A0D09. The hexadecimal values 0A, 0D , and 09 stand for line break, return, and tabulator.
DATA(code) =
cl_abap_conv_codepage=>create_out( )->convert( |\n\r\t| ).
Example
The following example generates a three-row output in the textedit control.
cl_demo_text=>display_string( |1\n2\n3| ).