2010 Jul 19 8:32 AM
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,
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
2010 Jul 19 8:40 AM
Hi,
Try using below logic :
Use 'FTP_CONNECT' which is used to work with FTP server in ABAP.
Afetr connection is established now set path on the FTP server. The path where the file is stored on the FTP server. Using this path we will build a command and pass it to the function module FTP_COMMAND.
Use 'FTP_DISCONNECT' to disconnect to FTP server and 'RFC_CONNECTION_CLOSE' to close RFC connection.
Use of the function module FTP_R3_TO_SERVER would copy the contents from an internal table on the FTP server.
Please revert for further Qs
Thanks and Regards,
P.Bharadwaj
2010 Jul 19 9:01 AM
Hi Bharadwaj,
'FTP_CONNECT' itself is failing for me.
I'm using FTP login. I'm not sure if am doing something wrong here or if something wrong in the configuration.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
*-- Your SAP-UNIX FTP user name (case sensitive)
USER = '<Domain-name>\<userid>' "FTP Domain name and userid
PASSWORD = MC_PASSWORD
*-- Your SAP-UNIX server host name (case sensitive)
HOST = '<Remote machine IP>' "FTP server name/IP
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
Thanks,
Sri
Edited by: Sri on Jul 19, 2010 10:04 AM
2010 Jul 19 9:11 AM
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
2010 Jul 19 9:20 AM
Thanks.
I did use http_scramble before FTP_CONNECT. ftp server, username and password (scramble) are used correctly too.
I was wondering if I need anything else on SAP side in order FTP_CONNECT to work.
I've tested FTP programs. RSFTP001passed but RSFTP002 is failing
Thanks,
Sri
2010 Jul 19 10:36 AM
Hi,
Please check RFC connection using transaction SM59.Also try using SAPFTPA .
Thanks and Regards,
P.Bharadwaj
2010 Jul 19 11:39 PM
Hi Bharadwaj,
I realized that FTP_CONNECT takes only ftp locations. I'm using a UNC path that might be the reason for this error.
Is there a way to write/read files from a remote network folder using UNC path?
Thanks,
Sri
2010 Jul 20 8:44 AM
Hi,
For UNC path , The job server needs to run under an account that has permissions to the UNC path that you are trying to schedule. By default, the services are running under a machine account that will likely not have access to the UNC path.
The Universal Naming Convention is a way to identify a shared file in a computer without having to specify (or know) the storage device it is on. In Windows, the UNC name format is:
servername\sharename\path\filename
Please check above.
Thanks and Regards,
P.Bharadwaj
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |