FILE_COPY

Use

Copies the specified file to a new file with the specified name.

Arguments

[IMPORTING] source TYPE STRING

File to be copied. The file name can contain a fully qualified path, a relative path or no path information at all. In the later two cases the current working directory of the GUI will be used as the base directory for locating the specified file. Environment variables are not supported in the file name.

[IMPORTING] destination TYPE STRING

Name under which the copied file should be stored. The name can either contain an absolute path or a relative path. If no path is specified, the file will be stored in the current working directory. The specified name of the copy must not contain environment variables.

[IMPORTING] overwrite TYPE ABAP_BOOL

This flags specifies how the function should proceed if a file with the specified target name already exists. If this flag is set to ABAP_TRUE, any existing file with the specified target name will be overwritten. By default this flag is set to ABAP_FALSE, i.e. an existing file will not be overwritten.

Exceptions

ACCESS_DENIED

If either the source file cannot be accessed for reading or the new file cannot be created in the specified directory, ACCESS_DENIED is raised.

CNTL_ERROR

Thrown if neither Windows nor Java nor Web GUI is being used or calling one of the required front end methods fails because that method is not available.

DESTINATION_EXISTS

If the overwrite flag is not set, this exception is fired when a file with specified target name already exists.

DISK_FULL

This exception is raised if there is not enough space on the target device.

DISK_WRITE_PROTECT

In this case the copied file cannot be created in the desired directory because the drive on which the directory is located is write-protected.

DRIVE_NOT_READY

Fired if the device/system is not ready.

ERROR_NO_GUI

Currently not used.

FILE_NOT_FOUND

FILE_NOT_FOUND is fired if the source file was not found.

NOT_SUPPORTED_BY_GUI

Currently not used.

PATH_NOT_FOUND

If the directory in which the destination file is to be stored cannot be found, this exception is thrown.

UNKNOWN_ERROR

Fired if any other error than the ones listed occurs during copying the file.

WRONG_PARAMETER

This exception is raised if not both a source and a destination file name have been specified.