‎2006 Dec 04 2:54 AM
hai i am using this function model <b>ws_filename_get.</b>.now i want to replace
<b>cl_gui_frontend_services=> file_open_dialog.</b>how will do this?
‎2006 Dec 04 2:59 AM
Here is a sample program for ya.
report zrich_0001.
data: ifiletable type filetable.
data: xfiletable like line of ifiletable.
data: rc type i.
parameters: p_file1 type localfile default'C:test.txt'.
at selection-screen on value-request for p_file1.
call method cl_gui_frontend_services=>file_open_dialog
EXPORTING
* WINDOW_TITLE =
* DEFAULT_EXTENSION =
* DEFAULT_FILENAME =
* FILE_FILTER =
INITIAL_DIRECTORY = 'C:'
* MULTISELECTION =
changing
file_table = ifiletable
rc = rc
* USER_ACTION =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
others = 4.
.
read table ifiletable into xfiletable index 1.
if sy-subrc = 0.
p_file1 = xfiletable-FILENAME.
endif.
Regards,
Rich Heilman
‎2006 Dec 04 3:10 AM
Hi,
Please check this code,
DATA: li_file_table TYPE filetable,
wa_file_table TYPE file_table,
lws_rc TYPE i,
lws_user_action TYPE i,
lws_filename TYPE rlgrap-filename. "string.
DATA lws_title TYPE string.
CONSTANTS: lc_extn TYPE string VALUE '.XLS',
lc_directory TYPE string VALUE 'C:\'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETER p_path TYPE char250.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
PERFORM f0001_path_request.
The subroutine goes like this....
lws_title = text-003.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = lws_title
default_extension = lc_extn
initial_directory = lc_directory
CHANGING
file_table = li_file_table
rc = lws_rc
user_action = lws_user_action
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE i050 WITH text-004. "#EC*
EXIT.
ENDIF.
IF lws_user_action <> cl_gui_frontend_services=>action_ok.
STOP.
ENDIF.
READ TABLE li_file_table INDEX 1 INTO wa_file_table.
IF sy-subrc = 0.
p_path = wa_file_table-filename.
endif.
-Satya Priya