2014 Oct 29 11:27 AM
Hi all,
When I kept my file in FTP server without blanks, then I am getting command error.
below is sample code.
CASE1:
concatenate 'get' filename into l_f_command separated by space.
in this case my filename will be: test_mm01_data_execute.xls
call function 'FTP_COMMAND'
exporting
handle = l_f_handle
command = l_f_command
tables
data = l_t_data
exceptions
tcpip_error = 1
command_error = 2
data_error = 3
others = 4.
CASE2:
program logic will be same, but my file name will be: test_mm01 data execute.xls (there is blanks in file name).
in this case I am getting command error.
Can you please help, is there any extra parameters that I have to pass.
Regards,
Prasad
2014 Oct 29 12:00 PM
Hi Prasad,
Please find the below process to upload the file in FTP server.
here pass password and key of the FTP server to below Function module..
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
source = pwd
sourcelen = slen
key = key
IMPORTING
destination = pwd.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'Connect to FTP Server'.
here pass username and pwd of the FTP server to below Function module.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = user
password = pwd
host = host
here pass the filename and content of the file to below function module.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = hdl
fname = lv_filename
* BLOB_LENGTH =
character_mode = 'X'
TABLES
* BLOB =
text = it_text
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
hope it will be useful.
Thanks & Regards,
Polu
2014 Oct 29 2:32 PM
Hi Ankireddy,
Thanks for your reply.
my requirement is not to put file in ftp. instead read file from ftp and put in application server.
I am doing all the things, and working fine. as is said in my first message, problem is only when reading file with and without balnks. ( I mean file name with and without blanks)
Regards,
Prasad
2014 Oct 30 5:56 AM
Hi Prasad,
I tried with and without blanks file, its working fine for me. so please let me know what error you are getting with blanks file.
Thanks & Regards,
Polu
2014 Oct 30 6:20 AM
Hi,
The file name should not have blanks. The command line treats the word after blank as the next command. So in your scenario, (test_mm01 data execute.xls) test_mm01 is teated as file name and data, execute.xls are being treated as arguments for FTP command. Since these are not recognised arguments, command line will throw an error.
While doing FTP, file name should be without blanks as the same rule in DOS command line.
I hope this solves your issue.