Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Hello ,

I am posting this blog to list out my findings of the possibility of Connecting to a server enabled with  SFTP from a Abap program.

I have been given this requirement from my company that i create a report and transfer it to a server which has been changed from normal FTP to SFTP.

In my previous blogs i have already listed the process of using Function Modules to transfer using normal FTP.

I hope this blog helps people understand the limitations of sap abap in using sftp

SAP ABAP has the Functionality to write/Read on FTP server, but there is no functionality in ABAP to read /Write on SFTP server. The code will not work with SFTP server .

 

Please refer to  SAP Note 795131 - FAQ: How to make Secure FTP communication with SAPFTP.

 

SAP recommendations

Sap’s recommendation to read/write to SFTP server is by using PI (Process Integration) solution.

Option 1

 

Server side scripting commands to write to SFTP server from SAP Application Server with the help of an open Source FTP client (WinSCP).I was able to write the script for this in a notepad .

code.

option batch abort

option confirm off

open sftp://username:password@192:192:192:192:9952   { where 192.192.192.192 is the server address and 9952 is the port number }

put F:\check.txt  { This is a local file i created that can be transferred to check the put statement}

close

exit

Note : If you want to test this code above please install WinSCP and open Winscp.com . Type the code step by step and you will connect and put the file.

The challenge here was that i replicate this using External Commands in SM69 in SAP .So i got to it but the issue here was our system needed some upgrades from a Basis point of view where enabling of External Commands was possible. This is how far i got .

Note : If any one who reads this blog has implemented External Commands from SAP to transfer SFTP please share .

Option 2

Secure File Transfer Protocol (SFTP) can be achieved using SSH (Secure Socket Shell

The flow of the data goes as follows:

  1. Firstly the SSH (client local/daemon local) is configured as per the Vendors instructions.
  2. The SSH client is installed to the client system while the SSH daemon is installed to the FTP server.
  3. The data is sent from SAPFTP to the local port of the SSH client and this makes the data secure (encrypts the data).
  4. Then the SSH client sends this data to the SSH server daemon which decrypts the data and forwards the data to the FTP server.

SSH can be configured for both Active and Passive mode of FTP communication.

Conclusion

There is no straight forward method to transfer to a SFTP server .

Thank you .

Please do post comments and feedback to help me improve my content.

11 Comments