class ZCL_EXCEL_DRAWING definition public final create public . *"* public components of class ZCL_EXCEL_DRAWING *"* do not include other source files here!!! public section. type-pools ABAP . data TITLE type ZEXCEL_SHEET_TITLE value 'Worksheet'. "#EC NOTEXT . data X_REFERENCES type CHAR1 . data Y_REFERENCES type CHAR1 . data GRAPH_TYPE type ZEXCEL_GRAPH_TYPE . methods CONSTRUCTOR importing !IP_TITLE type ZEXCEL_SHEET_TITLE optional . methods GET_GUID returning value(EP_GUID) type GUID_16 . *"* protected components of class ZCL_EXCEL_DRAWING *"* do not include other source files here!!! protected section. *"* private components of class ZCL_EXCEL_DRAWING *"* do not include other source files here!!! private section. data GUID type GUID_16 . data LOWER_CELL type ZEXCEL_S_CELL_DATA . data UPPER_CELL type ZEXCEL_S_CELL_DATA . constants C_EXCEL_COL_MODULE type INT2 value 64. "#EC NOTEXT methods CONVERT_COLUMN2ALPHA importing !IP_COLUMN type ZEXCEL_CELL_COLUMN returning value(EP_COLUMN) type ZEXCEL_CELL_COLUMN_ALPHA . methods CONVERT_COLUMN2INT importing !IP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA returning value(EP_COLUMN) type ZEXCEL_CELL_COLUMN . *"* 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 class ABAP method CONSTRUCTOR. CALL FUNCTION 'GUID_CREATE' IMPORTING ev_guid_16 = me->guid. IF ip_title IS NOT INITIAL. title = ip_title. ELSE. title = me->guid. ENDIF. * inizialize dimension range lower_cell-cell_row = 1. lower_cell-cell_column = 1. upper_cell-cell_row = 1. upper_cell-cell_column = 1. endmethod. method CONVERT_COLUMN2ALPHA. DATA: lo_conv TYPE REF TO cl_abap_conv_in_ce, lv_uccpi TYPE i, lv_text TYPE sychar02, lv_module TYPE int4, lv_column TYPE zexcel_cell_column. lv_column = ip_column. WHILE lv_column GT 0. lv_module = ( lv_column - 1 ) MOD 26. lv_uccpi = 65 + lv_module. lv_column = ( lv_column - lv_module ) / 26. lv_text = cl_abap_conv_in_ce=>uccpi( lv_uccpi ). CONCATENATE lv_text ep_column INTO ep_column. ENDWHILE. endmethod. method CONVERT_COLUMN2INT. DATA: lv_uccpi TYPE i, lv_char TYPE c, lv_column(2) TYPE c. * Calculate most significant letter lv_char = ip_column+1(1). IF lv_char IS NOT INITIAL. "To avoid the first 26 column that have only a char in first position ep_column = cl_abap_conv_out_ce=>uccpi( lv_char ). ep_column = ep_column MOD ( me->c_excel_col_module ). lv_char = ip_column(1). lv_uccpi = cl_abap_conv_out_ce=>uccpi( lv_char ). lv_uccpi = ( lv_uccpi MOD ( me->c_excel_col_module ) ) * 26. ep_column = ep_column + lv_uccpi. ELSE. lv_char = ip_column(1). ep_column = cl_abap_conv_out_ce=>uccpi( lv_char ). ep_column = ep_column - me->c_excel_col_module. ENDIF. endmethod. method GET_GUID. ep_guid = me->guid. endmethod.