I have a parameter and, on F4, we can choose the directory. I'm trying to figure out how to choose a folder and read the content of all the files in it (the files are in .CSV) to an internal table. I think I have to use TMP_GUI_DIRECTORY_LIST_FILES function. Hope I'm explaining myself. Thank you.
-
Please specify if you want to read the files from the application server or the frontend (GUI). – vwegert Oct 11 '12 at 15:06
-
My mistake... forgot to write it. It's from the application server. Thank you – Eva Dias Oct 11 '12 at 15:10
2 Answers
You'll have to do this manually: first read the list of files, the go through each file and process its contents. There may be some odd function modules to read CSV files, but be aware that many of them are broken - for example, they just clip the lines that exceed a certain length. Therefore I won't recommend any of them - personally, I'd implement the CSV import part myself.
-
Thank you. I thought about this way... I'll see if I can get anywhere with your post. Again, thank you very much. – Eva Dias Oct 11 '12 at 15:22
If you have access to the transaction KCLJ
in your system you could analyze the coding behind it. This tool has an option to interpret CSV
files so you might find interesting function modules that might help you with your tasks.
EDIT: I looked at it very quickly and the piece of coding you could reuse is reconvert_format
from include RKCDFILEINCFOR
. An example how to call it is located starting from line 128 in the same include.

- 10,350
- 9
- 51
- 93
-
Thanks, I will look into it... I believe I have access to that transaction and I'll investigate about that function module. Thanks again. – Eva Dias Oct 12 '12 at 08:37
-
There is virtually nothing there that can be reused in the sense of "used again as it is". You'd have to copy it over and modify it massively - no sense in doing that, IMHO. – vwegert Oct 12 '12 at 14:11
-
Have not had a deep look at it but I was thinking of `PERFORM IN PROGRAM` in this case. If this cannot be done you would have to do the copy paste of the code with some adjustments. Still better than reinventing the wheel. If I have some time I will go deeper into it and prepare some encapsulated version of it. – Jagger Oct 12 '12 at 14:19