[ABAP] Neuen Modus öffnen, Transaktion ausführen, Modus schließen

TRY.
* Modus öffnen
    DATA: o_mode TYPE REF TO if_imc_child_mode.

    cl_imc_mode=>create_mode( EXPORTING modetype = cl_imc_mode=>modetype_main_mode
                              IMPORTING mode     = o_mode ).

* Transaktion starten
    o_mode->call( tcode = 'SE11'
*              data  =
                ).

    DATA: ret TYPE string.

* Modus wieder schließen?
    CALL FUNCTION 'POPUP_TO_CONFIRM'
      EXPORTING
        titlebar              = 'Frage'
        text_question         = 'Modus wieder schließen?'
        display_cancel_button = abap_false
      IMPORTING
        answer                = ret.

    CASE ret.
      WHEN '1'.
* Ja -> Modus schließen
        o_mode->close( ).
    ENDCASE.
  CATCH cx_root INTO DATA(e_txt).
ENDTRY.