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: 

How to read excel file from ftp server

Former Member
0 Kudos

Hi Experts,

I am trying to fetch data from ftp server which is in EXCEL(.XLS) format.Able to connect FTP using FTP_CONNECT,using FTP_COMMAND(to get data). While reading a text file I am getting the data in the internal table successfully, but when I try to read the data from excel file , it returns the data into the internal table , but in different format(may be in binary format).

How to capture the excel file entries,help me regarding this?

Regards,

Binod

8 REPLIES 8

Former Member
0 Kudos

hi binod,

can you mention which fm you are using to read excel file?

0 Kudos

ftp_commanf

0 Kudos

FTP_COMMAND

0 Kudos

Sorry. I have used  FTP_SERVER_TO_R3.

0 Kudos

Hi Binod,


DATA : it_file  TYPE TABLE OF alsmex_tabline WITH HEADER LINE.
   DATA : lv_file TYPE  rlgrap-filename.
   lv_file = gv_file.
   CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
     EXPORTING
       filename                = lv_file"Path of the file
       i_begin_col             = '1'
       i_begin_row             = '2'
       i_end_col               = '26'
       i_end_row               = '256'
     TABLES
       intern                  = it_file
     EXCEPTIONS
       inconsistent_parameters = 1
       upload_ole              = 2
       OTHERS                  = 3.

LOOP AT it_file.
     CASE it_file-col.

     when 1."columns

     Remaining will be according to your excel file columns,

     ,,,

          ,,

     endcase.
endloop.


Thanks,

sivanadh

oscar_valdez
Explorer
0 Kudos

Please, could you share the solution to read the excel file on ftp server and get it on a internal table. The FM FTP_SERVER_TO_R3 FM, returns a binary table.

0 Kudos

try ABAP2XLSX

0 Kudos

Hello Team,

I am also facing same issue while excel file data from FTP folder. Could you please some one help us to get excel data in to internal table.

fname = wa_file_list-file_name.
CALL FUNCTION 'FTP_SERVER_TO_R3'
EXPORTING
handle = hdl
fname = fname
character_mode = 'X'
TABLES
text = it_data
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc NE 0.
* WRITE 'FTP Error'.
ENDIF.


Thanks,

Vijay