Application Development 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: 

rename/move/copy file possible ?

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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 REPLIES 10

Former Member
0 Kudos

you can do, by reading that file name thru opendataset, you can make any changes to the file name.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

Hi,

use open dataset to copy,move file contents to

another folder.

Regards

amole

0 Kudos

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

0 Kudos

Hi Martin

Ofcourse we have FM: <b>SXPG_COMMAND_EXECUTE</b> to execute external commands. Please try with the same.

Kind Regards

Eswar

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Martin,

problem solved?

regards, Dieter

Former Member
0 Kudos

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.