2014 Feb 06 7:07 AM
Dear Friends,
we are creating a batch job and moving files from AL11 to a specific folder. we have to use SFTP for transferring data instead of FTP.
I seached a lot, but I am not getting solution for this implementation in ABAP
please provide a solution ASAP.
Thanks and regards,
Vinod
Dear Friends,
we are creating a batch job and moving files from AL11 to a specific folder. we have to use SFTP for transferring data instead of FTP.
I seached a lot, but I am not getting solution for this implementation in ABAP
please provide a solution ASAP.
Thanks and regards,
Vinod
2014 Feb 06 7:12 AM
Hi Vinod,
As you mentioned, I think SAP do not provide a SFTP protocol connection. But it provides various FM to have a FTP connection. You can find related FMs in Func Group SFTP and can make use of those FMs in your Program.
I believe SFTP data transfer if supported by Latest SAP PI data communication. Check if you have any SAP PI/XI consultant in your Project
- Harshad
2014 Feb 06 9:13 AM
hello harshad,
what you mean to say is that it is not possible to implement SFTP in ABAP.
Thanks and regards,
vinod
2014 Feb 06 9:41 AM
2014 Feb 06 9:49 AM
2014 Feb 06 10:38 AM
Hi Vinod,
It is possible check the below sample program......
-Satheesh
REPORT zftp_backgroud_app.
DATA:BEGIN OF mtab_data OCCURS 0,
line(132) TYPE c,
END OF mtab_data.
DATA:l_host(64) TYPE c VALUE 'XXX.XXX.XXX.XXX',
cmd(80) TYPE c,
cmd1(80) TYPE c,
compress(20) TYPE c ,
cmd2(80) TYPE c,
pwd(30) TYPE c,
key TYPE i VALUE 26101957,
slen TYPE i,
mi_handle TYPE i.
pwd = 'password'.
cmd1 = 'put d:\test\test2.txt'.
cmd = 'ascii'.
cmd2 = 'cd /tmp'.
compress = 'N'.
SET EXTENDED CHECK OFF.
slen = strlen( pwd ).
AUTHORITY-CHECK OBJECT 'S_ADMI_FCD'
ID 'S_ADMI_FCD'
FIELD 'SFTP'.
IF sy-subrc <> 0.
MESSAGE 'no_authorization' TYPE 'E'.
EXIT.
ENDIF.
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
source = pwd
sourcelen = slen
key = key
IMPORTING
destination = pwd.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = 'root'
password = pwd
host = l_host
rfc_destination = 'SAPFTPA' "'ZRFC_PV' "'SAPHTTPA'
IMPORTING
handle = mi_handle
EXCEPTIONS
not_connected = 1
OTHERS = 2.
IF cmd2 NE ' '.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = mi_handle
command = cmd2
compress = compress
TABLES
data = mtab_data
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
LOOP AT mtab_data.
* WRITE AT / mtab_data.
ENDLOOP.
REFRESH mtab_data.
ENDIF.
IF cmd NE ' '.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = mi_handle
command = cmd
TABLES
data = mtab_data
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
LOOP AT mtab_data.
* WRITE AT / mtab_data.
ENDLOOP.
REFRESH mtab_data.
ENDIF.
IF cmd1 NE ' '.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = mi_handle
command = cmd1
TABLES
data = mtab_data
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
LOOP AT mtab_data.
* WRITE AT / mtab_data.
ENDLOOP.
REFRESH mtab_data.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = mi_handle
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = 'SAPHTTPA' "'SAPFTP' " 'ZRFC_PV' "'SAPHTTPA'
EXCEPTIONS
OTHERS = 1.
2014 Feb 06 11:02 AM
Hi Satheesh,
Here also you are using FTP protocol only. Not the SFTP protocol. It seems you are only trying to check if user has some SFTP authorization. But data is not sent thru SFTP protocol. Ultimately you are sending the data using FTP protocol only.
As far as I remember, SAP has not suported SFTP protocol. But check if any new versions got that support.
- Harshad
2014 Feb 06 11:27 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |