Bir structure’daki alanların isimlerini getirmek

data: struct type ref to cl_abap_structdescr,
gt_fieldcat type  slis_t_fieldcat_alv,     "Field isimlerini tutan tablo
it_data type standart table of kna1,      "Verileri tutan tablo
gs_fcat     type  slis_fieldcat_alv,
ls_component type abap_compdescr,
lv_msg       type string,
lv_tab         type string.
clear lv_msg.
struct ?= cl_abap_typedescr=>describe_by_data( it_data ).
loop at struct->components into ls_component.
read table gt_fieldcat     into gs_fcat
with key fieldname = ls_component-name.
concatenate lv_msg gs_fcat-seltext_l into lv_msg
separated by lv_tab.
lv_tab = cl_abap_char_utilities=>horizontal_tab.
endloop.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.