2007 Mar 01 11:36 AM
I want to check if there is a file in a directory in my disk. Hoy can i do it with sap code ?
Is there any FM ?
For example i want to check if the following file exists :
c:\
001.bat
2007 Mar 01 11:52 AM
hi,
u can use CL_GUI_FRONTEND_SERVICES=>FILE_EXIST
call method cl_gui_frontend_services=>file_exist
exporting
file = filename
receiving
result = result .
if result = 'X'.
write:/ 'File is Exists'.
else.
write:/ 'File does not exist'.
endif.
do reward if it helps,
priya.
I want to check if there is a file in a directory in my disk. Hoy can i do it with sap code ?
Is there any FM ?
For example i want to check if the following file exists :
c:\
001.bat
2007 Mar 01 11:38 AM
Hi,
Try the following fun modules:
PC_CHECK_FILENAME
PC_CHECK_FILENAME_WITH_EXT
Regards,
Anji
2007 Mar 01 11:39 AM
Hello,
Check this:
REPORT zdirtest.
DATA lv_dir TYPE rsmrgstr-path VALUE '/usr/sap/trans/data'.
DATA: wa_files TYPE rsfillst,
it_files LIKE TABLE OF wa_files.
START-OF-SELECTION.
CALL FUNCTION 'SUBST_GET_FILE_LIST'
EXPORTING
dirname = lv_dir
filenm = '*'
TABLES
file_list = it_files
EXCEPTIONS
access_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE /1 'Error! :-('.
ELSE.
LOOP AT it_files INTO wa_files.
WRITE: /1 wa_files-name,
wa_files-len.
ENDLOOP.
ENDIF.
If useful reward.
Vasanth
2007 Mar 01 11:40 AM
2007 Mar 01 11:52 AM
hi,
u can use CL_GUI_FRONTEND_SERVICES=>FILE_EXIST
call method cl_gui_frontend_services=>file_exist
exporting
file = filename
receiving
result = result .
if result = 'X'.
write:/ 'File is Exists'.
else.
write:/ 'File does not exist'.
endif.
do reward if it helps,
priya.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |