1 、文件下载。
DATA: l_filename TYPE string, "file name
l_path TYPE string, "file path
l_fullpath TYPE string, "full path
l_useraction TYPE i, "user action
l_encoding TYPE abap_encoding. "endocding
" get file to save as
cl_gui_frontend_services=>file_save_dialog(
EXPORTING
default_extension = gco_dot_txt
default_file_name = gco_def_namt
with_encoding = abap_true
file_filter = cl_gui_frontend_services=>filetype_text
CHANGING
filename = l_filename
path = l_path
fullpath = l_fullpath
user_action = l_useraction
file_encoding = l_encoding
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4
).
IF sy-subrc IS INITIAL.
CASE l_useraction.
WHEN cl_gui_frontend_services=>action_cancel.
CLEAR l_fullpath.
MESSAGE i001(00) WITH text-010.
WHEN cl_gui_frontend_services=>action_ok OR
cl_gui_frontend_services=>action_replace.
cl_gui_frontend_services=>gui_download(
EXPORTING
filename = l_fullpath
append = space
write_field_separator = space
trunc_trailing_blanks = gco_true
confirm_overwrite = space
no_auth_check = gco_true
codepage = l_encoding
CHANGING
data_tab = git_etab
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24
).
IF NOT sy-subrc IS INITIAL.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
CLEAR l_fullpath.
ENDIF.
WHEN cl_gui_frontend_services=>action_append.
" no header required
WHEN OTHERS.
CLEAR l_fullpath.
ENDCASE.
ENDIF.
CONCATENATE p_path g_seqno gco_bpt INTO g_path.
cl_gui_frontend_services=>gui_download(
EXPORTING
filename = g_path
* bin_filesize = lv_binary_leng
filetype = gco_bin
CHANGING
data_tab = git_etab
EXCEPTIONS
OTHERS = 1
).
IF sy-subrc <> 0..
ENDIF.
手机扫一扫
移动阅读更方便
你可能感兴趣的文章