Variante 1 (cl_gui_dialogbox_container)
DATA: o_cnt TYPE REF TO cl_gui_dialogbox_container.
DATA: o_edit TYPE REF TO cl_gui_textedit.
DATA: it_editor TYPE STANDARD TABLE OF char1024.
CLASS lcl_events DEFINITION.
PUBLIC SECTION.
CLASS-METHODS on_close FOR EVENT close OF cl_gui_dialogbox_container
IMPORTING sender.
ENDCLASS.
CLASS lcl_events IMPLEMENTATION.
* Event, wenn auf das Schließen-Kreuz geklickt wird
METHOD on_close.
IF NOT o_edit IS INITIAL.
* vor dem Schließen Text aus dem Editor holen
o_edit->get_text_as_stream( IMPORTING text = it_editor ).
sender->free( ).
ENDIF.
ENDMETHOD.
ENDCLASS.
* Button Pos 2 Länge 20, sendet Kommando 'CMD_SHOW'
SELECTION-SCREEN: PUSHBUTTON 2(20) btn1 USER-COMMAND cmd_show.
INITIALIZATION.
* Button-Text setzen
btn1 = |{ icon_activity }Popup anzeigen|.
AT SELECTION-SCREEN.
* wenn Button-Kommando 'CMD_SHOW'
IF sy-ucomm = 'CMD_SHOW'.
o_cnt = NEW #( no_autodef_progid_dynnr = abap_true
caption = 'Texteditor'
top = 100
left = 200
width = 640
height = 240 ).
* on_close Handler setzen
SET HANDLER lcl_events=>on_close FOR o_cnt.
* neues Editorobjekt erzeugen (überschreibt vorherige Referenz!)
o_edit = NEW #( wordwrap_mode = cl_gui_textedit=>wordwrap_at_windowborder
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
parent = o_cnt ).
* feste Zeichenbreite
o_edit->set_font_fixed( mode = cl_gui_textedit=>true ).
ENDIF.
START-OF-SELECTION.
LOOP AT it_editor ASSIGNING FIELD-SYMBOL(<l>).
WRITE: / <l>.
ENDLOOP.
Variante 2 (SELECTION-SCREEN)
DATA: it_editor TYPE STANDARD TABLE OF char1024.
* Button Pos 2 Länge 20, sendet Kommando 'CMD_SHOW'
SELECTION-SCREEN: PUSHBUTTON 2(20) btn1 USER-COMMAND cmd_show.
* Popup-Fenster (Selektionsbild 100) deklarieren
SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE title.
SELECTION-SCREEN END OF SCREEN 100.
INITIALIZATION.
* Fenstertitel
title = 'Texteditor'.
* Button-Text setzen
btn1 = |{ icon_activity }Popup anzeigen|.
AT SELECTION-SCREEN.
* wenn Button-Kommando 'CMD_SHOW'
IF sy-ucomm = 'CMD_SHOW'.
* cl_gui_container=>screen1 == SELECTION-SCREEN 100
DATA(o_edit) = NEW cl_gui_textedit( wordwrap_mode = cl_gui_textedit=>wordwrap_at_windowborder
wordwrap_to_linebreak_mode = cl_gui_textedit=>true
parent = cl_gui_container=>screen1 ).
* feste Zeichenbreite
o_edit->set_font_fixed( mode = cl_gui_textedit=>true ).
* Popup-Fenster (Selektionsbild 100) anzeigen -> cl_gui_container=>screen1 wird erzeugt
CALL SELECTION-SCREEN 100 STARTING AT 10 5 ENDING AT 100 20.
* Text aus dem Editor holen
o_edit->get_text_as_stream( IMPORTING text = it_editor ).
* Editorobjekt freigeben
FREE: o_edit.
ENDIF.
START-OF-SELECTION.
LOOP AT it_editor ASSIGNING FIELD-SYMBOL(<l>).
WRITE: / <l>.
ENDLOOP.