Sending/receiving files using SFTP

Hi,
Is there a way to use the Secure File Transfer Protocol (SFTP) in ABAP to send/receive files?
I already used the FTP functionality from the function group SFTP, but I'm honestly not sure whether ABAP also handles the secure version of FTP.
If there is this functionality, please provide me the necessary function modules, ...
Thanks in advance
Bye,
Timo

FTP functionality woks fine in ABAP. Below is some code which can be used for FTP access to send/receive files.
Initially, get values for the below fields
  DATA: l_user(30) TYPE c VALUE <userid>,
        l_pwd(30)  TYPE c VALUE <password>,
        l_host(64) TYPE c VALUE <host string>,
  DATA: l_slen     TYPE i,
        l_error,
        l_pwd(30)  TYPE c.
  CONSTANTS: c_dest TYPE rfcdes-rfcdest VALUE 'SAPFTP',
             c_key  TYPE i              VALUE 26101957.
connect to ftp server
  l_pwd = p_pwd.
  l_slen = STRLEN( l_pwd ).
  CALL FUNCTION 'HTTP_SCRAMBLE'
    EXPORTING
      SOURCE      = l_pwd
      sourcelen   = l_slen
      key         = c_key
    IMPORTING
      destination = l_pwd.
  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
      text = 'Connect to FTP Server'.
  CALL FUNCTION 'FTP_CONNECT'
    EXPORTING
      user            = l_user
      password        = l_pwd
      host            = l_host
      rfc_destination = c_dest
    IMPORTING
      handle          = w_hdl
    EXCEPTIONS
      OTHERS          = 1.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
  CLEAR : w_outfile, w_file_count.
concatenate <directory> <filename> to field.
MOVE field to w_outfile.
PERFORM download_to_ftp TABLES <int'table>
                        USING w_outfile.
FORM download_to_ftp TABLES it_tab
                     USING l_string TYPE char64.
  CALL FUNCTION 'FTP_R3_TO_SERVER'
    EXPORTING
      handle         = w_hdl
      fname          = l_string
      character_mode = 'X'
    TABLES
      text           = it_tab[]
    EXCEPTIONS
      tcpip_error    = 1
      command_error  = 2
      data_error     = 3
      OTHERS         = 4.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
            RAISING invalid_output_file.
  ENDIF.
Above is used to send.
For receiving use
  CALL FUNCTION 'FTP_SERVER_TO_R3'
    EXPORTING
      handle         = w_hdl
      fname          = l_string
      character_mode = 'X'
    TABLES
      text           = it_tab[]
    EXCEPTIONS
      tcpip_error    = 1
      command_error  = 2
      data_error     = 3
      OTHERS         = 4.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
            RAISING invalid_output_file.
  ENDIF.
Hope this will help U.
Pl. award appropriate points.

