How to read .xls file from FTP server t oInternal table

Hi
am using the FTP_SERVER_TO_R3 to read xls file from FTP server to internal table
but the data i get in LT_TEXT is special characters.
CALL FUNCTION 'FTP_SERVER_TO_R3'
EXPORTING
handle = hdl
fname = f_name "ProdDataFromCRM.xls.
* CHARACTER_MODE = 'X'
* IMPORTING
* BLOB_LENGTH =
TABLES
BLOB = lt_text
* TEXT = lt_text
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4
can any one help me out to get the exact data..
Really appreciate your quick response..
Thank You

Hi, if you really retrieve an excel file, you can not see the data in ABAP. You may see them in Excel. For this you may use
CALL METHOD document->open_document_from_table
of the interface i_oi_document_proxy for OLE objects. You can access the data with reference to the interface i_oi_spreadsheet.
Please check [Desktop Office Integration (BC-CI)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf] for details.
But, who knows, perhaps you want "And Now For Something Completely Different".
Regards
Clemens

Similar Messages

  • How to read XL file from FTP server

    Hi all,
    I have a requirement like to read file from FTP server using path
    ftp:
    10.212......\DTR\DTR_ Accounted_Out
    and again save  other file in same location ,
    to doing this RFC connection is required?
    give a  procedure or program to do this requirement ..
    To create rfc for FTP which connection type can i use ?
    Give complete settings to create rfc destination

    Hi Rakhi,
    Use the below code to check if you have received the proper data.
    call function 'FTP_SERVER_TO_R3' "Get data as character instead of BLOB
        exporting
          handle         = hdl
          fname          = docid
          character_mode = 'X'
        tables
          text           = chardata.
    If the data is incorrect, it is possible that you are in the wrong directory.
    Use
    call function 'FTP_COMMAND'
        exporting
          handle        = hdl
          command       = 'cd mydir\mysubdir' "cd <space> your path
        tables
          data          = result
        exceptions
          tcpip_error   = 1
          command_error = 2
          data_error    = 3.
    Regards,
    Jovito.

  • How to read the file from ftp server

    Hi
    I need to read a file from a ftp server . Iam using apache lib common-net .jar .
    FTPClient ftp = new FTPClient();
    ftp.connect(server);
    ftp.login(username,password);
    FTPFile[] files = ftp.listFiles();
    for(int i=0 ;i<files.length;i++){
    System.out.println(" File : "+ i + " - " + files);     
    InputStream ip = ftp.retrieveFileStream(path);
    I got the inputstream from the ftp server. but iam not able to read the contents of the file ....
    help me plzzzzz

    Hi
    I have one more problem . first i try to read the file and write the file in local directory . then i try to read the data in the remote file .. iam getting the datas as null.
    InputStream ip = ftp.retrieveFileStream(path);                    
    File f = new File("D:\\ftp.txt");                    
    FileOutputStream fo = new FileOutputStream(f);
    byte[] buf = new byte[1024];
    while ((len = ip.read(buf)) > 0) {                         
    fo.write(buf,0,len);               
    fo.close();
    BufferedReader br = new BufferedReader(new InputStreamReader(ip));
    String line;
    do {
    line = br.readLine();
    System.out.println(" data " +line);
    }while (line != null);

  • Problem while reading the file from FTP server

    Hi Friends,
    I have a problem while fetching files from FTP server.
    I used FTP_Connect, FTP_COMMAND function modules. I can able to put the files into FTP server.
    but I cant able to pick the files from FTP server.
    anyone have faced similar issues kindly let me know.
    Thanks
    Gowrishankar

    Hi,
    try this way..
    for reading the file using FTP you need to use different unix command ..
    Prabhuda

  • Error while reading excel file from application server into internal table.

    Hi experts,
    My requirement is to read an excel file from application server into internal table.
    Hence I have created an excel file fm_test_excel.xls in desktop and uploaded to app server using CG3Z tcode (as BIN file type).
    Now in my program I have used :
    OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
    DO.
    READ DATASET v_filename INTO wa_tab.
    The statement OPEN DATASET works fine but I get a dump (conversion code page error) at READ DATASET statement.
    Error details:
    A character set conversion is not possible.
    At the conversion of a text from codepage '4110' to codepage '4103':
    - a character was found that cannot be displayed in one of the two
    codepages;
    - or it was detected that this conversion is not supported
    The running ABAP program 'Y_READ_FILE' had to be terminated as the conversion
    would have produced incorrect data.
    The number of characters that could not be displayed (and therefore not
    be converted), is 445. If this number is 0, the second error case, as
    mentioned above, has occurred.
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
    caught and
    therefore caused a runtime error.
    The reason for the exception is:
    Characters are always displayed in only a certain codepage. Many
    codepages only define a limited set of characters. If a text from a
    codepage should be converted into another codepage, and if this text
    contains characters that are not defined in one of the two codepages, a
    conversion error occurs.
    Moreover, a conversion error can occur if one of the needed codepages
    '4110' or '4103' is not known to the system.
    If the conversion error occurred at read or write of  screen, the file
    name was '/usr/sap/read_files/fm_test_excel.xls'. (further information about
    the file: "X 549 16896rw-rw----201105170908082011051707480320110517074803")
    Also let me know whether this is the proper way of reading excel file from app server, if not please suggest an alternative .
    Regards,
    Karthik

    Hi,
    Try to use OPEN DATASET v_filename FOR INPUT IN BINARY mode encoding default. instead of OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
    As I think you are uploading the file in BIN format to Application server and trying to open text file.
    Regards,
    Umang Mehta

  • Reading a file from ftp server

    Hi
    I am able to put file on ftp server using ftp adapter.But same settings are not working while polling file on ftp.
    Do i need to do some settings for get operation??

    Hi,
    Check the file permissions and for testing give all read/write/execute permissions to the file to be read from FTP. Also check the file modification date of the file.
    Check for the logs at 2 places for any error messages:
    - SOA server diagnostics logs
    - FTP server logs
    You can also enable the FINEST level of Adapter logs for adapters and see for the detailed errors in the diagnostic logs.
    FMW Console > right click soa-infra > Logs > Log Configuration > expand oracle.soa > set Trace32 : FINEST for oracle.soa.adapter
    Regards,
    Neeraj Sehgal

  • How to transfer excel files(on ftp server) into internal table?

    hello,everyone
    pls tell me how to transfer excel files those on a ftp server into internal table?
    ps.i know the function 'ftp_server_to_r3',it can help to transfer flat file.

    Hi,
    I believe you want to get the data from the FTP Server to R3.
    I am also sending the code. Have a look and it would help you.
    First get the Password and user name and the FTP Server Path where file is stored and FTP Server Host name
    FUNCTION zfi_ftp_get.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(I_FILENAME) TYPE  C
    *"  TABLES
    *"      T_BLOB STRUCTURE  ZFI_TLM_LENGTH OPTIONAL " is a table type with a field called line of length 992
    *"      RETURN STRUCTURE  BAPIRET2 OPTIONAL
      DATA : i_password(30)     TYPE c,
             i_user(30)         TYPE c,
             i_host(30)         TYPE c,
             i_rfc_destination  TYPE rfcdes-rfcdest,
             i_length           TYPE i,
             i_folder_path(100) TYPE c.
      DATA:   lv_blob_length   TYPE i.
      DATA:   lv_length        TYPE i,  "Password length
              lv_key           TYPE i VALUE 26101957,
              lv_password(30)  TYPE c,
              lv_ftp_handle    TYPE i,
              lv_cmd(80)       TYPE c.
      DATA: BEGIN OF result OCCURS 0,
            line(100) TYPE c,
            END OF result.
      TYPES: BEGIN OF ty_dummy,
             line(392) TYPE c,
           END   OF ty_dummy.
      DATA: lt_dummy TYPE TABLE OF ty_dummy,
            ls_dummy LIKE LINE  OF lt_dummy.
      i_password        = 'vnhdh'.
      i_user            = 'sdkgd'.
      i_host            = 'sbnksbg'.
      i_rfc_destination = 'SAPFTP'.
      i_length          = '992'.
      i_folder_path     = '/hioj/hohjk/hh'.
      lv_length = STRLEN( i_password ).
      CALL FUNCTION 'HTTP_SCRAMBLE'
        EXPORTING
          SOURCE      = i_password
          sourcelen   = lv_length
          key         = lv_key
        IMPORTING
          destination = lv_password.
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          user            = i_user
          password        = lv_password
          host            = i_host
          rfc_destination = i_rfc_destination
        IMPORTING
          handle          = lv_ftp_handle
        EXCEPTIONS
          not_connected   = 1
          OTHERS          = 2.
      IF sy-subrc = 1.
        return-type = 'E' .
        return-message = 'FTP Connection not Successful'.
        APPEND return.
      ELSEIF sy-subrc = 2.
        return-type = 'E' .
        return-message = 'FTP Connection not Successful'.
        APPEND return.
      ELSEIF sy-subrc EQ 0.
        return-type = 'S' .
        return-message = 'FTP Connection Successful'.
        APPEND return.
        CONCATENATE 'cd' i_folder_path INTO lv_cmd SEPARATED BY space.
        CALL FUNCTION 'FTP_COMMAND'
          EXPORTING
            handle        = lv_ftp_handle
            command       = lv_cmd
          TABLES
            data          = result
          EXCEPTIONS
            command_error = 1
            tcpip_error   = 2.
        IF sy-subrc = 1.
          return-type = 'E' .
          return-message = 'Command Error Occured during open of FTP Folder'.
          APPEND return.
        ELSEIF sy-subrc = 2.
          return-type = 'E' .
          return-message = 'TCIP Error Occured during open of FTP Folder'.
          APPEND return.
        ELSE.
          REFRESH t_blob.
          lv_blob_length = 992.
          TRANSLATE i_filename TO LOWER CASE.
          CALL FUNCTION 'FTP_SERVER_TO_R3'
            EXPORTING
              handle      = lv_ftp_handle
              fname       = i_filename         
            IMPORTING
              blob_length = lv_blob_length
            TABLES
              blob        = lt_dummy.
          t_blob[] = lt_dummy[].
        ENDIF.
      ENDIF.
    ENDFUNCTION.
    Regards
    Sajid
    Edited by: shaik sajid on Nov 16, 2010 7:25 AM

  • Problem reading .xls file from App Server

    Hi Everyone......
    I hope this might be a common problem but i searched for similar problem......i did'nt find the solution my problem is
    I'm trying to download .xls(excel file data into an internal table using OPEN DATASET FOR INPUT IN TEXT MODE ENCODING DEFUALT and read dataset for reading it).But in the read dataset syntax all stange values like **$#@&&& are getting uploaded???? I dont now why......
    Is it happing because i'm trying to upload .XLS file ???
    My coding is as follows...........
      OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        IF sy-subrc NE 0.
          IF sy-batch IS INITIAL.
            MESSAGE i001(zz) WITH 'Error opening file for upload'.
            EXIT.
          ELSE.
            MESSAGE s001(zz) WITH 'Error opening file for upload'.
            EXIT.
          ENDIF.
        ENDIF.
    *First Uploading the data into structure
        DO.
          READ DATASET p_file INTO l_wa_tab.   "My internal table work area
          IF sy-subrc = 0.
            APPEND l_wa_tab TO  l_tab.
          ELSE.
            EXIT.
          ENDIF.
          ADD 1 TO count.
        ENDDO.
        CLOSE DATASET p_file.
    Any solution for above problem.........

    Hi,
    Check whether path ur providing to the open data set stmt is correct or not in debugging mode.
    * File upload to internal table from UNIX Directory
        IF NOT p_i1file IS INITIAL AND NOT p_path IS INITIAL.
          CONCATENATE p_path p_i1file INTO v_file.
          CONDENSE v_file.
          OPEN DATASET v_file FOR INPUT IN TEXT MODE MESSAGE v_msg.
          IF sy-subrc EQ 0.
            WRITE:  / 'INPUT FILE CONTAINS NO RECORD :'(010), v_file.
            DO.
              CLEAR tbl_input.
              READ DATASET v_file INTO tbl_input.
              IF sy-subrc NE 0.
                EXIT.
              ELSE.
                APPEND tbl_input.
              ENDIF.
            ENDDO.
    * Close Input File
            CLOSE DATASET v_file.
          ELSE.
            WRITE:/'Error uploading file: '(008),v_file.
            STOP.
          ENDIF.
        ENDIF.
    It should work.check the sy-subrc value and file value in debug mode.
    Thanks
    Parvathi

  • Read File From FTP Server

    Hi all,
    I have to read a file from FTP server, manipulate it and then create another file at the same location.
    Currently, I am able to write a file onto FTP server ..but how do I read the file?
    Any help will be greatly appreciated.
    Thanks,
    Haritha

    can i know how do u placing the file in FTP?
    ( default path specified in the FTP server, it might be Pre. server address)

  • Upload XL file from FTP server

    Hi All,
    Can anybady help me, how to upload Excel file from FTP server.
    Thanks
    Sri
    Edited by: srikanthn on Apr 14, 2010 6:31 PM

    Hello
    How about using SAPFTP?
    I hope SAP note 130106 will guide you on this.
    Thanks
    koju

  • Oracle read files from FTP Server

    Hi,
    Somebody knowns Oracle how to read files from FTP Server ? Which package I can use?

    Duplicate post
    Oracle read files from FTP Server

  • How to get file from FTP Server using File Control

    Hi,
    Any one did getting file from FTP Server?
    Please let me know any one help me.
    I would need to get file from FTP Server.
    Thanks,
    Madhu

    Yes I have done that. But In FTP Server I cannt read file, because no previliges. Only I need to copy file from FTP Server to local server then only I can read that file.
    I tried all options using FileConrol(getFiles(),read()).
    getFiles() - It wont copy the file, it give information about file.
    read() - I dont have previliges to read the file.
    Please tell me any other procedure would be there for getting file from FTPServer.
    Thanks,
    Madhu

  • How to send a file from FTP to external server

    My requirement is to send a file from FTP to D3(External) server.
    Now I am able to store the file in Appln server.
    I want to send the file created by the program thru FTP to D3 server.
    I know the username,Password,HostID,RFC destination details.
    How to send the file from FTP to D3.
    If u have any program,Plz send it...
    I dont want the function modules name...I want the example code ....
    Thanks in advance.

    Hi Sumi,
    You could do it so that you create a .bat or .cmd script to your server which does your ftp transfer.
    To do this you must use sm69 to create a external operating system command which you can call from FM SXPG_COMMAND_EXECUTE. To SXPG_COMMAND_EXECUTE you the file you need to transfer as a parameter.
    What happens is that your abap program passes the file to windows batch script (.bat .cmd) which will then do the transfer for you.
    Here's a sample of ftp-script for windows:
    echo open IP_ADDRESS_TO_YOUR_SERVER > c:zftp_transfer.ftp
    echo USERNAME>> c:zftp_transfer.ftp
    echo PASSWORD>> c:zftp_transfer.ftp
    echo put YOUR_FILE>> c:zftp_transfer.ftp
    echo quit>> c:zftp_transfer.ftp
    ftp -s:c:zftp_transfer.ftp
    also take a look here for more details:
    http://support.microsoft.com/?kbid=96269
    Ok, this might be a bit trivial but if your server is unix/aix etc.. Instead of using batch script you must do a shell script.
    Regards,
    Ville

  • Download file from FTP Server to Application Server

    Hi Friends,
    Using the standard SAP Program RSFTP002, I was able to download the file to my local PC. But my requirement is to download the file from FTP to application server.
    For RSFTP002, I am passing the username, password, host and in command 1 I am passing lcd :\temp, command 2 get filename. The file gets downloaded into c:\temp. If I do the same passing the app server path in command 1 as /usr/sap/tmp I get an error that pass cannot be found.
    Anyone please help me how to donload the file from ftp to app server.
    Thanks,
    Deepthi

    If I remember correctly the activation type on the technical settings tab must be set to "start on application server" in transaction SM59 for the RFC destination for the FTP server.  This should allow the files to be transferred to/from the application server.
    Regards,
    Steve.

  • Copy file from FTP server to sap application server

    Hi,
    I am able to copy a particular file from FTP server to sap application server using FTP_CONNECT, FTP_COMMAND and FTP_DISCONNECT. But here my problem is, it copies into default application server path(DIR_HIOME). I want to copy into specified folder in the application server. How can I specify the required destination path.
    Can you please suggest how to achieve this.
    Thanks,
    Shiva Kankanala

    try something like this:
    data: user(30) type c value 'ftpuser', "ftp username
                  pwd(30) type c value 'ftppass', "ftp password
                  host(64) type c value '255.255.255.255', "ftp server IP
                  cmd1(80) type c value 'lcd /dump', "location on app server where you want to copy the file
                  cmd2(80) type c value 'get', "specifies you are going to get the file from ftp server
                  dest like rfcdes-rfcdest value 'SAPFTPA',
                  file(15) type c value 'file.txt'. "specifies file that you want to get from ftp server
    data: hdl type i,
            key type i value 26101957,
            slen type i.
    slen = strlen( pwd ).
    call function 'HTTP_SCRAMBLE'
        EXPORTING
          source      = pwd
          sourcelen   = slen
          key         = key
        IMPORTING
          destination = pwd.
    call function 'FTP_CONNECT'
        EXPORTING
          user            = user
          password        = pwd
          host            = host
          rfc_destination = dest
        IMPORTING
          handle          = hdl.
    call function 'FTP_COMMAND'
        EXPORTING
          handle        = hdl
          command       = cmd1
        TABLES
          data          = result
        EXCEPTIONS
          command_error = 1
          tcpip_error   = 2.
      loop at result.
        write at / result-line.
      endloop.
    CONCATENATE cmd2 file INTO cmd2 SEPARATED BY SPACE.
    call function 'FTP_COMMAND'
          EXPORTING
            handle        = hdl
            command       = cmd2
          TABLES
            data          = result
          EXCEPTIONS
            command_error = 1
            tcpip_error   = 2.
        loop at result.
          write at / result-line.
        endloop.
        refresh result.

Maybe you are looking for

  • Photoshop CC on a Mac running Mavericks does not recognize Epson 3880

    This is my first post to this forum so I hope that I am following protocol and presenting my issue clearly. I am running Photoshop CC (on a Mac Retina with an Epson 3880). It has worked fine for months but it crashed twice yesterday while I was in pr

  • TRAVEL MANAGEMENT and ESS help required

    Hi Can anyone help me how to configure TRAVEL MANAGEMENT and ESS in IMG Please help. Regards Sonu

  • How to skip Pairing the Pen SP3 in MDT 2013?

    I have Configured the image to pair the pen but I do not want it to ask to pair until after the image has been completed. After doing the step below it now asks. During the 1<sup>st</sup> bootup of the OEM image that ships with the Surface Pro 3 you

  • Safari 7.0.5 on OS X 10.9.4 doesn't to quit

    I can't the latest update of Flash Player (10.14.0.0145). It says I should quit Safari which is not running... Someone else has this problem ?

  • IMac: No Sound from Internal Speakers

    Hello, This is a really frustrating problem for me. I only now realize how impairing it is to work without sound! Here are the facts: I get a chime on start up. In Sys Pref>Sound it reads "Nokia BH-100" my bluetooth headset as default sound device wi