Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Application Server to FTP Server

Former Member
0 Likes
979

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

1 ACCEPTED SOLUTION
Read only

Peter_Inotai
Active Contributor
0 Likes
845

Hi,

Check this great weblog:

/people/thomas.jung3/blog/2004/11/15/performing-ftp-commands-from-abap

Best regards,

Peter

8 REPLIES 8
Read only

Former Member
0 Likes
845

Read only

0 Likes
845

hi karthikeyan,

My doubt is how to refer the data in application server

Read only

Former Member
0 Likes
845

Hi,

Try to see the demo programms RSFTP00*: here you can see how to transfer a file by FTP command.

Regards

Read only

0 Likes
845

hi kiran,

i have been looking into these programs from 2 days but cant not get any help

Read only

Former Member
0 Likes
845

Hi,

Use the fm

FTP_CONNECT

FTP_COMMAND

Regards

Arun

Read only

0 Likes
845

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

Read only

0 Likes
845

Hi,

In the FM 'FTP_CONNECT'

for the host field give the IP address and check

Regards

Arun

Read only

Peter_Inotai
Active Contributor
0 Likes
846

Hi,

Check this great weblog:

/people/thomas.jung3/blog/2004/11/15/performing-ftp-commands-from-abap

Best regards,

Peter