Similar Messages

  • Sending empty files using SFTP Adapter

    I am trying to send empty files using SFTP adapter. The interface has to send the file whether its empty file or containing data using SFTP adapter. I am using BizTalk Server 2013 R2. Is it a bug or the hotfix is already there for this issue.

    The issue here is not your SFTP not able to send 0KB files, but the file receive adapter that is receiving the file. The file adapter deletes 0 KB files and doest not transmit it further.
    If u have a ftp receive for example you should be able to send 0KB files.
    If u have a custom file receive adapter , is it handling 0KB files ?
    Regards &lt;br/&gt; When you see answers and helpful posts,&lt;br/&gt; please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

  • Host Throttling on receiving files using SFTP

    Hello,
    We have this problem in BTS2006 and now we migrated to BTS2013 and we still have the problem.
    Problem: We are using nSoftware SFTP adapter. Sometimes the host handler gets into idle state on some receive locations. It will not pickup the file until I restart the host instance. We have several RLs running on that particular host instance and they
    all are getting bounced when we restart the host instance. This is happening only on SFTPs. There is no guarantee that the file is delivered successfully. Most of the times business calls us stating the file is not received. The host create 64/32 bit if that
    matters. We have almost 200 interfaces running on each host instances not sure if that matters. I can create more hosts if needed but that would cost some system resources  and thinking of not to do.
    Any help will be greatly appreciated.
    Thanks in advance.

    Since it might be inherited with the software/or volume you migrated from 2006 to 2013, it won't solve automatically just migrating BizTalk version. 
    Did you find out the throttling condition? I would suggest to have a look in to the link http://msdn.microsoft.com/en-au/library/aa559893.aspx which could be the starting point to look into for detecting the catch. 
    I have personally not used nSoftware SFTP adapter but I would suggest using separate host handler for suspected (victim) SFTP send ports and check the figures as per the conditions you identified. Since you already have 2013, it has very nice dashboard (right
    click on the host and go to setting) for you to play with figure. 
    If you share your volume/size of message and what the core process is, probably you would get better suggestion.
    Also worth looking into Host
    Throttling Performance Counters.
    Please mark it as Answer if this answers your question
    Thanks.
    Mo
    The contents I write here is my personal views, not the view of my employer and anyone else.

  • How to send a file using IOCP?

    When using blocking sockets, all I had to do to send a file was to open the file and loop through it and send it in chunks.
    But I find sending a file using overlapped sockets to be more challenging. I can think of the following approach to do it:
    I open the file and send the first chunk, and I keep track of the file handle and file position.
    Now when I get a completion packet indicating that some data has been sent, I check to see if the socket is currently in the process of sending a file, and if it is, I retrieve the file handle and file position and send the next chunk.
    I repeat step 2 until I reach the last chunk in the file, and then I close the file.
    Is this approach correct?
    Note: I don't want to use TransmitFile().

    This approach is more or less correct, but maybe you'd have to know some more things.
    If send "returns" it means, that you buffer has been copied into the internal buffer of system or the network interface card or whatever... in general it means, that you can free/reuse the buffer you have used, but it doesn't mean, that the data
    has been delivered (it does not even mean it has been sent already).
    That's why I'm normally using some flow-control (messages from the receiver) to verify the real data flow.
    The next point is, that you shouldn't read from the file only after you got the ok that the first chunk has been sent. You should read the data as soon as possible so that you can respond much quicker to a send-complete-message. I'd recommend to send using
    multiple buffers.
    Rudolf

  • Need to transfer files using sftp via java api's.

    Hi,
    I got a requirement to transfer files using sftp via java api's.
    Kindly specify any 3rd party Java Libraray to do this.
    The requirements are
    -It must support extensive encryption algorithms.
    -It must allow generating public/private keys and authenticating with server by sending the keys first(before the actual file transmission).
    Thanks.

    Don't resurrect old threads, please. Start your own thread.
    Better yet: google for "Java SFTP", look at what you find and come back when you have a specific question.
    And: when you ask a specific question, then clarify if you're talking about the [SSH file transfer protocol|http://en.wikipedia.org/wiki/SSH_file_transfer_protocol] or about FTPS, which is sometimes (wrongly) called SFTP.

  • I have BIS but can't surf, send/receive email, use apps

    i have BB Curve 8520. My BIS was running smoothly (sending and receiving emails real time and surfing the net through BIS), until i noticed when i tried to reply to an email that came in, it won't send. i noticed that it's fluctuating. i was able to send the email after a few minutes... then a few minutes later, i received a replied email from my friend, and when i tried to send my reply, i wasn't able to. also, i can't surf using the browser with the "internet browser" as default. i tried using my wifi and then suddenly all my emails started coming in, all emails that were not able to go through hours ago. my big question was why do i need to turn on wifi just to receive emails. but since i had my BIS for 2 months now, i can send and receive emails and surf through BIS itself without turning on the wifi.  also, i can't use any of my apps like facebook, twitter, yahoo messenger, etc.  They used to work fine with BIS... but now, i have to turn on the wifi connection, so i could log in with them.  aren't these supposed to be running through BIS only?
    I have GPRS on top, not gprs. my carrier says i have active data plan/BIS. but under Services Status..it says Blackberry Internet Service:  Connection:  not connected...
    so, i wiped out my BB and deleted all third party apps. when this was done, i received emails telling me "Your handheld has been registered with the wireless network" and even got "Activation Server" emails telling me that the emails that i have previously set up are now up and running. so i thought my BB is now ok.. i tried surfing, it was okay. after like about 5 minutes, it was down again. tried sending email but can't... i turned on the wifi and boom! the emails started coming in again.i have the Host Routing Tables and my Service Books in my BB. I have GPRS (not gprs) on top which means i have active BIS.  i have registered my HRTs several times... and resending my service books... same thing...
    the big mystery is when i turn on the wifi, the emails suddenly go through and i can send emails. i can open apps that used to only run on BIS. this is ok i guess, but i could never do any of these if i'm not connected to wifi.
    my sister and i have the same BB... i removed my sim and inserted it to her BB and the BIS worked fine... i was able to surf and use apps.. but when i put my sim back on my phone, the problem still exists.  i even used a different sim card that is also subscribed to BIS/data plan, and it still has the same problem... my guess is my carrier is right that my data plan is working ok and that my handheld itself has the problem... 
    i updated my OS, same problem.. wiped it out... used BBSAK, reinstalled OS... numerous battery pulls... same thing... i can receive the HRTs and service books, but after that can't do anything else like i used to... (send/receive emails, use apps like facebook, twitter, ym, etc., can't surf with internet browser - except when wifi is on everything else work fine even emails and apps).. 
    i would really appreciate your help guys.. thanks!

    Hi tarifiq and welcome to the BlackBerry Support Community Forums!
    Can you send me a private message with your PIN so I can check this out for you?
    Thanks
    -CptS
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • Sending a File Using DataGram Sockets

    I writting one java program that can be used to transfer a file from one computer to another computer.
    I wrote using Sockets.
    But i want to do that using DatagramSockets. Can we send a file using DataGramSockets?
    Please reply soon.

    You can use DataGram but it is harder.
    One issue is you need to retransmit missing packets. This means you need to keep track of which packets have been sent and be able to send missing ones again.
    If Socket work for you why do you want to use DataGrams

  • Send A file Using JMS

    I want to send a file Using JMS.. and want to have
    These Details in the message that send.
    Receivers IP address & The file
    That mean I want to send a File from one client to another client Using a Queue
    Can Anyone help me to solve this problem
    thanks

    Read the file then use a JMS BytesMessage or TextMessage. Add your own JMS header for the recievers ip and any other info you want to annotate the message with.
    Watch out for character encoding and max file size problems.
    If your client / server are not on the same network you're likely to run into firewall issues.
    Don't kid yourself that this will be a transactional solution.
    Assumes both clients are Java (JMS headers are a pain to read otherwise)

  • HT5225 unable to send receive mail using Mail 2.1.3

    Ever since iCloud took over, I am no longer able to send/receive mail using Mail 2.1.3 on my 10.4.11 version.  I didn't think it would affect it.  Someone please help as to how I can rectify the issue!

    Hi,
    Please review the following note:
    Note: 371830.1 - Notification Mailer Does Not Start, Remains In Status Starting
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=371830.1
    If the above does not help, I suggest you run "Workflow Diagnostics" test and see if it returns any error/warning messages.
    Note: 274764.1 - Oracle Workflow Cartridge Workflow Java Mailer Setup Test
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=274764.1
    Note: 378281.1 - How Does One Verify The Notification Mailer Is Functioning Properly?
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=378281.1
    Regards,
    Hussein

  • Issue while archiving the processed file in sender communication channel using SFTP adapter

    Hi All,
    In one of my scenario (File to IDOC), we are using SFTP sender communicationchannel.
    we are facing an issue while archiving the processed file. Some times PI processed the file successfully but unable to archive it and in the next poll PI process & archives the same file successfully which will creates duplicate orders in ECC.
    Please let us know how to resolve this issue.

    Hi Anil,
    Refer Archiving concepts in below links.
    http://help.sap.com/saphelp_nw73/helpdata/en/44/682bcd7f2a6d12e10000000a1553f6/content.htm?frameset=/en/44/6830e67f2a6d12e10000000a1553f6/frameset.htm
    http://scn.sap.com/docs/DOC-35572
    Warm Regards,
    DNK Siddhardha.

  • Receiver File/FTP, SFTP, binary, endSeparator for CRLF ?

    We are planning an interface using the Receiver File/FTP Adapter, using SFTP in binary mode.
    The SAP PI runs on Unix, the other applications runs on Windows.
    Can NameA.endSeparator be used to ensure that every line in this file ends on CRLF?
    (As you know, Windows has the habit of ending lines in text files with CRLF - carriagereturn-linefeed, whereas Unix uses a singe LF - linefeed, also known as newline or nl).

    Yes it can be done with '0x0D''0x0A' value which represents the CR and LF respectively...
    which has been implemented succesfully in our interface...
    HTH
    Rajesh

  • File format while sending a file  using FTP Process

    Hi,
    I am facing a formatting problem when i send a file from SAP application server to a different sever using FTP process.
    The problem is like this:
    Lets say I have a file with 10 records on the application server. When i am downloading this file to a pc, the file is showing 10 lines.
    But when i open the same file on the other server it is showing 10 records as 1 line.
    The file i am sending is a text file.(ex: acc_payable.txt)
    If i open the same file on the other server using word pad it is showing 10 records in 10 different lines.
    I want the file to be opened using notepad and want to see the each record in a different line
    Can anybody help me on this issue
    Regards,
    Radhakrishna

    Another stab at "simplest": can you avoid embedding
    newline characters in the strings
    your write and reply on PrintWriter's
    println() methods instead?But, if I understand the OP, this will cause the same problem. He is running on Unix but wants to generate a DOS type eol. The println() method will use the OS default; therefore, he needs to explicitly specify the DOS eol.

  • How to send large files using web service

    hello everyone,
    I am new to this forum, so please pardon me if I post some silly problem...
    I have created one service which sends file when client (jsp) request it. I am using JBOSS as my server. purpose of this application is when client request some fle then service will send this file... and most of the time we need to send only pdfs and ppts...
    Problem is, this service sends txt, java files easily of any size but when i tried sending PDF, PPT then i got xml.SAXParseException.......
    I thought this error is because of some characters, but how to fix it....
    I am working on Linux.
    code snippet is:
    import java.io.*;
    public class MyHelloService
    public String file_size (String name)
         String s = new String("");
    byte[] sendata1=new byte[100];
         try
              System.out.println("name recived is :::::::::::"+name);
              FileInputStream in=new FileInputStream(name);
              int size=0;
              size=in.available();
              System.out.println("FILE SIZE IS:::::"+size);
              byte[] sendata11=new byte[size];
              i=in.read(sendata11);
              System.out.println(new String(sendata11));
              s=new String(sendata11);
         catch(Exception e)
                   System.out.println("EXCEPTION IN JWS:::"+e);
                   s=new String("nofilefounderror");
         return s;
    pls tell me what am i doing wrong ad how to fix this?
    and one more thing can i send byte array from a web service as i tried but couldnt do that... so i am reading everything in a single byte array and then converted to string.....
    is it possibel to send file in a chunk?if yes, how to do that?
    waiting for the reply..... pls reply as soon as possible....
    Rashi

    hi,
    I am sending file from server to client i.e client will request for a file and service will send it back....... no socket connection is there...I am using JBOSS and apache axis.
    pls help me out.....
    Rashi

  • How to handle empty file using sftp adapter

    Hi,
    Please explain me how to handle empty files in sftp adapter.
    Thanks,
    Enivass

    Hi Enivaas,
                        I don't have the seeburger sftp adapter at hand at the moment, but asfar as I remember, this does not specifically have an empty-file handling option like the standard ftp adapter.
    So to stop emtyp files from being written, guess would need to handle this at the mapping level. For example, check for target creation criteria in the header node in mapping. If the creation criteria is not met, you can throw an error in mapping.
    You may also incorporate this condition in your Receiver determination. In this case, if the condition is not satisfied, no receiver is determined in PI.
    Regards

  • How to send A file using Webservice?

    I heard about webservice when I read through XML...
    It a bit like XML cannot show off it strength without webservice...lol
    What is webservice? What library should I use to send a file from server to client using webservice?
    Webservice is Quite new for me. Any expert here can direct me to the tutorial link that can teach me how to use webservice?
    I go through some code :
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://namespaces.cafeconleche.org/xmljava/ch2/"
    xmlns="http://namespaces.cafeconleche.org/xmljava/ch2/"
    elementFormDefault="qualified">What is xmlns? Is webservice can run it at localhost? My house don't have internet. :(
    Thank....

    to learn webservice..you can try these samples...
    http://www.csd.abdn.ac.uk/~bscharla/teaching/CS5302/practicals/practical8.shtml

Maybe you are looking for

  • How do I email my photos to instructor so extended information can be viewed.  He says they need to be in jpeg file.  When I test copy to myself I cant get this information.

    How do I email my photos from iphoto to my instructor so the extended information can be accessible.  I have tried emailing from share and included titles and descriptions but when I test it to me I can not access the extended info.  Also how can I e

  • Dual Monitor ICC Profiles

    Has anyone had luck setting up ICC profiles for dual monitors? I have created ICC profiles for both my Cinema display and MacBook Pro display but cannot get them to work at the same time. Once I set up an extended desktop my Cinema display grabs onto

  • Foreign Trade Configs

    Hi Everyone, Some one help on Foreign Trade Configuration Step by step. Thanks and Regards, MH

  • Filling empty java array in C method

    Hi everyone, I'm passing to a C method an empty byte array from the Java Side. I want the C method to fill the Java byte array and return it at the end of the method to the java side. in the Java side, I have my byte array : byte[] myArray = null; th

  • Ehancement -payslip.

    Hi, i am trying to rplace text for p0002-famst key with text  from table t502t using conversion 96(added by me in table V_T514C foe country 99 anf form cedt ) . i made implici ehancemevt in program RPCEDSZ9 and add the following code , but still it i