Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing feature: reader doesn't retrieve the zcl_excel_table objects #1158

Closed
sandraros opened this issue Nov 16, 2023 · 3 comments · Fixed by #1159
Closed

Missing feature: reader doesn't retrieve the zcl_excel_table objects #1158

sandraros opened this issue Nov 16, 2023 · 3 comments · Fixed by #1159

Comments

@sandraros
Copy link
Collaborator

Run the below program, which writes The active sheet contains 0 tables.:

TYPES tt_scarr TYPE STANDARD TABLE OF scarr WITH EMPTY KEY.
DATA(lt_scarr) = VALUE tt_scarr(
    ( carrid = 'AA' carrname = 'American Airlines' )
    ( carrid = 'LH' carrname = 'Lufthansa' ) ).

DATA(lo_excel) = NEW zcl_excel( ).
DATA(lo_worksheet) = lo_excel->get_active_worksheet( ).
lo_worksheet->bind_table( ip_table = lt_scarr ).
DATA(lo_writer) = CAST zif_excel_writer( NEW zcl_excel_writer_2007( ) ).
DATA(lv_xstring) = lo_writer->write_file( lo_excel ).

DATA(lo_excel_reader) = NEW zcl_excel_reader_2007( ).
DATA(lo_excel_2) = lo_excel_reader->zif_excel_reader~load( lv_xstring ).
DATA(lo_worksheet_2) = lo_excel_2->get_active_worksheet( ).

DATA(lv_table_size) = lo_worksheet_2->get_tables_size( ).

WRITE |The active sheet contains { lv_table_size } tables.|.

It should write The active sheet contains 1 tables.

Missing feature.

sandraros pushed a commit to sandraros/abap2xlsx that referenced this issue Nov 16, 2023
@darnoc312
Copy link
Contributor

Hello,

1 ) Please use the new field COLUMN_NAME instead of SCRTEXT_L to avoid truncations > 40 Char.
ls_field_catalog-column_name = ls_table_column-name.
2 ) Please insert the following line and the field totalsrowfunction in structure ls_table_column:
ls_field_catalog-totals_function = ls_table_column-totalsrowfunction.
3 ) Support for ls_fieldcat-column_formula (XML Element calculatedColumnFormula) is missing, too.

Compare to the corresponding behavior of zcl_excel_writer_2007->create_xl_table.

Thank you

@sandraros
Copy link
Collaborator Author

Hello,

1 ) Please use the new field COLUMN_NAME instead of SCRTEXT_L to avoid truncations > 40 Char. ls_field_catalog-column_name = ls_table_column-name. 2 ) Please insert the following line and the field totalsrowfunction in structure ls_table_column: ls_field_catalog-totals_function = ls_table_column-totalsrowfunction. 3 ) Support for ls_fieldcat-column_formula (XML Element calculatedColumnFormula) is missing, too.

Compare to the corresponding behavior of zcl_excel_writer_2007->create_xl_table.

Thank you

I don't see how it's related to this issue.

sandraros added a commit that referenced this issue Dec 25, 2023
@darnoc312
Copy link
Contributor

Hello,

Point 2 reads the totals function attribute (sum, min, max, etc.) of the fieldcatalog which is used again in excel writer 2007.
Else it is lost during the passthrough process via ZDEMO_EXCEL37.
For example try to read and write again the output of ZDEMO_EXCEL22 which uses totals function for 'PRICE'.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants