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:
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |