10-25-2006 10:17 AM
hi,
is there a possibility to rename, move and/or copy a file from one path to another on the sap-application-server with abap-coding ?
i get pdf-files in a specific folder. then i make some checks for archiving the pdf-file. if the check is not okay i want either to RENAME the file (like setting a flag)....or if not possible i want to move/copy the file in another folder.
i can't find any function modules for it
we are using 4.6c
regards, Martin
10-26-2006 7:53 AM
Use following procedure. You need not pursue UNIX command knowledge for this:
Goto SM49.
Define command, using name and parameters.
Save.
Call function SXPG_COMMAND_EXECUTE with this command.
This way you can achieve required results.
Let me know if you have any further queries.
Don't forget to mark helpful answers!
Gaurav Parmar.
10-25-2006 10:20 AM
you can do, by reading that file name thru opendataset, you can make any changes to the file name.
10-25-2006 10:25 AM
U can surely copy it by reading the file via Open command and writing it to a new file with a different name in the same folder or other. But not 100% sure of move/rename as you would need to delete the file from the server.
Regards
Anurag
10-25-2006 10:30 AM
Another way would be using FTP commands.
1. FM: FTP_CONNECT to connect to the application server.
2. FM: FTP_COMMAND to execute the command at FTP level, like rename, move etc...
3. FM: FTP_DISCONNECT to close the connection.
Kind Regards
Eswar
10-25-2006 10:37 AM
well, ftp would be possible, but it is the last thing i want to use.
i don't understand that there is not a simple function module in sap with which i can RENAME the file....strange
reg, martin
10-25-2006 10:41 AM
Hi,
use open dataset to copy,move file contents to
another folder.
Regards
amole
10-25-2006 10:45 AM
hi amole,
i don't understand how i should use
open dataset for my renaming ??? what
do you mean exactly. open dataset only
opens the dataset for input, etc.........
reg, Martin
10-25-2006 10:47 AM
Hi Martin
Ofcourse we have FM: <b>SXPG_COMMAND_EXECUTE</b> to execute external commands. Please try with the same.
Kind Regards
Eswar
10-25-2006 10:45 AM
Hi Matin,
if you know Unix you can use:
*
DATA: CMD(40).
DATA: BEGIN OF ITAB OCCURS 0,
LINE(200),
END OF ITAB.
Put the Unix-Command in CMD
CALL 'SYSTEM'
ID 'COMMAND' FIELD CMD
ID 'TAB' FIELD ITAB-SYS.
Regards, Dieter
10-26-2006 7:47 AM
10-26-2006 7:53 AM
Use following procedure. You need not pursue UNIX command knowledge for this:
Goto SM49.
Define command, using name and parameters.
Save.
Call function SXPG_COMMAND_EXECUTE with this command.
This way you can achieve required results.
Let me know if you have any further queries.
Don't forget to mark helpful answers!
Gaurav Parmar.