02-26-2007 1:46 PM
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,
02-26-2007 1:53 PM
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
02-26-2007 1:55 PM
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
02-26-2007 1:59 PM
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