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

copy a file

please help me for the following questions:

a. what command i should use to know if a file is present in the application server (/usr/sap/trans)?

b. what command i used use to copy a file?

invbal.csv -> invbal1.csv

thanks.

donna

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 Oct 19, 2005 at 09:08 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 09:08 AM

    to find about file existence....

    read dataset (check for sy-subrc = 0 for success)

    to copy file...

    read the file in an internal table (open dataset d1 for input)

    open another file for output (open dataset d2 for output)

    transfer contents of itab into d2.

    close both files. (close dataset)

    rgds,

    PJ

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 09:18 AM

    hi,

    DATA:

    dsn(20) VALUE '/usr/sap/trans/invbal.csv',

    dsncopy(20) VALUE '/usr/sap/trans/invbal1.csv',

    rec(80).

    OPEN DATASET dsn.

    if sy-subrc <> 0.

    file not exits

    exit

    endif

    DO.

    READ DATASET dsn INTO rec.

    IF sy-subrc <> 0.

    EXIT.

    ELSE.

    WRITE / rec.

    ENDIF.

    ENDDO.

    ENDIF.

    CLOSE DATASET dsn.

    OPEN DATASET dsncopy.

    TRANSFER rec TO dir.

    close dataset

    cheers,

    sasi

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 19, 2005 at 10:19 AM

    1. If you want ot check the existence of the file manually just go to AL11 transaction and navigate through the path that you have specified and find the file.

    2. To copy a file open the file using open dataset transfer it to an internal table and then write it in another file.

    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.