2021 Sep 24 7:48 AM
Hi, I have an excel file with headers and an internal table. But order of the headers in the excel file is different from my internal table. What i wanna do is append them into corresponding columns. Any leads?
Hi, I have an excel file with headers and an internal table. But order of the headers in the excel file is different from my internal table. What i wanna do is append them into corresponding columns. Any leads?
2021 Sep 24 8:50 AM
2021 Sep 24 9:04 AM
Hello, what I want is read an excel file from my computer and output it to ALV.
2021 Sep 24 9:06 AM
2021 Sep 24 5:55 PM
c5e08e0478aa4727abc4482f5be390b2 I don't find a demo program just to show how simple it is to read, with minimal output of the result. I mean without using lcl_output=>output because beginners may not understand why it's so complex behind the scene. Maybe it could be a demo program added to abap2xlsx?
Example to read the first worksheet and display its contents (syntax errors, missing code needs to be completed):
PARAMETERS file TYPE string.
START-OF-SELECTION.
DATA(file_contents) = VALUE solix_tab( ).
cl_gui_frontend_services=>gui_upload( ... file_size ... file_contents ).
DATA(xstring) = cl_bcs_convert=>solix_to_xstring( IT_SOLIX = file_contents IV_SIZE = file_size ).
DATA(lo_reader) = NEW zcl_excel_reader_2007( ).
DATA(lo_excel) = lo_reader->zif_excel_reader~load( i_excel2007 = xstring ).
DATA(lo_worksheet) = lo_excel->get_worksheet_by_index( i ).
LOOP AT lo_worksheet->sheet_content ASSIGNING FIELD-SYMBOL(<cell>).
WRITE : / <cell>-cell_row, <cell>-cell_column, <cell>-cell_value.
ENDLOOP.
2021 Sep 24 6:08 PM
The one I mentioned does show how to read a file, though it might not be the most concise example possible 🙂
I think we discussed restructuring the examples in a bug report or another but, yeah, this is worth adding perhaps.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |