2006 Jul 03 2:50 PM
Hi Group,
How to move the file from one directory to another on
application server.
2006 Jul 03 2:53 PM
You need to copy it and delete the old. Here is a sample program.
report zrich_0001.
parameters: d1 type localfile default '/usr/sap/TST/<b>OLD</b>/Data1.txt',
d2 type localfile default '/usr/sap/TST/<b>NEW</b>/Data1.txt'.
data: itab type table of string with header line.
start-of-selection.
* Read old
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into itab.
if sy-subrc <> 0.
exit.
endif.
append itab.
enddo.
endif.
close dataset d1.
* Copy to new
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
* Delete the old
delete dataset d1.
Regards,
Rich Heilman
2006 Jul 03 2:53 PM
1. You can do with programatically using data sets.
Read the file
Write into new Location
Delete the old file.
2. Create on OS level command in SM69 ( You can test the same with SM49). Basis person will help you in creating OS command.
Then use SXPG_EXECUTE_COMMAND to move the file.
Regds
Manohar
2006 Jul 03 2:55 PM
2006 Jul 03 2:55 PM
2006 Jul 03 2:58 PM
2006 Jul 03 3:01 PM
Hi nitin,
1. Exactly for this purpose
i have developed an INDEPENDENT SUBROUTINE (FORM)
in which we pass
a) old file name
b) new file name
and it will rename the file
(This will work in WINDOWS Operating system)
(we can modify it very little for other OS also_
2. just copy paste in new program.
3.
Report abc.
*----
PERFORM MYRENAME USING 'D:\CCC.TXT' 'DDD.TXT'.
*----
FORM
*----
form myrename USING oldfile newfile.
data : pm(200) type c.
concatenate '/C REN ' oldfile newfile
INTO PM separated by space.
CALL FUNCTION 'GUI_RUN'
EXPORTING
COMMAND = 'CMD'
PARAMETER = pm
CD =
IMPORTING
RETURNCODE =
.
endform. "myrename
regards,a
amit m.