[ABAP] XML-Editor in der SAPGUI anzeigen, XML-Daten editieren

DATA(it_xml) = VALUE string_table( ( |<?xml version="1.0" encoding="utf-8"?>| )
                                   ( |<asx:abap version="1.0" xmlns:asx="http://www.sap.com/abapxml">| )
                                   ( |<asx:values>| )
                                   ( |<TEXT>Hello world!</TEXT>| )
                                   ( |</asx:values>| )
                                   ( |</asx:abap>| )
                                 ).

* XML Viewer and Editor
* XML-Editor im aktuellen Modus im SAPGUI anzeigen
DATA(o_xml) = NEW cl_proxy_xml_edit( cl_gui_container=>default_screen ).

* XML in Editor übergeben
o_xml->set_text( it_xml ).
* Editmode einschalten
o_xml->set_change_mode( abap_true ).
* XML formatieren
o_xml->pretty_print( ).
* Editor visible setzen
o_xml->set_visible( abap_true ).

* Ausgabe auf cl_gui_container=>default_screen erzwingen
WRITE: space.

[ABAP] String nach TLINE konvertieren

* https://www.tricktresor.de/blog/textstream-konvertieren/
DATA(lv_string) = 'AAAA' && cl_abap_char_utilities=>newline && 'BBBB' && cl_abap_char_utilities=>cr_lf && 'CCCC'.
DATA(it_strings) = VALUE string_table( ( lv_string ) ).

DATA: it_tline TYPE tline_t.

* Stringtabelle -> TLINE-Tabelle
* SAPscript: Konvertieung Textstream nach ITF für TextEditControl
CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'
  EXPORTING
    stream_lines = it_strings
    lf           = abap_true
  TABLES
    itf_text     = it_tline.

cl_demo_output=>write_data( it_strings ).
cl_demo_output=>write_data( it_tline ).
cl_demo_output=>display( ).

[ABAP] TLINE nach String konvertieren

Variante 1 (CONVERT_ITF_TO_STREAM_TEXT)

* https://www.tricktresor.de/blog/textstream-konvertieren/
DATA(it_tline) = VALUE tline_t( ( tdformat = '*' tdline = 'AAAA' )
                                ( tdformat = '*' tdline = 'BBBB' )
                                ( tdformat = '*' tdline = 'CCCC' ) ).

DATA(it_strings) = VALUE string_table( ).

* TLINE-Tabelle -> Stringtabelle
* SAPscript: Konvertierung ITF nach Textstream für TextEditControl
CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
  EXPORTING
    lf           = abap_true
  IMPORTING
    stream_lines = it_strings
  TABLES
    itf_text     = it_tline.

cl_demo_output=>write_data( it_tline ).
cl_demo_output=>write_data( it_strings ).
cl_demo_output=>display( ).

Variante 2 (IDMX_DI_TLINE_INTO_STRING)

DATA(it_tline) = VALUE tline_t( ( tdformat = '*' tdline = 'AAAA' )
                                ( tdformat = '*' tdline = 'BBBB' )
                                ( tdformat = '*' tdline = 'CCCC' ) ).

DATA(lv_string) = ||.

* TLINE-Tabelle -> String
* Converts ITF text into a string
* ruft implizit CONVERT_ITF_TO_STREAM_TEXT
CALL FUNCTION 'IDMX_DI_TLINE_INTO_STRING'
  EXPORTING
    it_tline       = it_tline
  IMPORTING
    ev_text_string = lv_string.

cl_demo_output=>write_data( it_tline ).
cl_demo_output=>write_data( lv_string ).
cl_demo_output=>display( ).

[ABAP] MIME-Repository: Verzeichnis lesen

DATA: it_file_list TYPE string_table.

* MIME-API holen
DATA(o_mime_rep) = cl_mime_repository_api=>get_api( ).

TRY.
* Bild aus dem MIME-Repository laden
    o_mime_rep->file_list( EXPORTING
                             i_url             = '/SAP/BC/BSP'
                             i_recursive_call  = abap_true
*                             i_check_authority = abap_false
                           IMPORTING
                             e_files           = it_file_list ).

    cl_demo_output=>display( it_file_list ).
  CATCH cx_root INTO DATA(e).
    WRITE : / e->get_text( ).
ENDTRY.