[ABAP] TextEdit Control (cl_gui_textedit) für Quellcodedarstellung in eigenem Dynpro anzeigen

DATA: ok_code TYPE sy-ucomm.
DATA: o_cont TYPE REF TO cl_gui_custom_container.
DATA: o_edit TYPE REF TO cl_gui_textedit.

START-OF-SELECTION.
  CALL SCREEN 100. " Screen 100 hat ein Custom-Control 'CNT_MAIN'

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'ST_100'.
  SET TITLEBAR 'ST_100_TITLE'.

  IF o_cont IS NOT BOUND.
    o_cont = NEW cl_gui_custom_container( container_name = 'CNT_MAIN' ).
  ENDIF.

  IF o_edit IS NOT BOUND.
    o_edit = NEW cl_gui_textedit( wordwrap_mode = cl_gui_textedit=>wordwrap_at_windowborder
                                  wordwrap_to_linebreak_mode = cl_gui_textedit=>true
                                  parent = o_cont ).
  ENDIF.

  IF o_cont IS BOUND AND o_edit IS BOUND.
* Text readonly
    o_edit->set_readonly_mode( readonly_mode = cl_gui_textedit=>true ).
* für Quellcodedarstellung z.B. Kommentare hervorheben
    o_edit->set_comments_string( comments_string = '*' ).
    o_edit->set_highlight_comments_mode( highlight_comments_mode = cl_gui_textedit=>true ).
* Anzeige von Toolbar und Statusbar des Texteditors unterdrücken
    " o_edit->set_toolbar_mode( toolbar_mode = cl_gui_textedit=>false ).
    " o_edit->set_statusbar_mode( statusbar_mode = cl_gui_textedit=>false ).
  ENDIF.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  CASE ok_code.
    WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
      IF o_edit IS BOUND.
        o_edit->free( ).
      ENDIF.

      IF o_cont IS BOUND.
        o_cont->free( ).
      ENDIF.

      LEAVE PROGRAM.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT

Weiterführende Infos: Link