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

Move a File into an archive folder in application server .

Hi All ,

Is there any FM or BAPI that can transfer File from one folder in to other in application server ??.

I have to move a file into an archive folder after processing it and i am trying with READ DATASET and TRANSFER DATASET.

But using this i am not able to transfer entire data from one file to other as READ DATAST cant read data in to Internal table .

Is there any sample code available so that can move entire records from one file to another file using READ DATASET and TRANSFER DATASET ..??

Thanks in Advance ..

Regards ,

Sijin K P.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 19, 2011 at 02:47 AM

    Sijin,

    You can use ARCHIVFILE_SERVER_TO_SERVER for your purpose but this one limits the size of file paths to 70 characters.

    IF your filenames are longer than that, better to use Transfer dataset line by line and then delete dataset...sample code below...

    * You must be having the contents of your source file into an internal table, suppose gt_data.
    
    OPEN DATASET lv_tgt_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
        IF sy-subrc IS NOT INITIAL.
           "raise error
        ENDIF.
    
        LOOP AT gt_data INTO lv_data.               "source file data table
          TRANSFER lv_data TO lv_tgt_filename.
        ENDLOOP.
    
        CLOSE DATASET lv_tgt_filename.
    
        DELETE DATASET gv_source_filename.          "remove original file
    

    BR,

    Diwakar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 18, 2011 at 03:11 PM

    Hi

    I don't know why you can't use an internal table or READ DATASET and TRANSFER DATASET, so I believe you can try to use the ftp command, see demo program RSFTP008

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 18, 2011 at 03:16 PM

    Why not use READ/TRANSFER Dataset with an xstring instead of an internal table? Never failed me :-O

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 18, 2011 at 11:46 PM

    Create an external command in SM49/SM69 for mv unix command(if your application server is on Unix) , then call the external command via FM SXPG_COMMAND_EXECUTE.

    Hope this is what you were looking for.

    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.