Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to access Application Server File Attributes

Former Member
0 Likes
1,817

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

4 REPLIES 4
Read only

andreas_mann3
Active Contributor
0 Likes
897

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

Read only

0 Likes
897

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

Read only

rahulkavuri
Active Contributor
0 Likes
897

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.

reference :

Please check the above thread and award points if found helpful

Read only

Former Member
0 Likes
897

hi,

check the FM EPS_GET_FILE_ATTRIBUTES

regards,

priya.