ABAP Keyword Documentation → ABAP - Reference → User Dialogs → Screens → Screen and Screen Elements → Screen Elements - Examples
Screens, Text output
The example illustrates the output of unformatted text.
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 of text'.
text->add_line( text_line ).
text->add_line( ' ' ).
DO 10 TIMES.
CLEAR text_line.
text_line(3) = sy-index.
text_line = |Table line { text_line }|.
APPEND text_line TO text_table.
ENDDO.
text->add_table( text_table ).
text->add_line( ' ' ).
text_line = 'Last line of text'.
text->add_line( text_line ).
text->display( ).
text->delete( ).
text->add_line( 'New text' ).
text->display( ).
Description
The program uses the methods of the class CL_DEMO_TEXT, which was designed for this purpose. The class encapsulates the usage of a Textedit Control in a dialog window.
Wrapper like this can replace the usage of the statement WRITE
for simple text outputs.