forked from liutian1998/NamespaceExchanger4SAPlink
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompareHugeWriter.abap
More file actions
77 lines (63 loc) · 2.4 KB
/
CompareHugeWriter.abap
File metadata and controls
77 lines (63 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"-Begin-----------------------------------------------------------------
Report zTEST.
"-Structures--------------------------------------------------------
Data: Begin Of TestStruc,
ElemInt Type i,
ElemPack Type p,
ElemFlt Type f,
ElemStr Type String,
End Of TestStruc.
"-Variables---------------------------------------------------------
Data:
l_str_Test Like TestStruc,
l_tab_Test Like Standard Table Of TestStruc,
l_rcl_excel Type Ref To ZCL_EXCEL,
l_rcl_worksheet Type Ref To ZCL_EXCEL_WORKSHEETS,
l_rif_excel_writer Type Ref To ZIF_EXCEL_WRITER,
l_cnt_Lines Type i,
l_xlsx_datastream Type XString,
l_dTab Type Table Of x255,
l_len Type i,
l_t0 Type i,
l_t1 Type i
.
"-Main--------------------------------------------------------------
Do 16384 Times.
l_str_Test-ElemInt = sy-index.
l_str_Test-ElemPack = sy-index * 1000.
l_str_Test-ElemFlt = sy-index * '3.14'.
l_str_Test-ElemStr = `Dies ist ein Test ` && sy-index.
Append l_str_Test To l_tab_Test.
EndDo.
If l_tab_Test Is Not Initial.
Describe Table l_tab_Test Lines l_cnt_Lines.
If l_cnt_Lines <= 1048576.
Create Object l_rcl_excel.
l_rcl_worksheet = l_rcl_excel->get_active_worksheet( ).
l_rcl_worksheet->bind_table( ip_table = l_tab_Test ).
Get Run Time Field l_t0.
Create Object l_rif_excel_writer Type ZCL_EXCEL_WRITER_2007.
"Create Object l_rif_excel_writer Type ZCL_EXCEL_WRITER_HUGE_FILE.
l_xlsx_datastream = l_rif_excel_writer->write_file( l_rcl_excel ).
Get Run Time Field l_t1.
l_t0 = l_t1 - l_t0.
Write: l_t0.
Call Function 'SCMS_XSTRING_TO_BINARY'
Exporting
BUFFER = l_xlsx_datastream
Importing
OUTPUT_LENGTH = l_len
Tables
BINARY_TAB = l_dTab.
Call Function 'GUI_DOWNLOAD'
Exporting
BIN_FILESIZE = l_len
FILENAME = 'C:\Dummy\Test.xlsx'
FILETYPE = 'BIN'
Tables
DATA_TAB = l_dTab
Exceptions
Others = 1.
EndIf.
EndIf.
"-End-------------------------------------------------------------------