Skip to Content
avatar image
Former Member

Transfer Excel file to internal table

Hi Experts,

I have one question to you. What i need -> open excel file and put content of it to internal table. I'm using for that

CALL METHOD cl_gui_frontend_services=>gui_upload


      filename = lv_fname <- path to file

     filetype = 'ASC'


      data_tab = istr[].

At the end i can see, that istr[] has a content, but it is unreadible and looks like:


Could you please help me to solve this issue?

Please notice, that in EWM system i can't use FM such as



Thank you very much for help 😊

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Dec 24, 2012 at 10:43 AM


    You can try this,

    * import ms-excel file into sap table

      CALL METHOD zcl_import_excel=>import_xls


          i_filename           = pa_file

          i_tablename          = so_tabl-low


          e_processed          = i_processed


          error_import_excel   = 1

          error_updating_table = 2

          OTHERS               = 3.

      IF sy-subrc <> 0.

        IF NOT sy-msgno IS INITIAL.

          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.


          MESSAGE ID 'ZCONK' TYPE 'E' NUMBER '000'

          WITH 'Unknow error importing MS-Excel data'(m01).



    *   show results on screen

        WRITE:/ 'Import table:'(t01), so_tabl-low.

        WRITE:/ 'Data source:'(t02), pa_file.

        WRITE:/ 'Number of created/changed records:'(t03), i_processed.


    hope it helps,


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 24, 2012 at 11:17 AM

    Hi Vinoth,

    As far as i see from Method implementation, CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP' usus.

    I do not have this FM in my system, so how will this class and method work?

    Best Regards,


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Vinoth,

      As i said KCD_EXCEL_OLE_TO_INT_CONVERT doesn't exist (because i check all possible FM's 😊).

      @Vivek: I'm not sure that type of internal table influense on encoding.

      i've tried the same code but with .TXT and .CSV files and it shows data very good. Problem only with XLS and XLSX