*"* local class implementation for public class
*"* use this source file for the implementation part of
*"* local helper classes*"* use this source file for any type declarations (class
*"* definitions, interfaces or data types) you need for method
*"* implementation or private method's signature*"* use this source file for any macro definitions you need
*"* in the implementation part of the classABAPmethod GET_BOTTOM_ROW_INTEGER.
DATA: lv_table_lines TYPE i.
FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.
IF settings-bottom_right_row IS NOT INITIAL.
* ev_row = zcl_excel_common=>convert_column2int( settings-bottom_right_row ). " del issue #246
ev_row = settings-bottom_right_row . " ins issue #246
EXIT.
ENDIF.
ASSIGN table_data->* TO <fs_table>.
DESCRIBE TABLE <fs_table> LINES lv_table_lines.
IF lv_table_lines = 0.
lv_table_lines = 1. "table needs at least 1 data row
ENDIF.
ev_row = settings-top_left_row + lv_table_lines.
IF me->has_totals( ) = abap_true." ???? AND ip_include_totals_row = abap_true.
ADD 1 TO ev_row.
ENDIF.
endmethod.method GET_ID.
ov_id = id.
endmethod.method GET_NAME.
IF me->name IS INITIAL.
me->name = zcl_excel_common=>number_to_excel_string( ip_value = me->id ).
CONCATENATE 'table' me->name INTO me->name.
ENDIF.
ov_name = me->name.
endmethod.method GET_REFERENCE.
DATA: lv_column TYPE zexcel_cell_column,
lv_table_lines TYPE i,
lv_right_column TYPE zexcel_cell_column_alpha,
ls_field_catalog TYPE zexcel_s_fieldcatalog,
lv_bottom_row TYPE zexcel_cell_row,
lv_top_row_string(10) TYPE c,
lv_bottom_row_string(10) TYPE c.
FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.
*column
lv_column = zcl_excel_common=>convert_column2int( settings-top_left_column ).
lv_table_lines = 0.
LOOP AT fieldcat INTO ls_field_catalog WHERE dynpfld EQ abap_true.
ADD 1 TO lv_table_lines.
ENDLOOP.
lv_column = lv_column + lv_table_lines - 1.
lv_right_column = zcl_excel_common=>convert_column2alpha( lv_column ).
*row
ASSIGN table_data->* TO <fs_table>.
DESCRIBE TABLE <fs_table> LINES lv_table_lines.
IF lv_table_lines = 0.
lv_table_lines = 1. "table needs at least 1 data row
ENDIF.
lv_bottom_row = settings-top_left_row + lv_table_lines .
IF me->has_totals( ) = abap_true AND ip_include_totals_row = abap_true.
ADD 1 TO lv_bottom_row.
ENDIF.
lv_top_row_string = zcl_excel_common=>number_to_excel_string( settings-top_left_row ).
lv_bottom_row_string = zcl_excel_common=>number_to_excel_string( lv_bottom_row ).
CONCATENATE settings-top_left_column lv_top_row_string
':'
lv_right_column lv_bottom_row_string INTO ov_reference.
endmethod.method GET_RIGHT_COLUMN_INTEGER.
DATA: lv_column TYPE zexcel_cell_column,
lv_table_lines TYPE i,
ls_field_catalog TYPE zexcel_s_fieldcatalog.
IF settings-bottom_right_column IS NOT INITIAL.
ev_column = zcl_excel_common=>convert_column2int( settings-bottom_right_column ).
EXIT.
ENDIF.
ev_column = zcl_excel_common=>convert_column2int( settings-top_left_column ).
LOOP AT fieldcat INTO ls_field_catalog WHERE dynpfld EQ abap_true.
ADD 1 TO ev_column.
ENDLOOP.
endmethod.method GET_TOTALS_FORMULA.
CONSTANTS: lc_function_id_sum TYPE string VALUE '109',
lc_function_id_min TYPE string VALUE '105',
lc_function_id_max TYPE string VALUE '104',
lc_function_id_count TYPE string VALUE '103',
lc_function_id_average TYPE string VALUE '101'.
DATA: lv_function_id TYPE string.
CASE ip_function.
WHEN zcl_excel_table=>totals_function_sum.
lv_function_id = lc_function_id_sum.
WHEN zcl_excel_table=>totals_function_min.
lv_function_id = lc_function_id_min.
WHEN zcl_excel_table=>totals_function_max.
lv_function_id = lc_function_id_max.
WHEN zcl_excel_table=>totals_function_count.
lv_function_id = lc_function_id_count.
WHEN zcl_excel_table=>totals_function_average.
lv_function_id = lc_function_id_average.
WHEN zcl_excel_table=>totals_function_custom. " issue #292
RETURN.
WHEN OTHERS.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Invalid totals formula. See ZCL_ for possible values'.
ENDCASE.
CONCATENATE 'SUBTOTAL(' lv_function_id ',[' ip_column '])' INTO ep_formula.
endmethod.method HAS_TOTALS.
DATA: ls_field_catalog TYPE zexcel_s_fieldcatalog.
ep_result = abap_false.
LOOP AT fieldcat INTO ls_field_catalog.
IF ls_field_catalog-totals_function IS NOT INITIAL.
ep_result = abap_true.
EXIT.
ENDIF.
ENDLOOP.
endmethod.METHOD set_data.
DATA lr_temp TYPE REF TO data.
FIELD-SYMBOLS: <lt_table_temp> TYPE ANY TABLE,
<lt_table> TYPE ANY TABLE.
GET REFERENCE OF ir_data INTO lr_temp.
ASSIGN lr_temp->* TO <lt_table_temp>.
CREATE DATA table_data LIKE <lt_table_temp>.
ASSIGN me->table_data->* TO <lt_table>.
<lt_table> = <lt_table_temp>.
ENDMETHOD.method SET_ID.
id = iv_id.
endmethod.