[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( ).