on 2024 Jan 28 7:41 PM
Hi Experts,
I have a requirement to download the data into an excel file with multiple/two sheets.
I followed the blog "Internal to Excel with multiple sheets and formatting" and just changed only the below area.
ls_xls_cell-styleid = 'Default'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-type = 'String'.
ls_xls_cell-cell_content = lv_ftext. "fieldnames
APPEND ls_xls_cell TO ls_xls_row-cells.
ls_xls_cell-styleid = 'Default'.
CLEAR ls_xls_cell-cell_content.
ls_xls_cell-type = 'String'.
ls_xls_cell-cell_content = lv_vtext. "fieldvalues
APPEND ls_xls_cell TO ls_xls_row-cells.
Rest are all same but I am getting the downloaded file data as shown in the image.
Where I run the blog help program, I can see the output as in the blog i.e., Excel sheet with multiple rows and multiple sheets (Sheet 1 and Sheet 2). Whereas I am getting an incorrect one.
Please help.
Thanks in advance.
Request clarification before answering.
To write to several cells, you must use one APPEND to the internal table per cell.
ls_xls_cell-cell_content = fieldname_1.
APPEND ls_xls_cell TO ls_xls_row-cells. " column A
ls_xls_cell-cell_content = fieldname_2.
APPEND ls_xls_cell TO ls_xls_row-cells. " column B
ls_xls_cell-cell_content = fieldname_3.
APPEND ls_xls_cell TO ls_xls_row-cells. " column C
What you did is to write to only one cell (i.e. only one APPEND), with field names separated with a horizontal tabulation, which writes all the field names into the same cell, not in several cells.
Concerning your issue about only one sheet being generated, I cannot reproduce, my program (based on yours with all non-compiling stuff removed) generates two sheets successfully.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
10 | |
9 | |
6 | |
6 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.