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

Autofilter Solutions for excel writer #1131

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

darnoc312
Copy link
Contributor

Continued from pull request #985 and trying to solve #1017, but i can not reproduce any problems with date format.

Update zcl_excel_converter_alv->get_filter to avoid too many values.

Update zcl_excel_writer_2007->create_xl_sheet_sheet_data to work with multiple values for multiple columns.
Old field l_autofilter_hidden = 'X' is now represented by an entry for each filter column in table lt_cols2match.

If you use for example ZDEMO_EXCEL32 for testing be careful using ZDEMO_EXCEL33 at the same time.
Unfortunately ZDEMO_EXCEL33 calls method zcl_excel_converter->set_option instead of using the is_option parameter of the immediately following zcl_excel_converter->convert method call.
So these options, which don't contain filter = 'X', remain and the defaults of method zcl_excel_converter->init_option are not used for any further convert method call with ALV (like in ZDEMO_EXCEL32) until the 'EXCEL_username' record is deleted from database INDX.
Otherwise the only workaround is the explicit use of the is_option parameter of convert method call like attached to #1017.

@darnoc312
Copy link
Contributor Author

Update zcl_excel_autofilter because:

  1. The result of zcl_excel_autofilter->get_values is expected to be sorted by for example lcl_create_xl_sheet->add_autofilter. There lv_column is used as group change field. But the mt_filters table and its values in zcl_excel_autofilter used via LOOP AT by zcl_excel_autofilter->get_values are defined as HASHED. The loops return the data in the random order of insertion and not in the order of the table key. So both tables must be changed to SORTED.
    For Demonstration. The following code returns 2,1 and not 1,2:
    DATA: lt_hash TYPE HASHED TABLE OF zexcel_cell_column WITH UNIQUE KEY table_line,
    lv_col LIKE LINE OF lt_hash.
    lv_col = 2.
    INSERT lv_col INTO TABLE lt_hash.
    lv_col = 1.
    INSERT lv_col INTO TABLE lt_hash.
    LOOP AT lt_hash INTO lv_col.
    WRITE / lv_col.
    ENDLOOP.

  2. zcl_excel_converter->set_autofilter_area sets row_start, col_start and col_end but leaves row_end initial. This should be completed by the next zcl_excel_autofilter->validate_area. But since the changes of pull request Fix #546 autofilter on row>1 and one-row height #822 this is impossible. The row and column validations for less 1 and greater maximum must take place before the validations for start > end. So the new code of Fix #546 autofilter on row>1 and one-row height #822 must be placed exactly at the same place as the at that time removed code.

WHILE Loop in is_row_hidden deleted. No more insertion of empty column entries in mt_filters table without rule and values.
Integration of method zcl_excel_autofilter->is_row_hidden
@darnoc312 darnoc312 marked this pull request as draft May 29, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant