02-20-2008 4:34 PM
Can anyone provide me with a FUNCTION MODULE which reads all the files available in a UNIX directory?
I have the UNIX directory given. I need to find all the files available in that particular Directory so that I can choose and process accordingly. Probably I can store all files in an Internal Table.
Thanks in advance.
Sunil
02-20-2008 4:52 PM
02-20-2008 4:40 PM
Hi,
Function module /SAPDMC/LSM_F4_SERVER_FILE is probably a bit more interactive than you want, as it displays a popup with the directory content. However if you drill into the code you can see how this reads the operating system and you could reuse the code in it.
Regards,
Nick
02-20-2008 4:50 PM
Hi Nick,
Thankyou very much for the response.
The Function Module /SAPDMC/LSM_F4_SERVER_FILE is interactive wherein we can select only one file.
But my requirement is I need to collect (probably in an internal table) all the files exixting in the given UNIX directory.
Can you please find in that direction. I would be very grateful.
Thanks.
Sunil
02-20-2008 4:54 PM
Hi Sunil,
Yes, that is what I said in my post. The function module is interactive, but if you look at the code in the function module you can see how it reads the directories.
I don't know of a function module that just gives you what you ask, but there is a function module that can help you build something to meet your requirement.
Regards,
Nick
02-20-2008 4:52 PM
02-20-2008 5:05 PM
Hi Thomas, Thankyou very much for the reply.
Can you please tell me what should be given for FILENM parameter. This is a mandatory parameter. I am looking for storing all the files available in the given UNIX directory DIRNAME.
Can you please help.
Thanks.
Sunil
02-20-2008 8:54 PM
No problem. If you fill just an asterisk * in FILEN, it will return all files and directories in the given directory. You could also use a search pattern like "INPUT*", returning all files/directories that start with INPUT...
You get the idea.
Cheers
Thomas
02-21-2008 6:20 AM
Hi Thomas,
I have given all the parameters as you mentioned. I gave '' for FILNM and filled PATTERN with 'A'. Still I dont find solution to my problem. I am getting exception ACCESS_ERROR. Sy-subrc became 1. I have access to AL11. I can see all the files and directories in application server.
Can you please help.
Thanks.
Sunil
02-21-2008 1:19 PM
Hi Thomas,
Thankyou very much for the answer. My problem got solved. Initially I got exception ACCESS_ERROR because I entered the name in uppercase. Dirname should be lower case.
Anyhow Thanks Once Again!!!
Sunil
02-21-2008 3:38 PM
yes, you have to observe capitalization on unix file systems.
Glad it worked OK.
Greetings
Thomas
03-12-2008 3:49 PM
Hi Thomas,
I got a problem with the Function Module SUBST_GET_FILE_LIST. It is working fine but when the UNIX directory is more than 40 characters it is not working as importing parameter DIRNAME only allows 40 chars. I have to retain the functionality, but can be able to enter UNIX dirctoey more than 40 characters.
Kindly provide me with the solution.
Thanks in advance.
Sunil
06-24-2008 7:58 AM
copy the FM subst_get_file_list to your own Z FM ,then modify the parameters