当前位置:网站首页>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
边栏推荐
- JS case to find the maximum value, reverse the array, bubble sort
- 【读书笔记】《Verilog数字系统设计教程》 第5章 条件语句、循环语句和块语句(附思考题答案)
- 考研线性代数常见概念、问题总结
- JSON input of Chapter 14 of kettle paoding jieniu
- Go language learning notes - language interface | go language from scratch
- Secrets in buffctf file 1
- Your guide to lowering your cholesterol with TLC (continuously updated)
- How to render web pages
- Set the maximum width of the body, but why does the background color of the body cover the whole page?
- Alibaba cloud architects interpret the four mainstream game architectures
猜你喜欢
Cross domain configuration error: when allowcredentials is true, allowedorigins cannot contain the special value "*“
kernel-pwn学习(3)--ret2user&&kernel ROP&&QWB2018-core
Unfortunately, I broke the leader's confidential documents and spit blood to share the code skills of backup files
Node installation
Yyds dry goods inventory ubuntu18 0.4 install MySQL and solve error 1698: access denied for user ''root' '@' 'localhost' '
nn. Explanation of module class
Using sqlmap injection to obtain the account and password of the website administrator
npm ERR! network
Kettle experiment
Base de la technologie électronique numérique 3.1 aperçu du circuit de porte, 3.2 circuit de porte à diode semi - conductrice
随机推荐
nn. Explanation of module class
Get trustedinstaller permission
阿里云架构师解读四大主流游戏架构
501. 二叉搜索树中的众数
Unfortunately, I broke the leader's confidential documents and spit blood to share the code skills of backup files
Group Backpack
Codeforces Round #784 (Div. 4)
STM32 and FreeRTOS stack parsing
JS DOM event
JSON input of Chapter 14 of kettle paoding jieniu
【读书笔记】《Verilog数字系统设计教程》 第5章 条件语句、循环语句和块语句(附思考题答案)
SQL used query statements
kernel-pwn学习(3)--ret2user&&kernel ROP&&QWB2018-core
JS node operation, why learn node operation
亚马逊云科技入门资源中心,从0到1轻松上云
[reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)
A must see wechat applet development guide 1 - basic knowledge
Kettle实验 (三)
To remember the composition ~ the pre order traversal of binary tree
《数字电子技术基础》3.1 门电路概述、3.2 半导体二极管门电路