03-24-2012 9:28 PM
Dear Experts,
Iam using the class CL_XML_DOCUMENT to create an xml document out of my itab in an ABAP report.
This file needs to be put in to an ftp server as an xml file.
Iam not sure how to go about it.
Could anyone suggest me how to put the file on the FTP server.
The class has a "export_to_file" method where one has to give a path name.
Any Pointers would be greatly appreciated
Thanks
P
03-26-2012 4:06 AM
Hi Arun ,
U can try like this.....
gd_slen = STRLEN( p_pwd ).
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = p_pwd
sourcelen = gd_slen
key = gd_key
IMPORTING
destination = p_pwd.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = p_user
password = p_pwd
host = p_host
rfc_destination = p_dest
IMPORTING
handle = gd_hdl.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = gd_hdl
command = 'ascii'
TABLES
data = it_result
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = gd_hdl
fname = gd_fname
blob_length = l_count
character_mode = 'X'
TABLES
text = it_final
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3.
if sy-subrc = 0.
write: / 'File uploaded:', gd_fname.
endif.
Regards,
Yukti
03-24-2012 11:06 PM
Hi Arun,
see if this link helps http://lmgtfy.com/?q=abap+ftp+upload or this http://www.sapgeek.net/2011/05/abap-upload-file-to-ftp-server/
Cheers
Adi
03-25-2012 9:25 AM
Hi Arun,
I don't think the method, export_to_file will work to put file in FTP as the FTP needs host name,port name and user credentials.
The following blog may help you:
http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP+solution+to+implement+FTP+transactions
Cheers,
Samir
03-25-2012 10:52 AM
Thanks Guys.
That means I have to download the generated xml file in my application server and then transfer it to the ftp server.Iam using ECC 6.0.
Is that so.I have googled a bit and I have seen people posting abt some formatting problems.
Is downloading to the app.server and from there to the ftp server is the right way.
03-25-2012 9:34 PM
Hi Arun,
no you don't have to download it to the application server. Get the XML contents as an internal table and then use the internal table as the blob parameter to the function module FTP_R3_TO_SERVER.
Cheers
Adi
06-01-2016 6:28 AM
03-26-2012 4:06 AM
Hi Arun ,
U can try like this.....
gd_slen = STRLEN( p_pwd ).
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = p_pwd
sourcelen = gd_slen
key = gd_key
IMPORTING
destination = p_pwd.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = p_user
password = p_pwd
host = p_host
rfc_destination = p_dest
IMPORTING
handle = gd_hdl.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = gd_hdl
command = 'ascii'
TABLES
data = it_result
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = gd_hdl
fname = gd_fname
blob_length = l_count
character_mode = 'X'
TABLES
text = it_final
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3.
if sy-subrc = 0.
write: / 'File uploaded:', gd_fname.
endif.
Regards,
Yukti
06-01-2016 6:29 AM