Vous êtes sur la page 1sur 3

abap with alex lee

My ABAP works

Skip to content
 Home
 About

abap with alex lee


My ABAP works

Skip to content
 Home
 About

Move/Copy file to directory at AL11


Posted on May 7, 2013 by btalexlee
Move file to directory at AL11
Copy file to directory at AL11
To copy or move a file from directory at AL11, I have used this
function ARCHIVFILE_SERVER_TO_SERVER.
Take note that if the system is in unix, the path is case sensitive!
for example

/path1/path2/path3/file.xml
is different from
/path1/path2/path3/File.xml
CALL FUNCTION ‘ARCHIVFILE_SERVER_TO_SERVER’
EXPORTING
SOURCEPATH =
* TARGETPATH =‘‘
* IMPORTING
* LENGTH =
* EXCEPTIONS
* ERROR_FILE =1
* OTHERS =2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

After you have copy a file, you may use DELETE DATASET to delete a file.

To add, I also have use this function module to list all the files in a directory

CALL FUNCTION ‘EPS_GET_DIRECTORY_LISTING’


EXPORTING
DIR_NAME =
* FILE_MASK =‘‘
* IMPORTING
* DIR_NAME =
* FILE_COUNTER =
* ERROR_COUNTER =
TABLES
DIR_LIST =
* EXCEPTIONS
* INVALID_EPS_SUBDIR =1
* SAPGPARAM_FAILED =2
* BUILD_DIRECTORY_FAILED =3
* NO_AUTHORIZATION =4
* READ_DIRECTORY_FAILED =5
* TOO_MANY_READ_ERRORS =6
* EMPTY_DIRECTORY_LIST =7
* OTHERS =8

If you face error, it’s might be these following possibility which I faced.
1. Authorisation ( you may use this function module to check , AUTHORITY_CHECK_DATASET )
2. Mode of the directory ( go to AL11, double click a directory, click Attributes, check Mode. It should
have write privileges.
Posted on May 7, 2013 by btalexlee
Move file to directory at AL11
Copy file to directory at AL11
To copy or move a file from directory at AL11, I have used this
function ARCHIVFILE_SERVER_TO_SERVER.
Take note that if the system is in unix, the path is case sensitive!
for example

/path1/path2/path3/file.xml
is different from
/path1/path2/path3/File.xml
CALL FUNCTION ‘ARCHIVFILE_SERVER_TO_SERVER’
EXPORTING
SOURCEPATH =
* TARGETPATH =‘‘
* IMPORTING
* LENGTH =
* EXCEPTIONS
* ERROR_FILE =1
* OTHERS =2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

After you have copy a file, you may use DELETE DATASET to delete a file.

To add, I also have use this function module to list all the files in a directory

CALL FUNCTION ‘EPS_GET_DIRECTORY_LISTING’


EXPORTING
DIR_NAME =
* FILE_MASK =‘‘
* IMPORTING
* DIR_NAME =
* FILE_COUNTER =
* ERROR_COUNTER =
TABLES
DIR_LIST =
* EXCEPTIONS
* INVALID_EPS_SUBDIR =1
* SAPGPARAM_FAILED =2
* BUILD_DIRECTORY_FAILED =3
* NO_AUTHORIZATION =4
* READ_DIRECTORY_FAILED =5
* TOO_MANY_READ_ERRORS =6
* EMPTY_DIRECTORY_LIST =7
* OTHERS =8

If you face error, it’s might be these following possibility which I faced.
1. Authorisation ( you may use this function module to check , AUTHORITY_CHECK_DATASET )
2. Mode of the directory ( go to AL11, double click a directory, click Attributes, check Mode. It should
have write privileges.