08-01-2005 12:09 PM
Hello,
is there a function or method which returns the local drives?
thks
bogdan
08-01-2005 12:44 PM
Hi,
FORM f9008_f4_hlp_for_pc_file.
DATA: li_filetable TYPE STANDARD TABLE OF file_table,
lv_return TYPE i,
lw_filetable TYPE file_table.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select file for download'
default_extension = '.txt'
<b>initial_directory = 'C:'</b> CHANGING
file_table = li_filetable
rc = lv_return
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE e006 WITH text-077.
ELSE.
READ TABLE li_filetable INTO lw_filetable INDEX 1.
v_fnam = lw_filetable-filename.
ENDIF.
Try this out it will open with a pop-up.
If u want more search in this method
<b>cl_gui_frontend_services=>GET_SYSTEM_DIRECTORY
cl_gui_frontend_services=>DIRECTORY_LIST_FILES- this will give Lists Files in a Given Directory</b>
Change the initial directory accordingly.
Message was edited by: Judith Jessie Selvi
08-01-2005 12:14 PM
Hi Bogdan,
You can try function modules 'RZL_READ_DIR_LOCAL' and 'PC_CHECK_DRIVE'
Regards,
Ville
Message was edited by: Ville Leivo
08-01-2005 12:24 PM
Hi Ville,
I need the local dirves list (A: C: ...) for windows platform, not the dir contains.
greetings
Bogdan
08-01-2005 12:55 PM
Hi Bogdan,
I don't know a simple solution to print out the local drives but would it be possible for you to put all the drive letters from A to Z to an internal table. Then use one of the above function modules or that methods to test if the directory exists by looping throught your internal table where you have your drives listed from A to Z.
This is just an idea but wouldn't it work so that when these functions or that method won't return error you print out the drive letter?
I know.. It's not a pretty solution but might work..
Regards,
Ville
08-01-2005 12:44 PM
Hi,
FORM f9008_f4_hlp_for_pc_file.
DATA: li_filetable TYPE STANDARD TABLE OF file_table,
lv_return TYPE i,
lw_filetable TYPE file_table.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select file for download'
default_extension = '.txt'
<b>initial_directory = 'C:'</b> CHANGING
file_table = li_filetable
rc = lv_return
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE e006 WITH text-077.
ELSE.
READ TABLE li_filetable INTO lw_filetable INDEX 1.
v_fnam = lw_filetable-filename.
ENDIF.
Try this out it will open with a pop-up.
If u want more search in this method
<b>cl_gui_frontend_services=>GET_SYSTEM_DIRECTORY
cl_gui_frontend_services=>DIRECTORY_LIST_FILES- this will give Lists Files in a Given Directory</b>
Change the initial directory accordingly.
Message was edited by: Judith Jessie Selvi
08-01-2005 12:52 PM
program below will show an 'X' if files in dir (drive) exist.
types: begin of ts_dir,
dir(1) type c,
end of ts_dir.
data: lt_dirs type table of ts_dir.
data: ls_dirs type ts_dir.
DATA: lv_dir type string.
DATA: lv_result type c length 1.
ls_dirs-dir = 'A'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'B'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'C'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'D'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'E'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'F'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'G'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'H'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'I'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'J'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'K'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'L'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'M'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'N'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'O'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'P'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'Q'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'R'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'S'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'T'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'U'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'V'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'W'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'X'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'Y'. append ls_dirs to lt_dirs.
ls_dirs-dir = 'Z'. append ls_dirs to lt_dirs.
loop at lt_dirs into ls_dirs.
concatenate ls_dirs-dir ':\' into lv_dir.
CALL METHOD cl_gui_frontend_services=>directory_exist
EXPORTING
directory = lv_dir
receiving
RESULT = lv_result
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.
write: / lv_dir, lv_result.
endloop.
its not the nicest solution i think, but it works.
08-01-2005 12:58 PM
Hi,
here's my work around:
DATA: sign.
DATA: BEGIN OF itab OCCURS 0,
device TYPE string,
size(16) TYPE i,
END OF itab.
*
DO VARYING sign FROM sy-abcde(1) NEXT sy-abcde+1(1).
CLEAR itab.
IF sign <> space.
CONCATENATE sign ':' INTO itab-device.
ELSE.
EXIT.
ENDIF.
CALL METHOD cl_gui_frontend_services=>get_free_space_for_drive
EXPORTING
drive = itab-device
CHANGING
free_space = itab-size.
CALL METHOD cl_gui_cfw=>flush.
APPEND itab.
ENDDO.
LOOP AT itab WHERE size > 0.
WRITE: / itab-device, itab-size.
ENDLOOP.
Andreas