Retrieve data from files in AL11 and display

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
sapkin
Posts: 2
Joined: Tue Sep 11, 2012 1:36 pm

Retrieve data from files in AL11 and display

Post by sapkin » Tue Sep 11, 2012 2:25 pm

Is it possible to scan through all files in the directory in AL11 and search for a specific message and then display the data from the files for only the ones that have the particular message in it? What the best way to display it as an output? Any help in this is appreciated?
Last edited by Gothmog on Wed Sep 12, 2012 2:05 am, edited 1 time in total.
Reason: CAPSLOCK fixed

YuriT
Posts: 885
Joined: Fri Feb 03, 2006 6:40 am
Location: Basel/Riga

Re: Retrieve data from files in AL11 and display

Post by YuriT » Fri Sep 21, 2012 2:57 am

Well it is possible, but it will take ages. It's basically scanning all files. Open each of them, read dataset and check if string you are looking for exists.

sapkin
Posts: 2
Joined: Tue Sep 11, 2012 1:36 pm

Re: Retrieve data from files in AL11 and display

Post by sapkin » Tue Sep 25, 2012 1:30 pm

I have explained what I need in the below example. Can you let me know if this will be complex too?

What I need is a job that runs daily and picks up the file with the most recent timestamp that searches for a message and if found displays it.

Example: in AL11 we have the 2 files in a folder
20/08/2012 19:00 ABC.txt
19/08/2012 19:00 DEF.txt

ABC.txt contains
"This is a test"

DEF.txt contains
"This is a sample"

On 19th when the program runs it should pick up DEF.txt and search for string "test".
The next day on 20th the program should search ABC.txt and search for "test".

If the text is found an internal table needs to be updated with Timestamp and Text. This needs to be shown as ouput.

Final output:
20/08/2012 19:00 Test.

Post Reply