Skip to content

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 →  Examples of string templates 

String Templates, Control Characters

The example demonstrates the formatting of a text using control characters.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA: text       TYPE REF TO cl_demo_text,
          text_table TYPE cl_demo_text=>t_text,
          text_line  TYPE cl_demo_text=>t_line.

    text = cl_demo_text=>get_handle( ).

    text_line =
      |First line.\r\ttab\ttab\ttab\n\ttab\ttab\ttab\rLast line.|.

    text->add_line( text_line ).
    text->display( ).

Description

A string template with literal text and control character is passed to an object of the class CL_DEMO_TEXT and displayed. The text output is formatted with line breaks and tabulators.