Skip to Content
author's profile photo Former Member
Former Member

rename/move/copy file possible ?

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 26, 2006 at 06: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 25, 2006 at 09:20 AM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 25, 2006 at 09: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 25, 2006 at 09: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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Oct 25, 2006 at 09:41 AM

    Hi,

    use open dataset to copy,move file contents to

    another folder.

    Regards

    amole

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 25, 2006 at 09: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 26, 2006 at 06:47 AM

    Hi Martin,

    problem solved?

    regards, Dieter

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.