Spaltenamen einer Struktur bekommen

Aus SAP Wiki ツ
Version vom 16. August 2021, 19:30 Uhr von M1ch3lde (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
 DATA columns         TYPE if_fdt_doc_spreadsheet=>t_column.
 
 DATA(desc) = CAST cl_abap_structdescr( cl_abap_structdescr=>describe_by_data( struc_from_itab ) ).
      LOOP AT desc->get_components( ) ASSIGNING FIELD-SYMBOL(<c>).
        IF <c> IS ASSIGNED.
          IF <c>-type->kind = cl_abap_typedescr=>kind_elem.
            APPEND VALUE #( id           = sy-tabix
                            name         = <c>-name
                            display_name = <c>-name
                            is_result    = abap_true
                            type         = <c>-type ) TO columns.
          ENDIF.
        ENDIF.
      ENDLOOP.