Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning Field Symbols to Internal Table

0 Kudos

I'm trying upload Excel file to internal table in ABAP. I'm using function `GUI_UPLOAD` and then `SCMS_BINARY_TO_XSTRING`. At last I have field sybmbol `<gt_data>` with data from Excel file.

    DATA(lo_data_ref) = lo_excel_ref->if_fdt_doc_spreadsheet~get_itab_from_worksheet(
                                             lv_woksheetname ).
*-- Excel work sheet data in dyanmic internal table
    ASSIGN lo_data_ref->* TO <gt_data>.<br>

| A [CString] | B [CString] |

|data1 | data11 |

|data2 | data22 |

|data3 | data33 |

How I can iterate <gt_data> to internal table? I would try like below, but I received dump.

  TYPES: BEGIN OF lty_test,
           A  TYPE string,
           B TYPE string,
         END OF lty_test.
  DATA:
    lt_test_table    TYPE STANDARD TABLE OF lty_test.
3 REPLIES 3

abo
Active Contributor

Sigh, why so much pain? 😄

Have you considered abap2xlsx? There'a demo for loading files

I'm learning ABAP now 🙂

Sandra_Rossi
Active Contributor

What is the rest of your code? Is it what you're looking for?

FIELD-SYMBOLS <gt_data> TYPE STANDARD TABLE OF lty_test.
LOOP AT <gt_data> ASSIGNING FIELD-SYMBOL(<line>).
ENDLOOP.