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

endless loop in bind_table #1044

Merged
merged 3 commits into from
Jul 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/zcl_excel_worksheet.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -2964,14 +2964,18 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.

DATA: lt_field_catalog TYPE zexcel_t_fieldcatalog,
lv_value_lowercase TYPE string,
lv_scrtext_l_initial TYPE scrtext_l,
lv_long_text TYPE string,
lv_max_length TYPE i,
lv_temp_length TYPE i,
lv_syindex TYPE c LENGTH 3,
lt_column_name_buffer TYPE SORTED TABLE OF string WITH UNIQUE KEY table_line.
FIELD-SYMBOLS: <ls_field_catalog> TYPE zexcel_s_fieldcatalog,
<scrtxt1> TYPE any,
<scrtxt2> TYPE any,
<scrtxt3> TYPE any.
<scrtxt1> TYPE any,
<scrtxt2> TYPE any,
<scrtxt3> TYPE any.
AndreaBorgia-Abo marked this conversation as resolved.
Show resolved Hide resolved

" Due restrinction of new table object we cannot have two column with the same name
" Due to restrictions in new table object we cannot have two columns with the same name
" Check if a column with the same name exists, if exists add a counter
" If no medium description is provided we try to use small or long

Expand Down Expand Up @@ -3008,6 +3012,8 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
<ls_field_catalog>-scrtext_l = 'Column'. " default value as Excel does
ENDIF.

lv_scrtext_l_initial = <ls_field_catalog>-scrtext_l.
DESCRIBE FIELD <ls_field_catalog>-scrtext_l LENGTH lv_max_length IN CHARACTER MODE.
DO.
lv_value_lowercase = <ls_field_catalog>-scrtext_l.
TRANSLATE lv_value_lowercase TO LOWER CASE.
Expand All @@ -3017,7 +3023,14 @@ CLASS zcl_excel_worksheet IMPLEMENTATION.
EXIT.
ELSE.
lv_syindex = sy-index.
CONCATENATE <ls_field_catalog>-scrtext_l lv_syindex INTO <ls_field_catalog>-scrtext_l.
CONCATENATE lv_scrtext_l_initial lv_syindex INTO lv_long_text.
IF strlen( lv_long_text ) <= lv_max_length.
<ls_field_catalog>-scrtext_l = lv_long_text.
ELSE.
lv_temp_length = strlen( lv_scrtext_l_initial ) - 1.
lv_scrtext_l_initial = substring( val = lv_scrtext_l_initial len = lv_temp_length ).
CONCATENATE lv_scrtext_l_initial lv_syindex INTO <ls_field_catalog>-scrtext_l.
ENDIF.
ENDIF.
ENDDO.

Expand Down