[ABAP] Struktur in CSV-String wandeln

Variante 1 (cl_rsda_csv_converter)

DATA: it_mara TYPE STANDARD TABLE OF mara.
  
...

* erste Zeile der iTab holen
DATA(lv_line) = it_mara[ 1 ].
DATA: lv_string TYPE c LENGTH 4096.

* Struktur mit Daten zu CSV-Zeile konvertieren
DATA(o_conv) = cl_rsda_csv_converter=>create( i_delimiter = '"' i_separator = ';' ).
o_conv->structure_to_csv( EXPORTING
                            i_s_data = lv_line
                          IMPORTING
                            e_data = lv_string ).

WRITE: / lv_string.

Variante 2 (SO_STRUCT_TO_CHAR)

SELECT FROM sflight
  FIELDS *
  WHERE carrid = 'AA'
  INTO TABLE @DATA(it_sflight).

DATA(lv_line) = it_sflight[ 1 ].
DATA(lv_string) = ||.

CALL FUNCTION 'SO_STRUCT_TO_CHAR'
  EXPORTING
    ip_struct = lv_line
  IMPORTING
    ep_string = lv_string.

WRITE: / lv_string.