‎2009 Oct 09 3:39 AM
Hi All,
I am facing problem on OPEN DATASET. I want to read files from Dev server.
I used FM : EPS_GET_DIRECTORY_LISTING to get the directory.
i am getting 2 files into my itab from that one file i am trying to reading. Error message is : No such file or directory
Can anybody help...
here is the code :
dirname = '/home/sap/empdata.d/'.
call function 'EPS_GET_DIRECTORY_LISTING'
exporting
dir_name = dirname
tables
dir_list = dirlist
loop at dirlist.
concatenate dirname dirlist-name into lv_file.
exit.
endloop.
open dataset lv_file for input in text mode message errtxt.
if sy-subrc ne 0.
write 😕 errtxt.
exit.
endif.
‎2009 Oct 09 3:44 AM
[Hope this link help you.|http://www.sapfans.com/sapfans/alex.htm]
‎2009 Oct 09 3:45 AM
Hi,
I think that the problem with DOT(.) in the directory path.
Try
Instead of
dirname = '/home/sap/empdatad/'.
Thanks
Venkat.Odirname = '/home/sap/empdata.d/'.
‎2009 Oct 09 3:52 AM
Hi Venkat,
If i remove DOT. the FM is not giving any files list into DIRLIST. If i keep DOT i am getting 2 files into DIRLIST.
Is anything wrong in my code.
Thanks.
‎2009 Oct 09 3:57 AM
<li>add ENCODING DEFAULT to OPEN DATA SET and try. <li>Doubt: When OPEN DATASET is run what is the file name you are getting and check that in original directory through AL11. Thanks Venkat.O
‎2009 Oct 09 4:12 AM
Hi,
Funtcion module return all file names DIRLIST related to that directory.
loop at dirlist.
concatenate dirname dirlist-name into lv_file.
open dataset lv_file for input in text mode message errtxt.
exit.
endloop
dirname = '/home/sap/empdata.d/'.
call function 'EPS_GET_DIRECTORY_LISTING'
exporting
dir_name = dirname
tables
dir_list = dirlist
loop at dirlist.
concatenate dirname dirlist-name into lv_file.
exit.
endloop.
open dataset lv_file for input in text mode message errtxt.
‎2009 Oct 09 4:17 AM
Hi All,
My lv_file contains space in file name. Is that cause error. The name i am getting is
/home/sap/empdata.d/2009_1008 TMS Dev.txt
Is that would be any problem ?
Thanks.
‎2009 Oct 09 4:19 AM
This code worked for me:
lv_file is case sensitve.. the path need to exactly same as it shows in AL11...
DATA: dirname TYPE epsf-epsdirnam.
DATA: dirlist TYPE STANDARD TABLE OF epsfili WITH HEADER LINE.
DATA: lv_file TYPE string.
dirname = '/usr/sap/tmp/'.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = dirname
TABLES
dir_list = dirlist.
LOOP AT dirlist.
CONCATENATE dirname dirlist-name INTO lv_file.
EXIT.
ENDLOOP.
OPEN DATASET lv_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
WRITE :/ sy-subrc.
EXIT.
ENDIF.
‎2009 Oct 09 4:24 AM
Hi J@Y,
How can i see AL11, I am unable to find the path /home/sap/empdata.d/.
But my BASIS person said he put 2 files in server. And the function module giving 2 file names.
Any specific directory i needs to see in AL11.
Thanks.
‎2009 Oct 09 4:27 AM
Tr. AL11 > search for your directory name...
once you see the directory double click on the folder and double click on the file name and on the top you can see the file name as its stored in server... the same case and spaces need to be pulled in lv_file..
‎2009 Oct 09 4:29 AM
Hey,
Try this program. Its not giving any problem.
Thanks
Venkat.OREPORT ztest_notepad.
DATA dir_list TYPE TABLE OF epsfili." WITH HEADER LINE.
DATA w_dir_list LIKE LINE OF dir_list.
DATA: path TYPE epsf-epsdirnam VALUE '/tmp/'.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = path
TABLES
dir_list = dir_list.
DATA:file TYPE char80.
LOOP AT dir_list INTO w_dir_list.
CONCATENATE path w_dir_list-name INTO file.
EXIT.
ENDLOOP.
DATA msg TYPE string.
OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE msg.
IF sy-subrc NE 0.
WRITE :/ msg.
EXIT.
ENDIF.
‎2009 Oct 09 4:54 AM
‎2009 Oct 09 5:04 AM
Hi Venkat,
I tried with your code. Still same error i am getting. And in AL11 i am unable to find my file path.
i have only below list in AL11
DIR_ATRA /usr/sap/PD1/DVEBMGS00/data
DIR_BINARY /usr/sap/PD1/SYS/exe/run
DIR_CT_LOGGING /usr/sap/PD1/SYS/global
DIR_CT_RUN /usr/sap/PD1/SYS/exe/ctrun
DIR_DATA /usr/sap/PD1/DVEBMGS00/data
DIR_DBMS /usr/sap/PD1/SYS/SAPDB
DIR_EXECUTABLE /usr/sap/PD1/SYS/exe/run
DIR_EXE_ROOT /usr/sap/PD1/SYS/exe
DIR_GEN /usr/sap/PD1/SYS/gen/dbg
DIR_GEN_ROOT /usr/sap/PD1/SYS/gen
DIR_GLOBAL /usr/sap/PD1/SYS/global
DIR_GRAPH_EXE /usr/sap/PD1/SYS/exe/run
DIR_GRAPH_LIB /usr/sap/PD1/SYS/exe/run
DIR_HOME /usr/sap/PD1/DVEBMGS00/work
DIR_INF_INFORMIXDIR /informix/PD1
DIR_INSTALL /usr/sap/PD1/SYS
But i used old path, i am able to read files. My old path is : /home/sap/data.d/2009011.txt. This file i can read. Only deference i found in OLD and NEW is the file name dont contain any spaces. I am searching options to upload a file into server. Please let me know t-code to upload file into server.
I already tried CG3Z in my system it is not existed. I am using 4.0 version.
Thanks.
‎2009 Oct 09 5:16 AM
Hi All,
Problem got solved. It is because of file name contains space.
Thanks one to all.