You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/development/xlsx.md
+124-1Lines changed: 124 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -179,7 +179,130 @@ The code snippets above are not compatible with ABAP Cloud, modify the lcl_help
179
179
:::
180
180
181
181
#### abap2xlsx
182
-
Instead of using the code in `lcl_help`, consider taking the easy route and leveraging the wonderful open-source project [abap2xlsx](https://github.com/abap2xlsx/abap2xlsx), which offers reusable APIs for all common XLSX operations. It works entirely within the ABAP stack and, therefore, seamlessly with abap2UI5.
182
+
Instead of using the above XLSX API (which may change between releases), consider leveraging the excellent open-source project abap2xlsx. It provides reusable APIs for common XLSX operations and works entirely within the ABAP stack, ensuring seamless integration with abap2UI5. The following example demonstrates using abap2xlsx in the LCL_HELP class:
183
+
::: code-group
184
+
185
+
```abap
186
+
METHOD z2ui5_if_app~main.
187
+
188
+
client->view_display( z2ui5_cl_xml_view=>factory(
189
+
)->page(
190
+
)->button(
191
+
text = 'Open Download Popup'
192
+
press = client->_event( 'DOWNLOAD' )
193
+
)->stringify( ) ).
194
+
195
+
IF client->get( )-event = `DOWNLOAD`.
196
+
197
+
TYPES:
198
+
BEGIN OF ty_row,
199
+
count TYPE i,
200
+
value TYPE string,
201
+
descr TYPE string,
202
+
END OF ty_row.
203
+
TYPES ty_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY.
204
+
205
+
DATA(lt_tab) = VALUE ty_tab(
206
+
( count = '1' value = `red` descr = `this is a description` )
207
+
( count = '2' value = `red` descr = `this is a description` )
208
+
( count = '3' value = `red` descr = `this is a description` ) ).
If you want to export the data directly at the frontend, SAP offers the sap.ui.export.Spreadsheet control to export table content. With some additional logic, this control is also usable with abap2UI5. Check out the UI-Extension add-on for a running sample [here.](/addons/popup) However, the programming effort might be higher compared to the file-based approach shown above.
0 commit comments