‎2007 Aug 02 10:31 AM
Hello all,
please suggest some methods to send data from application server to target FTP server.
Can not use FTP_COPY....as i do not have source information
‎2007 Aug 02 11:09 AM
Hi,
Check this great weblog:
/people/thomas.jung3/blog/2004/11/15/performing-ftp-commands-from-abap
Best regards,
Peter
‎2007 Aug 02 10:34 AM
‎2007 Aug 02 10:40 AM
hi karthikeyan,
My doubt is how to refer the data in application server
‎2007 Aug 02 10:44 AM
Hi,
Try to see the demo programms RSFTP00*: here you can see how to transfer a file by FTP command.
Regards
‎2007 Aug 02 10:46 AM
hi kiran,
i have been looking into these programs from 2 days but cant not get any help
‎2007 Aug 02 10:47 AM
‎2007 Aug 02 11:01 AM
the code that i made is:
DATA: file_name(100) TYPE c.
DATA: l_hdl TYPE i.
DATA: l_slen TYPE i.
DATA: l_key TYPE i VALUE 26101957.
DATA: l_filesize TYPE i,
l_filedate TYPE c LENGTH 10,
l_filetime TYPE c LENGTH 10.
DATA: l_pwd TYPE c LENGTH 50 VALUE 'awit01'.
DATA: lt_data(4096) TYPE c OCCURS 0.
file_name = 'SLIT_DWHKunde_VBAK_20070801080155.dat.gz'.
l_slen = STRLEN( l_pwd ).
*sxpgcolist-parameters.
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = l_pwd
sourcelen = l_slen
key = l_key
IMPORTING
destination = l_pwd.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = 'pctemu'
password = l_pwd
host = 'e8dtk.krf01.telekom.de'
rfc_destination = 'SAPFTP'
IMPORTING
handle = l_hdl
EXCEPTIONS
not_connected = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*********************************************************************
DATA: l_cmd(80) TYPE c,
l_fil(80) TYPE c VALUE '/usr/sap/EWT/DVEBMGS00/work/',
l_loc TYPE i," VALUE '/usr/sap/EWT/DVEBMGS00/work/',
l_lng TYPE i.
DATA: BEGIN OF t_result OCCURS 0,
line(100) TYPE c,
END OF t_result.
DATA: v_ftploc TYPE c LENGTH 50 VALUE '/export/home/pctemu/DWH/'.
Change remote directory
CONCATENATE l_fil file_name INTO file_name.
CLEAR l_cmd.
CONCATENATE 'cd' v_ftploc INTO l_cmd SEPARATED BY space.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = l_hdl
command = l_cmd
TABLES
data = t_result
EXCEPTIONS
tcpip_error = 01
command_error = 02
data_error = 03
OTHERS = 04.
IF sy-subrc NE 0.
MESSAGE e200(zhr) WITH 'Unable to issue command:'(021) l_cmd.
ENDIF.
Find the local directory
l_loc = 1.
WHILE sy-subrc EQ 0.
SEARCH file_name FOR '/' STARTING AT l_loc.
IF sy-fdpos GT 0.
ADD sy-fdpos TO l_loc.
l_cmd = file_name(l_loc).
l_lng = 60 - l_loc.
l_fil = file_name+l_loc(l_lng).
ELSE.
ADD 1 TO l_loc.
ENDIF.
ENDWHILE.
CLEAR l_cmd.
l_cmd = '/usr/sap/EWT/DVEBMGS00/work/'.
Change the local location to the file output
CONCATENATE 'lcd' l_cmd INTO l_cmd SEPARATED BY space.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = l_hdl
command = l_cmd
TABLES
data = t_result
EXCEPTIONS
tcpip_error = 01
command_error = 02
data_error = 03
OTHERS = 04.
IF sy-subrc NE 0.
MESSAGE e200(zhr) WITH 'Unable to issue command:'(021) l_cmd.
ENDIF.
Send a file
CLEAR l_cmd.
CONCATENATE 'put' file_name INTO l_cmd SEPARATED BY space.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = l_hdl
command = l_cmd
TABLES
data = t_result
EXCEPTIONS
tcpip_error = 01
command_error = 02
data_error = 03
OTHERS = 04.
IF sy-subrc NE 0.
MESSAGE e200(zhr) WITH 'Unable to issue command:'(021) l_cmd.
ELSE.
MESSAGE i200(zhr) WITH text-022. "File FTP'ed to the server.
ENDIF.
*******************************************************************
but this does not work
‎2007 Aug 02 11:10 AM
Hi,
In the FM 'FTP_CONNECT'
for the host field give the IP address and check
Regards
Arun
‎2007 Aug 02 11:09 AM
Hi,
Check this great weblog:
/people/thomas.jung3/blog/2004/11/15/performing-ftp-commands-from-abap
Best regards,
Peter