FTP using ABAP

Hi Gurus,
We are trying to read a file from a server (e.g) XYZ.123.com and other details which are provided to us are user name (e.g): Abc123 and Directory (e.g): /123/123/123/123l.
My question is: Do we need a RFC connection to the server if yes then what type of RFC connection? If RFC connection is not required then what we have to do to establish the connection.
Thanks,
Abhishek.

Hi Abhshk, there may be a more modern way but something like this has worked in the past
*-- FTP_CONNECT requires an encrypted password to work
  call 'AB_RFC_X_SCRAMBLE_STRING'
       id 'SOURCE' field mc_password
       id 'KEY' field mi_key
       id 'SCR' field 'X' id 'DESTINATION' field mc_password
       id 'DSTLEN' field mi_pwd_len.
  call function 'FTP_CONNECT'
       exporting
*-- Your SAP-UNIX FTP user name (case sensitive)
         user            = 'unixuser'
         password        = 'unixpassword'
*-- Your SAP-UNIX server host name (case sensitive)
         host            = 'saphost'
         rfc_destination = 'sapsystemrfc'
       importing
         handle          = mi_handle
       exceptions
         not_connected   = 1
         others          = 2.
  check sy-subrc = 0.
  call function 'FTP_COMMAND'
    exporting
      handle        = mi_handle
      command       = 'dir'
    tables
      data          = mtab_data
    exceptions
      tcpip_error   = 1
      command_error = 2
      data_error    = 3
      others        = 4.
Kevin

