on 12-16-2005 9:53 AM
Hi Friends,
I am currently using FTP_Connect, FTP_command and FTP_disconnect to get/put a file from a remote server.
But the file name was changed to add a date/time stamp.
So the filename became dynamic (example from 'test.txt' to 'test_200512160800.txt').
I tried using get test. but my FTP command failed. Do you know anyway of doing this?
Thanks.
Hi LeGo,
you may create a script (using ABAP-command TRANSFER)
for FTP like this
<b># FTP Script
ftp -n -v <<EOF
open 125.123.83.70
user .FTPUSER password
ascii
get /...remotefile /usr/...localfile
quit
EOF</b>
and then excecute the script with
<b>SXPG_COMMAND_EXECUTE</b> (see docu)
first define an extern command with SM69
Viktor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
use fm EPS_GET_DIRECTORY_LISTING
sample:
concatenate 'test_' sy-datum '*.txt' into mask.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
destination dest
EXPORTING
DIR_NAME = verz
FILE_MASK = mask
IMPORTING
FILE_COUNTER = cnt_file
ERROR_COUNTER = err_file
TABLES
DIR_LIST = dir_list
EXCEPTIONS
INVALID_EPS_SUBDIR = 1
SAPGPARAM_FAILED = 2
BUILD_DIRECTORY_FAILED = 3
NO_AUTHORIZATION = 4
READ_DIRECTORY_FAILED = 5
TOO_MANY_READ_ERRORS = 6
EMPTY_DIRECTORY_LIST = 7
OTHERS = 8.
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lego,
here's another sample for the fm:
REPORT ztest_epsf.
PARAMETERS: date LIKE sy-datum,
dir TYPE epsf-epsdirnam,
pattern TYPE epsf-epsfilnam,
zid LIKE vers_dest-rfcdest.
DATA dir_list LIKE epsfili OCCURS 0 WITH HEADER LINE.
DATA cnt_file TYPE epsf-epsfilsiz.
DATA err_file TYPE epsf-epsfilsiz.
START-OF-SELECTION.
IF date IS INITIAL.
date = sy-datum.
ENDIF.
*build pattern with input-pattern and date
CONCATENATE pattern date '*' INTO pattern.
*search for files in foreign system
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
DESTINATION zid
EXPORTING
dir_name = dir
file_mask = pattern
IMPORTING
file_counter = cnt_file
error_counter = err_file
TABLES
dir_list = dir_list
EXCEPTIONS
invalid_eps_subdir = 1
sapgparam_failed = 2
build_directory_failed = 3
no_authorization = 4
read_directory_failed = 5
too_many_read_errors = 6
empty_directory_list = 7
OTHERS = 8.
WRITE: / pattern.
ULINE.
LOOP AT dir_list.
WRITE: / dir_list-name.
ENDLOOP.
ULINE.
WRITE: / cnt_file.
WRITE: / err_file.
pls reward points for useful hints.
thanks and
regards Andreas
Hi Lego,
IF WE PROVIDE THE WRONG DESTINATION
THEN SY-SUBRC WILL BE 8
(I JUST TRIED AND SAW)
1. see tcode sm59
(ur basis team might help u)
2. under the node
R/3 connections,
various connections are setup
to use.
3. U can use one of them (in your DESTINATION 'XYZ')
if it serves ur purpose.
regards,
amit m.
Message was edited by: Amit Mittal
Hello friends. I now know the solution, I figured out just now. Just use 'mget' or 'mput'. Just want to share to those who don't know this yet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.