Application Development 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: 

select file from app server

Former Member
0 Kudos

Hi, All

in our application server there will be a file in the following format

\tmp\ebsfiles\From-EBS\sap_oeu_RDC#_yyyymmddhhmmss.txt.

so this file will be comming from our legacy system and will be so many files comming in one day so when ever my program is executed i have have to pick the LATEST FILE can any one send me the logic how i can do this.

thanks,

3 REPLIES 3

Former Member
0 Kudos

Hi siri,

see following function modules might be useful.

F4_FILENAME_SERVER “ File Path on Server

FILE_NAME_GET “ Logical File Path

Regards,

Vishvesh.K

former_member181962
Active Contributor
0 Kudos

Hi Siri,

Use the functionmodule SUBST_GET_FILE_LIST to get the files in a particular directory.

Once you get the files in the directory, sort the files internal table by MOD_DATE and MOD_TIME in descending order.

Then the first file will be the latest file.

Regards,

Ravi

Former Member
0 Kudos

Hi siri,

try this:

CONSTANTS: CMD_LS(50) VALUE 'ls -al \tmp\ebsfiles\From-EBS'.

*

DATA: BEGIN OF ITAB_LS OCCURS 0,

LINE(200),

END OF ITAB_LS.

*

CALL 'SYSTEM'

ID 'COMMAND' FIELD CMD_LS

ID 'TAB' FIELD ITAB_LS-SYS.

*

loop at itab_ls . write: / ITAB_LS-LINE+57(30). endloop.

Put ITAB_LS-LINE+57(30) in an internal table, sort this table, take the

first record of this table and do what you want with this.

hope it helps.

Regards, Dieter