09-06-2007 8:22 PM
Hi, experts
Please, I need to copy a file via FTP same server but different directory, how can I do this???
I will appreciate it any helfull information, thanks in advance.
Regards
mgg
09-06-2007 8:37 PM
Hi,
Maybe you can use this function "MSS_CALL_SYSTEM" that make a msdos command. So you would only need to move ('Move DIR1\File DIR2\File') or copy the file to the correct directory.
Best regards
Jaime
09-06-2007 8:38 PM
HI,
if the server is same you can just us open data set.. here is the code .. if ur sap is on unix then use the following code to mv the file from one diretory to other.
DATA:
*-- Record Counter
L_COUNT(10) TYPE N,
MSG(100) TYPE C.
DATA : V_LENGTH TYPE I.
DATA: DG_UNIX_LOC(100) TYPE C.
DATA: BEGIN OF DT_TABL OCCURS 0,
LINE(200),
END OF DT_TABL.
DATA: BEGIN OF DT_TABL_HIST OCCURS 0,
LINE(200),
END OF DT_TABL_HIST.
CLEAR: DG_UNIX_LOC.
DG_UNIX_LOC(9) = 'mv /usr/sap/pd1/file.csv /usr/sap/pd2/file.csv '.
DG_UNIX_LOC+9(45) = P_AFILE.
DATA : V_STRING(100) TYPE C.
REFRESH DT_TABL.
CALL 'SYSTEM' ID 'COMMAND' FIELD DG_UNIX_LOC
ID 'TAB' FIELD DT_TABL-SYS.
U can use all the unix commands..
MV to move
cp to copy
ls to list the files etc.
<a href="http://www.indiana.edu/~uitspubs/b017/">Unix Commands</a>
Message was edited by:
Mahesh Raganmoni
09-06-2007 8:39 PM
U can use all the unix commands..
MV to move
cp to copy
ls to list the files etc.
<a href="http://www.indiana.edu/~uitspubs/b017/">Unix Commands</a>
09-06-2007 8:42 PM
Hi,
The code writed below is the same like the function code. It is created for a UNIX computer and with the code move (mv). If you need greater directories you can modify the field table instead to 100 to the number you need (ex 200)
Kind Regards
Jaime
09-06-2007 9:06 PM
Thanks guy all your answer gime an idea how to solve it, but I miss to write that the server is AS400, may I use same logic of UNIX code lines
Regards
mgg
09-06-2007 9:16 PM
HI,
read the conetent of the file into an internal table
delete the file by using DELETE DATASET command
create a file in the required directory and copy the content of the internal table.
just use normal open dataset traster and close dataset commands..these will work irrecpective of the OS.
Thaks
Mahesh
09-07-2007 4:37 PM
Thanks Mahesh ... I was wondering may I do this on AS400 server? I understand that READ/DELETE dataset commands are for files on SAP Server.
Regards
mgg