st程序:
调用程序:
*&---------------------------------------------------------------------*
*& Report YSTRANS001
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report ystrans001
.
data
: gv_xml
type string
,
li_binary_tab
type
standard
table
of char255
with
header
line
.
data
: lv_filename
type string
,
lv_path
type string
,
lv_fullpath
type string
,
lv_user_action
type
i
.
data
:
begin
of gs_result
,
sid
type char10
,
pwd
type char20
,
end
of gs_result
.
gs_result
-sid
=
'zgh'
.
gs_result
-pwd
=
'123456'
.
call transformation ytest0001
source userinf
= gs_result
result xml gv_xml
.
call
function
'CONVERT_STRING_TO_TABLE'
exporting
i_string
= gv_xml
i_tabline_length
=
'255'
tables
et_table
= li_binary_tab
.
concatenate
'财务月度报表' sy
-datum
into lv_filename
.
call
method cl_gui_frontend_services
=>file_save_dialog
exporting
default_extension
=
'xlsx'
file_filter
= cl_gui_frontend_services
=>filetype_excel
default_file_name
= lv_filename
changing
fullpath
= lv_fullpath
filename
= lv_filename
path
= lv_path
user_action
= lv_user_action
exceptions
cntl_error
=
1
error_no_gui
=
2
not_supported_by_gui
=
3
others
=
4
.
call
function
'GUI_DOWNLOAD'
exporting
* BIN_FILESIZE =
filename
= lv_fullpath
filetype
=
'BIN'
append
=
' '
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
* SHOW_TRANSFER_STATUS = ABAP_TRUE
* IMPORTING
* FILELENGTH =
tables
data_tab
= li_binary_tab[]
* FIELDNAMES =
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
others
=
22
.