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

Moving read only flatfile to folder.

Hi all.

I have a problem i hope someone can help me with.

I am reading a flatfile from a server-library. After the file has been read and the information have been processed, it has to be moved to a backup folder. This is the code im using:

CONCATENATE p_dirnam '' file_list-name INTO l_fil1.
    CONCATENATE p_dirnam '' c_arkivdir
                               file_list-name INTO l_fil2.
    OPEN DATASET l_fil1 FOR INPUT IN TEXT MODE.
    IF sy-subrc = 0. "should always be OK
      OPEN DATASET l_fil2 FOR OUTPUT IN TEXT MODE.
      IF sy-subrc = 0.
        DO.
          READ DATASET l_fil1 INTO l_rec.
          IF sy-subrc NE 0.
            EXIT.
          ENDIF.
          TRANSFER l_rec TO l_fil2.
        ENDDO.
        CLOSE DATASET l_fil2.
        CLOSE DATASET l_fil1.
* Slet input-fil
        DELETE DATASET l_fil1.

Now the problem is that the file is and has to be read only, and this apparently interferes with the copying. What can i do, is there another way of copying a flatfile i can use??

Regards

Liselotte

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on May 24, 2005 at 08:20 AM

    Hi Liselotte,

    if it's read-only, then deleting is prohibited. This is also end of 'MOVE', because move is build with copy and delete (from authority point of view).

    Either you get more rights, or you just can copy.

    Regards,

    Christian

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 24, 2005 at 08:41 AM

    Hi ,

    look at this link:

    how-to-move-a-file-from-one-folder-to-another-usin

    regards Andreas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 24, 2005 at 08:42 AM

    Hi Liselotte,

    you may want to try a "move" OS-command (like "mv" in Unix, or "ren" in VMS), instead of programming the write-and-delete by yourself in ABAP.

    In order to do so, you may use

    CALL 'SYSTEM'
      ID 'COMMAND' FIELD l_command
      ID 'TAB'     FIELD lt_outp-*sys*.
    

    Best regards,

    Alvaro

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Liselotte,

      don't spend your time on several coding solutions - you are facing a authority problem (which you can only solve by coding, when you use operation system bugs).

      When your file is read-only, then no matter if you try operation system or sap system commands - you can't delete or move it. That's the fact. If it's required to move this file after processing, then you need more rights to access this file - it's simply that.

      Regards,

      Christian

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.