当前位置:网站首页>SAP salv14 background output salv data can directly save files and send emails (with sorting, hyperlink and filtering format)
SAP salv14 background output salv data can directly save files and send emails (with sorting, hyperlink and filtering format)
2022-04-23 09:31:00 【rogerix4】
1. Code
- All processed data passed SALV Access to
DATA: lr_table TYPE REF TO cl_salv_table.
DATA: lt_data TYPE REF TO data.
DATA: r_xstring TYPE xstring.
DATA binary_tab TYPE solix_tab.
DATA l_length TYPE i.
DATA: ls_layout TYPE lvc_s_layo.
SELECT *
FROM sflight
INTO TABLE @DATA(lt_sflight)
UP TO 50 ROWS.
lt_data = REF #( lt_sflight ).
ASSIGN lt_data->* TO FIELD-SYMBOL(<fs_tab>).
TRY.
cl_salv_table=>factory(
EXPORTING
list_display = abap_false
IMPORTING
r_salv_table = lr_table
CHANGING
t_table = <fs_tab> ).
"field cat
DATA(lt_fcat) = cl_salv_controller_metadata=>get_lvc_fieldcatalog(
r_columns = lr_table->get_columns( )
r_aggregations = lr_table->get_aggregations( ) ).
"layout
cl_salv_controller_metadata=>get_lvc_layout(
EXPORTING
r_columns = lr_table->get_columns( )
r_aggregations = lr_table->get_aggregations( )
CHANGING s_layout = ls_layout ).
"sort
DATA(lt_sort) = cl_salv_controller_metadata=>get_lvc_sort(
r_sorts = lr_table->get_sorts( ) ).
"filter
DATA(lt_filter) = cl_salv_controller_metadata=>get_lvc_filter(
r_filters = lr_table->get_filters( ) ).
"hyperlinks
DATA(lo_functional_settings) = lr_table->get_functional_settings( ).
DATA(lt_hyperlinks) = cl_salv_controller_metadata=>get_hyperlinks(
r_hyperlinks = lo_functional_settings->get_hyperlinks( ) ).
CATCH cx_salv_msg.
RETURN.
ENDTRY.
cl_salv_bs_lex=>export_from_result_data_table(
EXPORTING
is_format = if_salv_bs_lex_format=>mc_format_xlsx
ir_result_data_table = cl_salv_ex_util=>factory_result_data_table(
r_data = lt_data
s_layout = ls_layout
t_fieldcatalog = lt_fcat
t_sort = lt_sort
t_filter = lt_filter
t_hyperlinks = lt_hyperlinks )
IMPORTING
er_result_file = r_xstring ).
"r_xstring It can be sent directly Email perhaps Open Dataset Write to the server or through FTP transmission
" Mode one :
*CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
* EXPORTING
* buffer = r_xstring
* IMPORTING
* output_length = l_length
* TABLES
* binary_tab = binary_tab.
" The way 2:
CALL METHOD cl_bcs_convert=>xstring_to_solix
EXPORTING
iv_xstring = r_xstring
RECEIVING
et_solix = binary_tab.
l_length = xstrlen( r_xstring ).
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_length
filename = `C:\Users\xxxx\Desktop\test.xlsx`
filetype = 'BIN'
CHANGING
data_tab = binary_tab
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.
2. effect
- Generate a on the desktop Excel file
版权声明
本文为[rogerix4]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230623503982.html
边栏推荐
- Leetcode0587. Install fence
- 高薪程序员&面试题精讲系列91之Limit 20000加载很慢怎么解决?如何定位慢SQL?
- 【SQL server速成之路】数据库的视图和游标
- MySQL of database -- overview and installation
- Image processing in opencv -- Introduction to contour + contour features
- Program, process, thread; Memory structure diagram; Thread creation and startup; Common methods of thread
- Two methods of building Yum source warehouse locally
- Where is int a = 1 stored
- Common errors of VMware building es8
- To remember the composition ~ the pre order traversal of binary tree
猜你喜欢
Detailed explanation of delete, truncate and drop principles in MySQL database
Unfortunately, I broke the leader's confidential documents and spit blood to share the code skills of backup files
【SQL server速成之路】数据库的视图和游标
数据清洗 ETL 工具Kettle的安装
MySQL of database -- basic common query commands
ATSS(CVPR2020)
【读书笔记】《Verilog数字系统设计教程》 第5章 条件语句、循环语句和块语句(附思考题答案)
Comparison of overloading, rewriting and hiding
NLLLoss+log_ SoftMax=CE_ Loss
机器学习(六)——贝叶斯分类器
随机推荐
ALV tree (ll LR RL RR) insert delete
【SQL server速成之路】数据库的视图和游标
Give the method of instantiating the object to the new object
LeetCode 1611. The minimum number of operations to make an integer 0
Creation of raid0 and RAID5 and Simulation of how RAID5 works
MySQL of database -- Fundamentals
[C language] document operation
1 + X cloud computing intermediate -- script construction, read-write separation
Applet error: should have URL attribute when using navigateto, redirectto or switchtab
Base de la technologie électronique numérique 3.1 aperçu du circuit de porte, 3.2 circuit de porte à diode semi - conductrice
501. Mode in binary search tree
Secrets in buffctf file 1
Production practice elk
js 原型链的深入
Kettle experiment conversion case
Applet error: cannot read property'currenttarget'of undefined
Alibaba cloud architects interpret the four mainstream game architectures
MySQL of database -- overview and installation
Get trustedinstaller permission
《信息系统项目管理师总结》第八章 项目干系人管理