CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:TEMP'
FILETYPE = 'DAT'
TABLES
DATA_TAB = REC_ITAB.
이것을
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = fname
filetype = ftype
has_field_separator = 'X'
TABLES
data_tab = rec_itab.
이렇게 바꾸었습니다.
그런데 파일 경로 설정 DIALOG가 없어서 만들어주는
cl_gui_frontend_services=>file_open_dialog을 사용해서 만들어 줄려고 하는데
안되네요!!!
* CALL METHOD cl_gui_frontend_services=>file_open_dialog
* EXPORTING
* window_title = '파일 경로 선택'
* default_extension = '*.txt'
* default_filename = fname
** file_filter =
** with_encoding =
* initial_directory = 'C:'
** multiselection =
* CHANGING
* file_table = l_file_table
* rc = l_subrc.
** user_action =
** file_encoding =
** EXCEPTIONS
** file_open_dialog_failed = 1
** cntl_error = 2
** error_no_gui = 3
** not_supported_by_gui = 4
** others = 5
*
* IF sy-subrc = 0.
* LOOP AT l_file_table INTO fname.
* ENDLOOP.
* ENDIF.
이렇게 설정했는데, 무엇이 잘못 된 걸까요??
[아래와 같이 작성해 보았습니다.]
DATA : fname TYPE string VALUE 'C:CBO TESTBVI_C.txt',
ftype TYPE char10 VALUE 'ASC'.
DATA : l_file_table TYPE filetable,
l_subrc LIKE sy-subrc.
START-OF-SELECTION.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = '파일 경로 선택'
default_extension = '*.txt'
default_filename = fname
file_filter =
with_encoding =
initial_directory = 'C:'
multiselection =
CHANGING
file_table = l_file_table
rc = l_subrc.
user_action =
file_encoding =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
others = 5
IF sy-subrc = 0.
LOOP AT l_file_table INTO fname.
ENDLOOP.
ENDIF.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = 'C:TEMP'
FILETYPE = 'DAT'
TABLES
DATA_TAB = REC_ITAB.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = fname
filetype = ftype
has_field_separator = 'X'
TABLES
data_tab = rec_itab.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
rec_itab 해당 하는 인터널 table이 선언이 되어 있지 않내요.
제공 해주신 소스로 테스트 해봤습니다.
DATA : REC_ITAB TYPE STRING OCCURS 0.
DATA : FNAME TYPE STRING VALUE 'C:CBO TESTBVI_C.txt',
FTYPE TYPE CHAR10 VALUE 'ASC'.
DATA : L_FILE_TABLE TYPE FILETABLE,
L_SUBRC LIKE SY-SUBRC.
START-OF-SELECTION.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = '파일 경로 선택'
DEFAULT_EXTENSION = '*.txt'
DEFAULT_FILENAME = FNAME
* file_filter =
* with_encoding =
INITIAL_DIRECTORY = 'C:'
* multiselection =
CHANGING
FILE_TABLE = L_FILE_TABLE
RC = L_SUBRC
* user_action =
* file_encoding =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
OTHERS = 5.
IF SY-SUBRC = 0.
LOOP AT L_FILE_TABLE INTO FNAME.
ENDLOOP.
ENDIF.
* CALL FUNCTION 'UPLOAD'
* EXPORTING
* FILENAME = 'C:TEMP'
* FILETYPE = 'DAT'
* TABLES
* DATA_TAB = REC_ITAB.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FNAME
FILETYPE = FTYPE
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = REC_ITAB.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
BREAK-POINT.
REC_ITAB에 해당하는 인터널 테이블을 string type으로 잡아 봤습니다.