2006 Dec 20 12:18 PM
Hi All,
I have a requirement to access a application server directory. (Transaction Code AL11). I have a directory path with me. I need to check all the files exists in that directory. The file which is <b>most recent</b>, i need to copy its data into another directory. I have to perform this through ABAP program. Have anyone done similar thing before? I know that there are certain FMs through which you can execute UNIX command but i am not sure on that.
I would appreciate if anyone can help me in this.
Regards,
Jignesh
Hi All,
I have a requirement to access a application server directory. (Transaction Code AL11). I have a directory path with me. I need to check all the files exists in that directory. The file which is <b>most recent</b>, i need to copy its data into another directory. I have to perform this through ABAP program. Have anyone done similar thing before? I know that there are certain FMs through which you can execute UNIX command but i am not sure on that.
I would appreciate if anyone can help me in this.
Regards,
Jignesh
2006 Dec 20 12:21 PM
Hi,
use fm EPS_GET_FILE_ATTRIBUTES
use that sample:
REPORT zforum66 .
TABLES epsf.
PARAMETERS dir LIKE epsf-epsdirnam DEFAULT '/home/usr/'.
PARAMETERS file LIKE epsf-epsfilnam DEFAULT 'test01'.
DATA mtime TYPE p DECIMALS 0.
DATA time(10).
DATA date LIKE sy-datum.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
file_name = file
dir_name = dir
IMPORTING
file_size = epsf-epsfilsiz
file_owner = epsf-epsfilown
file_mode = epsf-epsfilmod
file_type = epsf-epsfiltyp
file_mtime = mtime
EXCEPTIONS
read_directory_failed = 1
read_attributes_failed = 2
OTHERS = 3.
PERFORM p6_to_date_time_tz(rstr0400) USING mtime
time
date.
WRITE: / mtime,
/ date, time.
A.
Message was edited by:
Andreas Mann
2006 Dec 20 12:26 PM
Hi,
Actually the thing is I dont have file name with me. I need to find out in whole directory that which file is latest?
Regards,
Jignesh
2006 Dec 20 12:22 PM
REPORT zsha_file_attributes.
TABLES epsf.
PARAMETERS dir LIKE epsf-epsdirnam DEFAULT '/home/user1/'.
PARAMETERS file LIKE epsf-epsfilnam DEFAULT 'file001.dat'.
DATA mtime TYPE p DECIMALS 0.
DATA time(10).
DATA date LIKE sy-datum.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
file_name = file
dir_name = dir
IMPORTING
file_size = epsf-epsfilsiz
file_owner = epsf-epsfilown
file_mode = epsf-epsfilmod
file_type = epsf-epsfiltyp
file_mtime = mtime
EXCEPTIONS
read_directory_failed = 1
read_attributes_failed = 2
OTHERS = 3.
PERFORM p6_to_date_time_tz(rstr0400) USING mtime
time
date.
WRITE: / mtime,
/ date, time.
Please check the above thread and award points if found helpful
2006 Dec 20 12:24 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |