2009 Oct 26 12:04 PM
Hi,
I have to open a file from a server and use the FM CALL FUNCTION 'FTP_COMMAND' to reach to directory, anyone know the command ftp to open the file in directory.
Thanks and Regards,
Eduardo Paiva
2009 Oct 26 1:18 PM
Hi,
you can reach to FTP server..i dont think there is any command avaliable to open the file.
if you want to edit that file then jst copy it, edit it and dump it back to the ftp server.
Thnkx
Rahul
Hi,
you can reach to FTP server..i dont think there is any command avaliable to open the file.
if you want to edit that file then jst copy it, edit it and dump it back to the ftp server.
Thnkx
Rahul
2009 Oct 26 1:18 PM
Hi,
you can reach to FTP server..i dont think there is any command avaliable to open the file.
if you want to edit that file then jst copy it, edit it and dump it back to the ftp server.
Thnkx
Rahul
2009 Oct 26 1:21 PM
Hi,
you can use this code to do the FTP, feild UNIXCOMMAND will hold the name of the UNIX command from sm69. This command is linked to the shell script you create. You can use this link to show you know to create the FTP shell script.
http://datadictionary.blogspot.com/2006/08/unix-shell-script-to-transfer-files.html
The shell script has to be located in the appropriate run folder on UNIX by your basis team so that the script runs.
** These commands must be set up in transaction SM69 first **
DATA: STATUS LIKE BTCXP3-EXITSTAT.
DATA: BEGIN OF EXEC_PROTOCOL OCCURS 0.
INCLUDE STRUCTURE BTCXPM.
DATA: END OF EXEC_PROTOCOL.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
COMMANDNAME = UNIXCOMMAND
TERMINATIONWAIT = 'X'
ADDITIONAL_PARAMETERS = UNIXPARAMS
IMPORTING
STATUS = STATUS
TABLES
EXEC_PROTOCOL = EXEC_PROTOCOL
EXCEPTIONS
NO_PERMISSION = 1
COMMAND_NOT_FOUND = 2
PARAMETERS_TOO_LONG = 3
SECURITY_RISK = 4
WRONG_CHECK_CALL_INTERFACE = 5
PROGRAM_START_ERROR = 6
PROGRAM_TERMINATION_ERROR = 7
X_ERROR = 8
PARAMETER_EXPECTED = 9
TOO_MANY_PARAMETERS = 10
ILLEGAL_COMMAND = 11
WRONG_ASYNCHRONOUS_PARAMETERS = 12
CANT_ENQ_TBTCO_ENTRY = 13
JOBCOUNT_GENERATION_ERROR = 14
OTHERS = 15.
IF SY-SUBRC NE 0 OR STATUS = 'E'.
RAISE NOTEXECUTED.
ENDIF.thanks.
JB
2009 Oct 26 1:59 PM
Hi,
The server that i have to reach isn't a server SAP, i can use FM CALL FUNCTION 'SXPG_COMMAND_EXECUTE' ?
I have a user FTP to logon into the server and with this function a can't logon put the user and password.
Thanks and Regards
Eduardo Paiva
2009 Oct 26 3:12 PM
Hi,
<li>Command should be GET .
<li>Try this way.
Thanks
Venkat.O
"Call FTP_CONNECT function module to open
DATA:cmd(120) type C.
cmd = 'get d:\temp\test.txt'. "GET is command to Copy a file from the remote system to the local system
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = mi_handle
command = cmd
TABLES
data = it_data
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
"Call FTP_DISCONNECT to close FTP connection
2009 Oct 26 3:37 PM
You can do this using the functions below:
CALL FUNCTION 'FTP_CONNECT' EXPORTING user = user password = pass host = host rfc_destination = p_rfc IMPORTING handle = ftphandle EXCEPTIONS not_connected = 1 OTHERS = 2. CALL FUNCTION 'FTP_COMMAND' EXPORTING handle = ftphandle command = 'set passive on' TABLES data = lines EXCEPTIONS tcpip_error = 1 command_error = 2 data_error = 3. CALL FUNCTION 'FTP_SERVER_TO_R3' EXPORTING handle = ftphandle fname = gt_fname-fname IMPORTING blob_length = blen TABLES blob = blob_orj. CALL FUNCTION 'FTP_DISCONNECT' EXPORTING handle = ftphandle. CLEAR ftphandle.
2009 Oct 26 3:39 PM
2009 Oct 26 3:40 PM
2009 Oct 26 3:42 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |