Skip to Content
0
Former Member
Jun 11, 2009 at 03:32 PM

RTTS - dynamic table output

53 Views

Hi,

I'd like to output the contents of a dynamic table. I dont know the structure and type of the table. I tried to use RTTS methods but I dont know how to output the data.

Here my example code:

REPORT  zsm_rtts_test.

DATA: lt_test TYPE TABLE OF spfli.

FIELD-SYMBOLS: <wa_test> LIKE LINE OF lt_test.

" just for example - flight table

SELECT * FROM spfli INTO TABLE lt_test.

DATA: ref_table        TYPE REF TO cl_abap_tabledescr,
      ref_struct       TYPE REF TO cl_abap_structdescr,
      fields_table     TYPE abap_compdescr_tab.

FIELD-SYMBOLS: <field> LIKE LINE OF fields_table.

ref_table  ?= cl_abap_tabledescr=>describe_by_data( lt_test ).
ref_struct ?= ref_table->get_table_line_type( ).

fields_table[] = ref_struct->components.

LOOP AT lt_test ASSIGNING <wa_test>.
  LOOP AT fields_table ASSIGNING <field>.
    ????
  ENDLOOP.
ENDLOOP.

How can I give out the contents of the dynamic table? I dont know what to write in place of the question marks.

Thanks a lot.

Regards

Cunanan80