Similar Messages

  • How to get the owner name for the file in ftp using abap ?

    Hi folks ,
    How to get the owner name for the file in ftp using abap ? please help me very ugernt . I tried with all standard FTP commands
    but doest work out me . Helping in this regard highly appreciated ...
    Thanks and regards,
    Swarupa Vanarchi

    Hi
    dont you  have used the os user while calling the FTP_CONNECT FM?
    Hope you are not talking about the user executing the FTP program.
    Else If you are talking about the FTP file creator then its not related to abap as you can handle it by maintaining the user in file name itself.
    May be i am going too far with if and elses here as your question possesses no  clarity.
    Plz elaborate your requirement  before anybody can help.
    Regards
    sateesh

  • Secure FTP using ABAP

    Hello,
    Can we do a secure FTP using ABAP code ??
    Thanks
    John

    Hi John,
    Sorry, I think the SAP function modules FTP_CONNECT, FTP_COMMAND und FTP_DISCONNECT are implemented according to RFC859 which is far behind secure connections. As SAP ftp goes throug SAP RFC destinations, this may be the spot where something has to be done to enable a secure connection.
    Regards,
    Clemens

  • Unzip files from FTP using  ABAP

    Hi All,
    I have the a requirement to unzip certain files from ftp and transfer the extracted files to another directory in ftp.
    Searched  (Re: Unzip file;)  in SDN but didnt find the perfect solution
    Appreciate the help.
    Regards
    Siva

    You can use IndexOf function
    see this example
    http://visakhm.blogspot.in/2012/05/package-to-implement-daily-processing.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • FTP to SAP using ABAP Proxy

    Hi SDN,
      I am new to XI can any one provide me clear documentation or link on "FTP to SAP using ABAP Proxy" on this senario. I mean the steps to create ABAP Proxy etc..
    Thanks in Advance
    Regards
    Basha

    Hi Shaik
    Please go through the information provided in the blogs below which explains clearly the Scenario you want to try.
    <a href="/people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy Proxies in XI</a>
    <a href="/people/siva.maranani/blog/2005/04/03/abap-server-proxies Server Proxies</a>
    <a href="/people/prateek.shah/blog/2005/06/14/file-to-r3-via-abap-proxy to R/3 via ABAP Proxy</a>
    Please do let me know if you want any more help regarding the same.
    Regards,
    Abhy

  • PI needs to obtain a zip file via FTP using the File adapter

    I have a scenario where PI needs to obtain a zip file via FTP using the File adapter, this zip file contains a number of txt files that I need to process, and the content of one of them send it to an ECC, now I'm using the PayloadZipBean Module in the Sender FIle Adapter, and I have two things if I use the Message Protocol as File, I get a Payload for each txt file in the zip file, but this payload has no structure, and if I use the File Content Conversion I get an XML strcuture with only one field and a strange string in it, and somewhere in this string the names of the files I assume all the content of the zip file, can anyone help on how could I achieve what I need that is to pull the zip file via SAP PI, then unzip it, and with the content of one of the txt files send it to an ECC via ABAP Proxy, thanks in advance for your answers.
    Regards,
    Raul Alvarado

    Hello Raul,
    you can do it in futher way ...
    pickup zip file and simply extract and dump it in another temp folder (can use scripts on OS level).
    @ then Use another sender communication channel to pickup all these text file .
    for further clarification you can use these links also. -
    Process txt files in zip file
    Accessing File using FTP from Java Mapping
    File Sender Adapter with FTP protocol
    BR
    Raj

  • File/FTP to ABAP Proxy (file as attachment)

    I have the following scenario: File/FTP -> XI -> ABAP Proxy but not the normal case. What I need is the picked file as attachment and the file name. I hope this is possible.
    I have found the following blogs:
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    /people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments
    I have no idea where I have to start. How I should define the sender and receiver message interface? How I have to configure the sender file/ftp adapter?
    I'm using PI 7.1 SP 7.

    At the moment I have the following problem. I always get an error during mapping the request message. This is the error message:
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Mapping der Request-Message
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>
      <SAP:P1>com/sap/xi/tf/_MT_SCANFILE_to_MT_SAP_SCANFILE_</SAP:P1>
      <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException:</SAP:P2>
      <SAP:P3>Fatal Error: com.sap.engine.lib.xml.parser.ParserE</SAP:P3>
      <SAP:P4>xception: XMLParser: No data allowed here: (hex) ~</SAP:P4>
      <SAP:AdditionalText />
      <SAP:Stack>Während des Anwendungs-Mappings com/sap/xi/tf/_MT_SCANFILE_to_MT_SAP_SCANFILE_ ist eine RuntimeException aufgetreten. com.sap.aii.utilxi.misc.api.BaseRuntimeException:Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) ~</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    And if I use transaction sxmb_moni I see that the payload MainDocument is my pdf document and I can read it.
    MG%PDF-1.3
    %âãÏÓ
    2 0 obj
    /WinAnsiEncoding
    endobj
    3 0 obj
    <<
    %Devtype POST2    Font COURIER  normal Lang DE
    /Type /Font
    /Subtype /Type1
    /BaseFont /Courier
    /Name /F001
    /Encoding 2 0 R
    >>
    endobj
    4 0 obj
    <<
    /Length 5 0 R
    u2026.
    I believe there is still an error at my communication channel configuration of the ftp sender adapter.

  • FTP thru ABAP program

    Hello ABAP Gurus,
    Kindly attached an example program for FTP process in ABAP...
    i have this project wherein i need to gather data from SAP and transfer it to
    an another server box for another applicaiton....
    Thank you in advance.

    Hi Friend,
    Check this link for code:
    http://abap-gallery.blogspot.com/2007/07/ftp.html
    Check this link:
    http://abapshare.wordpress.com/2008/07/23/connecting-to-ftp-server-using-abap/
    Regards,
    Chandra Sekhar

  • Saving a File in FTP using DSN or FTPCOMMAND

    Hi,
    I'm trying to save a file to a remote location in the background using ABAP.
    I tried DSN. This didnt work as it writes only to application server SAPUSERS directory.
    I tried FTPCONNECT and FTPCOMMAND but getting an error connecting to FTP.  (connection failed)
    Is it possible to write a file to a remote location in the background using ABAP.
    I use a VPN gateway to connect to the remote server (location where file are to be saved) and SAP as well.
    Appreciate your help.
    Thanks,
    Sri

    Hi,
    Please  use HTTP_SCRAMBLE' FM before 'FTP_connect" as follows :
    *-- FTP_CONNECT requires an encrypted password to work
    CALL FUNCTION 'HTTP_SCRAMBLE'
        EXPORTING
          SOURCE      = password
          sourcelen   = lv_len
          key         = lv_key
        IMPORTING
          destination = password.
    CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          user                   = ftp_user
          password               = password
      ACCOUNT                =
          host                   = host
          rfc_destination        = 'SAPFTP'
        IMPORTING
          handle                 = lv_handle
        EXCEPTIONS
          not_connected          = 1
          OTHERS                 = 2.
    Also note that FTP_USER contains the user name of the FTP server, PASSWORD contains the scrambled password received from  'HTTP_SCRAMBLE'. HOST contains the name of server.
    Thanks and Regards,
    P.Bharadwaj

  • List of widely used ABAP classes

    Hello dear forum gurus.
    Im trying to find information about the classes that can handle common tasks, ie. I've found classes for ALV, for FRONTEND, etc..
    I'm wondering if there is any place (similar to the java class library) where I can find all these classes, or can someone tell me wich are the most used classes (or useful).
    Best regards from mexico
    Edited by: Thomas Zloch on May 10, 2011 5:34 PM - subject adjusted by moderator

    Still I'm looking for the classes that solve common tasks... sorry to mention java again... but like swing (for GUI) we have frontend services class ... like for string manipulation in abap we have... (I dont know... ) for ftp in ABAP we have.... or etc..
    but thank you very much for the answers

  • How to populate columns in IVIEW using ABAP FM ?

    Hi All,
    I need to populate columns in IVIEW using ABAP FM. I had developed a FM which is working fine in SAP ABAP. Now Functional people has done the configuration for this FM to MSS.
    When we go to the IVIEW in MSS, My FM is not getting triggered in the MSS portal, it is not displaying any values in that particular column of IVIEW. I dont know why.
    Can anybody help me out? If u need any more details i'll provide that..

    Hi,
    If you need only two why to fetch three ?
    Just doing it by yourself will show you what will happen.
    Regards
    Yoonas

  • Creating a long text using ABAP code.. fm SAVE_TEXT

    When you create an order via IW31 one of the options is to click on the text button and create a long text. I am basically trying to mimic this action from within my ABAP code.
    The text id details are as follows:
    Text Name       500000015000046  which is (5000000 + order number)
    Language        EN
    Text ID            KOPF         Order header text
    Text Object      AUFK       Order text
    If i manually create the text within the transaction i am then able to view and update it via function modules READ_TEXT and SAVE_TEXT. But if the text has not already been created READ_TEXT obviously returns nothing as it does not exist and SAVE_TEXT does not seem to created it!
    Anyone know how i would go about creating this text using ABAP code?
    Hope this make a bit of sense
    Thanks in advance
    Mart

    I have implemented the code as i think it should be. See below, can any see what is wrong. If i add init_text it makes no difference and adding the commit_text just makes it hang
    DATA: IT_TEXTS type standard table of TLINE,
           wa_texts like line of it_texts,
           wa_txtheader type THEAD.
    wa_txtheader-TDID     = 'KOPF'.
    wa_txtheader-TDSPRAS  = 'EN'.
    wa_txtheader-TDNAME   = '500000015000056'.
    wa_txtheader-TDOBJECT = 'AUFK'.
    wa_texts-tdformat = '*'.
    wa_texts-tdline = 'hello'.
    append wa_texts to it_texts.
    wa_texts-tdformat = '*'.
    wa_texts-tdline = 'hello'.
    append wa_texts to it_texts.
      wa_texts-tdformat = '*'.
    wa_texts-tdline = 'hello'.
    append wa_texts to it_texts.
    wa_texts-tdformat = '*'.
    wa_texts-tdline = 'hello'.
    append wa_texts to it_texts.
    wa_texts-tdformat = '*'.
    wa_texts-tdline = 'hello'.
    append wa_texts to it_texts.
      wa_texts-tdformat = '*'.
    wa_texts-tdline = 'hello'.
    append wa_texts to it_texts.
    CALL FUNCTION 'SAVE_TEXT'
      EXPORTING
        CLIENT                = SY-MANDT
        HEADER                = wa_txtheader
        INSERT                = 'X'
       SAVEMODE_DIRECT       = ' '
       OWNER_SPECIFIED       = 'X'
      LOCAL_CAT             = ' '
    IMPORTING
      FUNCTION              =
      NEWHEADER             =
      TABLES
        LINES                 = IT_TEXTS
    EXCEPTIONS
       ID                    = 1
       LANGUAGE              = 2
       NAME                  = 3
       OBJECT                = 4
       OTHERS                = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Using ABAP Webdynpr How to Upload File and download file in SAP R/3

    Hi SAP GURUS ,
                             I wanted to save employee profile from ESS to SAP so i am creating ESS Application .
    For that I go with BDS Approach and create test program for this  I got success while uploading file in my folder
    which i have created with the help of class and content repository . but when i Using ABAP Webdynpro , i got error FM "BDS_BUSINESSDOCUMENT_CREATEF"  message " error_kpro " .
                           Also I wanted to use KM for storage of Documents and wanted to retrive with help of ABAP Webdynpro .
                           So pls tell me / mailed me the process , approach and if you have examples .
        Thanks in Advance ,
         Vishwassap at gmail

    Hi Vishwas,
    Check out the thread [Efficient way of saving documents uploaded|Re: Efficient way of saving documents uploaded by users; and check the blog by Raja Thangamani.
    Also check the thread [Export Images through Function Modules   |Export Images through Function Modules;.
    Hope it helps you.

  • Use abap report program to print bar code instead of smartforms

    Do anyone know how to use abap report program to print bar code?

    Hi Celina,
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci839063,00.html
    I hope this will help, also it depends on the barcode type like ARTNR-code 128...
    Regards,
    Sudhi

  • Crystal report using ABAP from SAP ECC6.0 EHP 3.0

    Hi Gurus,
    Can i create crystal report using ABAP in SAP ECC 6.0 EHP 3 . as i am not able to see this link in SPRO.
    IMG > SAP NetWeaver > Application Server > SAP List Viewer > Maintain SAP GUI Specific Settings.
    Kindly guide me urgently.

    http://help.sap.com/saphelp_slc/helpdata/en/27/c9ee1951fc4fb9ac322ac7e6fa7372/content.htm
    If I understood your question correctly.
    Have a look in the link above.
    It is possible to use Crystal Reports from ALV.
    Tammy Powlas also has some good guides on how to do this.
    The ABAP however is not covered that much.
    Best Regards
    Ingrid

Maybe you are looking for