abap2xlsx/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk

3316 lines
151 KiB
XML
Raw Blame History

<?xml version="1.0" encoding="utf-16"?>
<CLAS CLSNAME="ZCL_EXCEL_WORKSHEET" VERSION="1" LANGU="E" DESCRIPT="Worksheet" UUID="C1BF274C8A345F2DE1000000C0A8FA19" CATEGORY="00" EXPOSURE="2" STATE="1" RELEASE="0" AUTHOR="FEMIA" CREATEDON="20100628" CHANGEDBY="HUNGHM" CHANGEDON="20101115" CHGDANYON="00000000" CLSFINAL="X" CLSCCINCL="X" FIXPT="X" UNICODE="X" R3RELEASE="701" CLSBCCAT="00" DURATION_TYPE="0 " RISK_LEVEL="0 ">
<implementing CLSNAME="ZCL_EXCEL_WORKSHEET" REFCLSNAME="ZIF_EXCEL_SHEET_PROTECTION" VERSION="1" EXPOSURE="2" STATE="1" AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" RELTYPE="1"/>
<publicSection>class ZCL_EXCEL_WORKSHEET definition
public
final
create public .
*&quot;* public components of class ZCL_EXCEL_WORKSHEET
*&quot;* do not include other source files here!!!
public section.
type-pools ABAP .
interfaces ZIF_EXCEL_SHEET_PROTECTION .
constants C_BREAK_COLUMN type ZEXCEL_BREAK value 2. &quot;#EC NOTEXT
constants C_BREAK_NONE type ZEXCEL_BREAK value 0. &quot;#EC NOTEXT
constants C_BREAK_ROW type ZEXCEL_BREAK value 1. &quot;#EC NOTEXT
constants C_SHEET_STATE_HIDDEN type ZEXCEL_SHEET_STATE value &apos;hidden&apos;. &quot;#EC NOTEXT
constants C_SHEET_STATE_VERYHIDDEN type ZEXCEL_SHEET_STATE value &apos;veryHidden&apos;. &quot;#EC NOTEXT
constants C_SHEET_STATE_VISIBLE type ZEXCEL_SHEET_STATE value &apos;visible&apos;. &quot;#EC NOTEXT
data SHEET_CONTENT type ZEXCEL_T_CELL_DATA .
data SHEET_CONTENT_MERGE type ZEXCEL_T_CELL_DATA .
data SHEET_SETUP type ref to ZCL_EXCEL_SHEET_SETUP .
data SHEET_STATE type ZEXCEL_SHEET_STATE .
data TITLE type ZEXCEL_SHEET_TITLE value &apos;Worksheet&apos;. &quot;#EC NOTEXT .
methods ADD_DRAWING
importing
!IP_DRAWING type ref to ZCL_EXCEL_DRAWING .
methods ADD_NEW_CONDITIONAL_STYLE
returning
value(EO_CONDITIONAL_STYLE) type ref to ZCL_EXCEL_STYLE_CONDITIONAL .
methods ADD_NEW_DATA_VALIDATION
returning
value(EO_DATA_VALIDATION) type ref to ZCL_EXCEL_DATA_VALIDATION .
methods BIND_TABLE
importing
!IP_TABLE type STANDARD TABLE
!IT_FIELD_CATALOG type ZEXCEL_T_FIELDCATALOG optional
!IS_TABLE_SETTINGS type ZEXCEL_S_TABLE_SETTINGS optional .
type-pools SLIS .
type-pools SOI .
methods BIND_ALV
importing
!I_DOCUMENT_URL type CHAR255 default SPACE
!I_XLS type C default SPACE
!I_SAVE_PATH type STRING
!IO_ALV type ref to CL_GUI_ALV_GRID
!IT_LISTHEADER type SLIS_T_LISTHEADER optional
!I_TOP type I default 1
!I_LEFT type I default 1
!I_COLUMNS_HEADER type C default &apos;X&apos;
!I_COLUMNS_AUTOFIT type C default &apos;X&apos;
!I_FORMAT_COL_HEADER type SOI_FORMAT_ITEM optional
!I_FORMAT_SUBTOTAL type SOI_FORMAT_ITEM optional
!I_FORMAT_TOTAL type SOI_FORMAT_ITEM optional
exceptions
MISS_GUIDE
EX_TRANSFER_KKBLO_ERROR
FATAL_ERROR
INV_DATA_RANGE
DIM_MISMATCH_VKEY
DIM_MISMATCH_SEMA
ERROR_IN_SEMA .
methods CALCULATE_COLUMN_WIDTHS .
methods CONSTRUCTOR
importing
!IP_EXCEL type ref to ZCL_EXCEL
!IP_TITLE type ZEXCEL_SHEET_TITLE optional .
methods DELETE_MERGE .
methods FREEZE_PANES
importing
!IP_NUM_COLUMNS type I optional
!IP_NUM_ROWS type I optional
raising
ZCX_EXCEL .
methods GET_ACTIVE_CELL
returning
value(EP_ACTIVE_CELL) type STRING .
methods GET_CELL
importing
!IP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA
!IP_ROW type ZEXCEL_CELL_ROW
exporting
!EP_VALUE type ZEXCEL_CELL_VALUE
!EP_RC type SYSUBRC .
methods GET_COLUMN_DIMENSION
importing
!IP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA
returning
value(R_COLUMN_DIMENSION) type ref to ZCL_EXCEL_WORKSHEET_COLUMNDIME .
methods GET_COLUMN_DIMENSIONS
returning
value(R_COLUMN_DIMENSION) type ZEXCEL_T_WORKSHEET_COLUMNDIME .
methods GET_COND_STYLES_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_DATA_VALIDATIONS_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_DATA_VALIDATIONS_SIZE
returning
value(EP_SIZE) type I .
methods GET_DEFAULT_COLUMN_DIMENSION
returning
value(R_COLUMN_DIMENSION) type ref to ZCL_EXCEL_WORKSHEET_COLUMNDIME .
methods GET_DEFAULT_ROW_DIMENSION
returning
value(R_ROW_DIMENSION) type ref to ZCL_EXCEL_WORKSHEET_ROWDIMENSI .
methods GET_DIMENSION_RANGE
returning
value(EP_DIMENSION_RANGE) type STRING .
methods GET_DRAWINGS
returning
value(R_DRAWINGS) type ref to ZCL_EXCEL_DRAWINGS .
methods GET_DRAWINGS_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_FREEZE_CELL
exporting
!EP_ROW type ZEXCEL_CELL_ROW
!EP_COLUMN type ZEXCEL_CELL_COLUMN .
methods GET_GUID
returning
value(EP_GUID) type OLTPGUID16 .
methods GET_HIGHEST_COLUMN
returning
value(R_HIGHEST_COLUMN) type ZEXCEL_CELL_COLUMN .
methods GET_HIGHEST_ROW
returning
value(R_HIGHEST_ROW) type INT4 .
methods GET_HYPERLINKS_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_HYPERLINKS_SIZE
returning
value(EP_SIZE) type I .
methods GET_MERGE
returning
value(MERGE_RANGE) type STRING_TABLE .
methods GET_ROW_DIMENSION
importing
!IP_ROW type INT4
returning
value(R_ROW_DIMENSION) type ref to ZCL_EXCEL_WORKSHEET_ROWDIMENSI .
methods GET_ROW_DIMENSIONS
returning
value(R_ROW_DIMENSION) type ZEXCEL_T_WORKSHEET_ROWDIMENSIO .
methods GET_TABLES_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_TABLES_SIZE
returning
value(EP_SIZE) type I .
methods SET_CELL
importing
!IP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA
!IP_ROW type ZEXCEL_CELL_ROW
!IP_VALUE type SIMPLE optional
!IP_FORMULA type ZEXCEL_CELL_FORMULA optional
!IP_STYLE type ZEXCEL_CELL_STYLE optional
!IP_HYPERLINK type ref to ZCL_EXCEL_HYPERLINK optional .
methods SET_CELL_STYLE
importing
!IP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA
!IP_ROW type ZEXCEL_CELL_ROW
!IP_STYLE type ZEXCEL_CELL_STYLE
raising
ZCX_EXCEL .
methods SET_MERGE
importing
!IP_COLUMN_START type ZEXCEL_CELL_COLUMN_ALPHA optional
!IP_COLUMN_END type ZEXCEL_CELL_COLUMN_ALPHA optional
!IP_ROW type ZEXCEL_CELL_ROW optional .
methods SET_TABLE
importing
!IP_TABLE type STANDARD TABLE
!IP_HDR_STYLE type ZEXCEL_CELL_STYLE optional
!IP_BODY_STYLE type ZEXCEL_CELL_STYLE optional
!IP_TABLE_TITLE type STRING
!IP_TOP_LEFT_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA default &apos;B&apos;
!IP_TOP_LEFT_ROW type ZEXCEL_CELL_ROW default 3 .</publicSection>
<protectedSection>*&quot;* protected components of class ZCL_EXCEL_WORKSHEET
*&quot;* do not include other source files here!!!
protected section.</protectedSection>
<privateSection>*&quot;* private components of class ZCL_EXCEL_WORKSHEET
*&quot;* do not include other source files here!!!
private section.
data ACTIVE_CELL type ZEXCEL_S_CELL_DATA .
data COLUMN_DIMENSIONS type ZEXCEL_T_WORKSHEET_COLUMNDIME .
data CONDITIONAL_STYLES type ref to ZCL_EXCEL_STYLES_CONDITIONAL .
data DATA_VALIDATIONS type ref to ZCL_EXCEL_DATA_VALIDATIONS .
data DEFAULT_COLUMN_DIMENSION type ref to ZCL_EXCEL_WORKSHEET_COLUMNDIME .
data DEFAULT_ROW_DIMENSION type ref to ZCL_EXCEL_WORKSHEET_ROWDIMENSI .
data DRAWINGS type ref to ZCL_EXCEL_DRAWINGS .
data EXCEL type ref to ZCL_EXCEL .
data FREEZE_PANE_CELL_COLUMN type ZEXCEL_CELL_COLUMN .
data FREEZE_PANE_CELL_ROW type ZEXCEL_CELL_ROW .
data GUID type OLTPGUID16 .
data LOWER_CELL type ZEXCEL_S_CELL_DATA .
data ROW_DIMENSIONS type ZEXCEL_T_WORKSHEET_ROWDIMENSIO .
data TABLES type ref to CL_OBJECT_COLLECTION .
data UPPER_CELL type ZEXCEL_S_CELL_DATA .
data HYPERLINKS type ref to CL_OBJECT_COLLECTION .
methods UPDATE_DIMENSION_RANGE .</privateSection>
<localImplementation>*&quot;* local class implementation for public class
*&quot;* use this source file for the implementation part of
*&quot;* local helper classes
*&amp;---------------------------------------------------------------------*
*&amp; Class (Implementation) C_OI_PROXY_ERROR
*&amp;---------------------------------------------------------------------*
CLASS C_OI_PROXY_ERROR IMPLEMENTATION.
method constructor.
* IMPORTING object_name TYPE c
* method_name TYPE c.
error_nr = ret_call_not_flushed.
me-&gt;i_oi_error~error_code = c_oi_errors=&gt;ret_call_not_flushed.
me-&gt;i_oi_error~is_flushed = &apos; &apos;.
me-&gt;i_oi_error~has_failed = &apos;X&apos;.
me-&gt;i_oi_error~has_succeeded = &apos; &apos;.
me-&gt;message_id = &apos;SOFFICEINTEGRATION&apos;.
me-&gt;message_nr = &apos;899&apos;.
me-&gt;param1 = object_name.
me-&gt;param2 = method_name.
endmethod. &quot;constructor
method i_oi_error~flush_error.
if error_nr eq 0.
me-&gt;i_oi_error~error_code = c_oi_errors=&gt;ret_ok.
me-&gt;i_oi_error~is_flushed = &apos;X&apos;.
me-&gt;i_oi_error~has_failed = &apos; &apos;.
me-&gt;i_oi_error~has_succeeded = &apos;X&apos;.
me-&gt;message_id = &apos;&apos;.
me-&gt;message_nr = &apos;000&apos;.
call method c_oi_errors=&gt;translate_proxy_error_code
EXPORTING
errorcode = error_nr
IMPORTING
retcode = me-&gt;i_oi_error~error_code.
elseif error_nr eq ret_call_not_flushed.
&quot;call still not flushed
call method c_oi_errors=&gt;translate_proxy_error_code
EXPORTING
errorcode = error_nr
errorstring = me-&gt;param2 &quot;method name
objectname = me-&gt;param1
IMPORTING
retcode = me-&gt;i_oi_error~error_code.
else.
me-&gt;i_oi_error~is_flushed = &apos;X&apos;.
me-&gt;i_oi_error~has_succeeded = &apos; &apos;.
me-&gt;i_oi_error~has_failed = &apos;X&apos;.
call method c_oi_errors=&gt;translate_proxy_error_code
EXPORTING
errorcode = error_nr
errorstring = error_string
IMPORTING
retcode = me-&gt;i_oi_error~error_code.
call method c_oi_errors=&gt;get_message
IMPORTING
message_id = me-&gt;message_id
message_number = me-&gt;message_nr
param1 = me-&gt;param1
param2 = me-&gt;param2
param3 = me-&gt;param3
param4 = me-&gt;param4.
endif.
endmethod. &quot;i_oi_error~flush_error
method i_oi_error~raise_message.
* IMPORTING type TYPE c.
* EXCEPTIONS message_raised flush_failed.
if me-&gt;i_oi_error~has_succeeded is initial.
if not me-&gt;i_oi_error~is_flushed is initial.
message id message_id type type
number message_nr with param1 param2 param3 param4
raising message_raised.
else.
raise flush_failed.
endif.
endif.
endmethod. &quot;i_oi_error~raise_message
method i_oi_error~get_message.
* EXPORTING message_id TYPE c
* message_number TYPE c
* param1 TYPE c
* param2 TYPE c
* param3 TYPE c
* param4 TYPE c.
param1 = me-&gt;param1. param2 = me-&gt;param2.
param3 = me-&gt;param3. param4 = me-&gt;param4.
message_id = me-&gt;message_id.
message_number = me-&gt;message_nr.
endmethod. &quot;i_oi_error~get_message
ENDCLASS. &quot;C_OI_PROXY_ERROR
*&amp;---------------------------------------------------------------------*
*&amp; Class (Implementation) CL_GRID_ACCESSION
*&amp;---------------------------------------------------------------------*
CLASS lcl_gui_alv_grid IMPLEMENTATION.
method get_alv_attributes.
create data et_table like io_grid-&gt;mt_outtab.
et_table = io_grid-&gt;mt_outtab.
endmethod. &quot;get_data
ENDCLASS. &quot;CL_GRID_ACCESSION</localImplementation>
<localTypes>*&quot;* use this source file for any type declarations (class
*&quot;* definitions, interfaces or data types) you need for method
*&quot;* implementation or private method&apos;s signature
type-pools: SYDES.
type-pools: SLIS.
*--------------------------------------------------------------------*
* CLASS c_oi_proxy_error
*--------------------------------------------------------------------*
* use for method bind_ALV
*--------------------------------------------------------------------*
class c_oi_proxy_error definition.
public section.
interfaces: i_oi_error.
data: error_nr type i.
data: error_string type sy-msgv1.
methods: constructor importing object_name type c
method_name type c.
private section.
constants:
ret_call_not_flushed type i value -999999.
data: message_id type sy-msgid,
message_nr type sy-msgno,
param1 type sy-msgv1,
param2 type sy-msgv2,
param3 type sy-msgv3,
param4 type sy-msgv4.
endclass.
*--------------------------------------------------------------------*
* CLASS lcl_gui_alv_grid
*--------------------------------------------------------------------*
* to get protected attribute and method of cl_gui_alv_grid
* use for method bind_ALV
*--------------------------------------------------------------------*
class lcl_gui_alv_grid definition inheriting from cl_gui_alv_grid.
public section.
* get ALV grid data
methods: get_alv_attributes
importing
Io_grid type ref to cl_gui_alv_grid &quot; ALV grid
exporting
ET_table type ref to data. &quot; dta table
endclass.</localTypes>
<localMacros>*&quot;* use this source file for any macro definitions you need
*&quot;* in the implementation part of the class</localMacros>
<typeUsage CLSNAME="ZCL_EXCEL_WORKSHEET" TYPEGROUP="ABAP" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<typeUsage CLSNAME="ZCL_EXCEL_WORKSHEET" TYPEGROUP="SLIS" VERSION="1" TPUTYPE="0" IMPLICIT="X"/>
<typeUsage CLSNAME="ZCL_EXCEL_WORKSHEET" TYPEGROUP="SOI" VERSION="1" TPUTYPE="0" IMPLICIT="X"/>
<forwardDeclaration>ABAP</forwardDeclaration>
<forwardDeclaration>SLIS</forwardDeclaration>
<forwardDeclaration>SOI</forwardDeclaration>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="ACTIVE_CELL" VERSION="1" LANGU="E" DESCRIPT="Version Number Component" EXPOSURE="0" STATE="1" EDITORDER="1 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_S_CELL_DATA" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="COLUMN_DIMENSIONS" VERSION="1" LANGU="E" DESCRIPT="Collection of column dimensions" EXPOSURE="0" STATE="1" EDITORDER="2 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_T_WORKSHEET_COLUMNDIME" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="CONDITIONAL_STYLES" VERSION="1" LANGU="E" DESCRIPT="Styles conditional collection" EXPOSURE="0" STATE="1" EDITORDER="3 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="3" TYPE="ZCL_EXCEL_STYLES_CONDITIONAL" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="C_BREAK_COLUMN" VERSION="1" LANGU="E" DESCRIPT="Worksheet Break" EXPOSURE="2" STATE="1" EDITORDER="4 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="2" ATTVALUE="2" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_BREAK" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="C_BREAK_NONE" VERSION="1" LANGU="E" DESCRIPT="Worksheet Break" EXPOSURE="2" STATE="1" EDITORDER="5 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="2" ATTVALUE="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_BREAK" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="C_BREAK_ROW" VERSION="1" LANGU="E" DESCRIPT="Worksheet Break" EXPOSURE="2" STATE="1" EDITORDER="6 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="2" ATTVALUE="1" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_BREAK" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="C_SHEET_STATE_HIDDEN" VERSION="1" LANGU="E" DESCRIPT="Sheet state" EXPOSURE="2" STATE="1" EDITORDER="7 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="2" ATTVALUE="&apos;hidden&apos;" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_SHEET_STATE" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="C_SHEET_STATE_VERYHIDDEN" VERSION="1" LANGU="E" DESCRIPT="Sheet state" EXPOSURE="2" STATE="1" EDITORDER="8 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="2" ATTVALUE="&apos;veryHidden&apos;" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_SHEET_STATE" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="C_SHEET_STATE_VISIBLE" VERSION="1" LANGU="E" DESCRIPT="Sheet state" EXPOSURE="2" STATE="1" EDITORDER="9 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="2" ATTVALUE="&apos;visible&apos;" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_SHEET_STATE" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="DATA_VALIDATIONS" VERSION="1" LANGU="E" DESCRIPT="Data validations collection" EXPOSURE="0" STATE="1" EDITORDER="10 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="3" TYPE="ZCL_EXCEL_DATA_VALIDATIONS" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="DEFAULT_COLUMN_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Worksheet ColumnDimension" EXPOSURE="0" STATE="1" EDITORDER="11 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="3" TYPE="ZCL_EXCEL_WORKSHEET_COLUMNDIME" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="DEFAULT_ROW_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Worksheet RowDimension" EXPOSURE="0" STATE="1" EDITORDER="12 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="3" TYPE="ZCL_EXCEL_WORKSHEET_ROWDIMENSI" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="DRAWINGS" VERSION="1" LANGU="E" DESCRIPT="Drawings collection" EXPOSURE="0" STATE="1" EDITORDER="13 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="3" TYPE="ZCL_EXCEL_DRAWINGS" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="EXCEL" VERSION="1" LANGU="E" EXPOSURE="0" STATE="1" EDITORDER="14 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="3" TYPE="ZCL_EXCEL" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="FREEZE_PANE_CELL_COLUMN" VERSION="1" LANGU="E" DESCRIPT="Cell Column" EXPOSURE="0" STATE="1" EDITORDER="15 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_CELL_COLUMN" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="FREEZE_PANE_CELL_ROW" VERSION="1" LANGU="E" DESCRIPT="Cell Row" EXPOSURE="0" STATE="1" EDITORDER="16 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_CELL_ROW" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GUID" VERSION="1" LANGU="E" DESCRIPT="GUID in &apos;RAW&apos; format" EXPOSURE="0" STATE="1" EDITORDER="17 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="OLTPGUID16" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="HYPERLINKS" VERSION="1" LANGU="E" DESCRIPT="Colletion of hyperlinks" EXPOSURE="0" STATE="1" EDITORDER="27 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="3" TYPE="CL_OBJECT_COLLECTION" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="LOWER_CELL" VERSION="1" LANGU="E" DESCRIPT="Bottom right range cell" EXPOSURE="0" STATE="1" EDITORDER="18 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_S_CELL_DATA" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="ROW_DIMENSIONS" VERSION="1" LANGU="E" DESCRIPT="Collection of row dimensions" EXPOSURE="0" STATE="1" EDITORDER="19 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_T_WORKSHEET_ROWDIMENSIO" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SHEET_CONTENT" VERSION="1" LANGU="E" DESCRIPT="Excel worksheet content" EXPOSURE="2" STATE="1" EDITORDER="20 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_T_CELL_DATA" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SHEET_CONTENT_MERGE" VERSION="1" LANGU="E" DESCRIPT="Excel worksheet content" EXPOSURE="2" STATE="1" EDITORDER="21 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_T_CELL_DATA" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SHEET_SETUP" VERSION="1" LANGU="E" DESCRIPT="Sheet setup" EXPOSURE="2" STATE="1" EDITORDER="22 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="3" TYPE="ZCL_EXCEL_SHEET_SETUP" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SHEET_STATE" VERSION="1" LANGU="E" DESCRIPT="Sheet state" EXPOSURE="2" STATE="1" EDITORDER="23 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_SHEET_STATE" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="TABLES" VERSION="1" LANGU="E" DESCRIPT="Colletion of tables" EXPOSURE="0" STATE="1" EDITORDER="24 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="3" TYPE="CL_OBJECT_COLLECTION" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="TITLE" VERSION="1" LANGU="E" DESCRIPT="Title" EXPOSURE="2" STATE="1" EDITORDER="25 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTVALUE="&apos;Worksheet&apos;" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_SHEET_TITLE" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="UPPER_CELL" VERSION="1" LANGU="E" DESCRIPT="Top left range cell" EXPOSURE="0" STATE="1" EDITORDER="26 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="ZEXCEL_S_CELL_DATA" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="ADD_DRAWING" VERSION="1" LANGU="E" DESCRIPT="Add drawing to the sheet" EXPOSURE="2" STATE="1" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="ADD_DRAWING" SCONAME="IP_DRAWING" VERSION="1" LANGU="E" DESCRIPT="Drawing" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="3" TYPE="ZCL_EXCEL_DRAWING"/>
<source>method ADD_DRAWING.
drawings-&gt;add( ip_drawing ).
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="ADD_NEW_CONDITIONAL_STYLE" VERSION="1" LANGU="E" DESCRIPT="Creates a new conditional formatting" EXPOSURE="2" STATE="1" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="ADD_NEW_CONDITIONAL_STYLE" SCONAME="EO_CONDITIONAL_STYLE" VERSION="1" LANGU="E" DESCRIPT="Font Style" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="ZCL_EXCEL_STYLE_CONDITIONAL"/>
<source>method ADD_NEW_CONDITIONAL_STYLE.
CREATE OBJECT eo_conditional_style.
conditional_styles-&gt;add( eo_conditional_style ).
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="ADD_NEW_DATA_VALIDATION" VERSION="1" LANGU="E" DESCRIPT="Creates a new data validation" EXPOSURE="2" STATE="1" EDITORDER="3 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="ADD_NEW_DATA_VALIDATION" SCONAME="EO_DATA_VALIDATION" VERSION="1" LANGU="E" DESCRIPT="Data validation" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="ZCL_EXCEL_DATA_VALIDATION"/>
<source>method ADD_NEW_DATA_VALIDATION.
CREATE OBJECT eo_data_validation.
data_validations-&gt;add( eo_data_validation ).
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" VERSION="1" LANGU="E" DESCRIPT="Set cell value from ALV object" EXPOSURE="2" STATE="1" EDITORDER="5 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="I_DOCUMENT_URL" VERSION="1" LANGU="E" DESCRIPT="URL of file, must start with &lt;file://&gt;" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="CHAR255" PARVALUE="SPACE"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="I_XLS" VERSION="1" LANGU="E" DESCRIPT="Export to .xls file?" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="C" PARVALUE="SPACE"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="I_SAVE_PATH" VERSION="1" LANGU="E" DESCRIPT="Local file path" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101119" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="STRING"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="IO_ALV" VERSION="1" LANGU="E" DESCRIPT="ALV List Viewer" CMPTYPE="1" MTDTYPE="0" EDITORDER="4 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDBY="HUNGHM" CHANGEDON="20101116" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="3" TYPE="CL_GUI_ALV_GRID"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="IT_LISTHEADER" VERSION="1" LANGU="E" DESCRIPT="Top-of-page" CMPTYPE="1" MTDTYPE="0" EDITORDER="5 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="SLIS_T_LISTHEADER" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="I_TOP" VERSION="1" LANGU="E" DESCRIPT="Top edge of data block" CMPTYPE="1" MTDTYPE="0" EDITORDER="6 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="I" PARVALUE="1"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="I_LEFT" VERSION="1" LANGU="E" DESCRIPT="Left-hand edge of data block" CMPTYPE="1" MTDTYPE="0" EDITORDER="7 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="I" PARVALUE="1"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="I_COLUMNS_HEADER" VERSION="1" LANGU="E" DESCRIPT="Export columns header?" CMPTYPE="1" MTDTYPE="0" EDITORDER="8 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="C" PARVALUE="&apos;X&apos;"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="I_COLUMNS_AUTOFIT" VERSION="1" LANGU="E" DESCRIPT="Autofit columns width?" CMPTYPE="1" MTDTYPE="0" EDITORDER="9 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="C" PARVALUE="&apos;X&apos;"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="I_FORMAT_COL_HEADER" VERSION="1" LANGU="E" DESCRIPT="Column header format" CMPTYPE="1" MTDTYPE="0" EDITORDER="10 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="SOI_FORMAT_ITEM" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="I_FORMAT_SUBTOTAL" VERSION="1" LANGU="E" DESCRIPT="Subtotal lines format" CMPTYPE="1" MTDTYPE="0" EDITORDER="11 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="SOI_FORMAT_ITEM" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="I_FORMAT_TOTAL" VERSION="1" LANGU="E" DESCRIPT="Total line format" CMPTYPE="1" MTDTYPE="0" EDITORDER="12 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="SOI_FORMAT_ITEM" PAROPTIONL="X"/>
<exception CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="MISS_GUIDE" VERSION="1" LANGU="E" DESCRIPT="Windows guide is missing" MTDTYPE="0" EDITORDER="1 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116"/>
<exception CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="EX_TRANSFER_KKBLO_ERROR" VERSION="1" LANGU="E" DESCRIPT="Transfer to KKBLO struct error" MTDTYPE="0" EDITORDER="2 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116"/>
<exception CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="FATAL_ERROR" VERSION="1" LANGU="E" MTDTYPE="0" EDITORDER="3 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116"/>
<exception CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="INV_DATA_RANGE" VERSION="1" LANGU="E" MTDTYPE="0" EDITORDER="4 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116"/>
<exception CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="DIM_MISMATCH_VKEY" VERSION="1" LANGU="E" MTDTYPE="0" EDITORDER="5 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116"/>
<exception CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="DIM_MISMATCH_SEMA" VERSION="1" LANGU="E" MTDTYPE="0" EDITORDER="6 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116"/>
<exception CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_ALV" SCONAME="ERROR_IN_SEMA" VERSION="1" LANGU="E" DESCRIPT="Un-know columns Ops, columns Typ" MTDTYPE="0" EDITORDER="7 " AUTHOR="HUNGHM" CREATEDON="20101116" CHANGEDBY="HUNGHM" CHANGEDON="20101116"/>
<source>*--------------------------------------------------------------------*
* Method description:
* Method use to export a CL_GUI_ALV_GRID object to xlsx/xls file
* with list header and characteristics of ALV field catalog such as:
* + Total, group&apos;s subtotal
* + Quantity fields, amount fields (dependent fields)
* + No_out, no_zero, ...
* Technique use in method:
* SAP Desktop Office Integration (DOI)
*--------------------------------------------------------------------*
method BIND_ALV.
* Data for session 0: DOI constructor
* ------------------------------------------
data: lo_control type ref to I_OI_CONTAINER_CONTROL.
data: lo_proxy type ref to I_OI_DOCUMENT_PROXY.
data: lo_spreadsheet type ref to I_OI_SPREADSHEET.
data: lo_error type ref to I_OI_ERROR.
data: lc_retcode type SOI_RET_STRING.
data: li_has type i. &quot;Proxy has spreadsheet interface?
data: l_is_closed type i.
* Data for session 1: Get LVC data from ALV object
* ------------------------------------------
data: l_has_activex,
l_doctype_excel_sheet(11) type c.
data: wa_DOC_HANDLE Type CNTL_HANDLE.
* LVC
data: lt_fieldcat_lvc type LVC_T_FCAT.
data: wa_fieldcat_lvc type lvc_s_fcat.
data: lt_sort_lvc type LVC_T_SORT.
data: lt_filter_idx_lvc type LVC_T_FIDX.
data: lt_GROUPLEVELS_LVC type LVC_T_GRPL.
* KKBLO
DATA: LT_FIELDCAT_KKBLO Type KKBLO_T_FIELDCAT.
DATA: LT_SORT_KKBLO Type KKBLO_T_SORTINFO.
DATA: LT_GROUPLEVELS_KKBLO Type KKBLO_T_GROUPLEVELS.
DATA: LT_FILTER_IDX_KKBLO Type KKBLO_T_SFINFO.
data: wa_listheader like line of it_listheader.
* Subtotal
data: lt_collect00 type ref to data.
data: lt_collect01 type ref to data.
data: lt_collect02 type ref to data.
data: lt_collect03 type ref to data.
data: lt_collect04 type ref to data.
data: lt_collect05 type ref to data.
data: lt_collect06 type ref to data.
data: lt_collect07 type ref to data.
data: lt_collect08 type ref to data.
data: lt_collect09 type ref to data.
* data table name
data: l_tabname type kkblo_tabname.
* local object
data: lo_grid type ref to lcl_gui_alv_grid.
* data table get from ALV
data: lt_alv type ref to data.
* total / subtotal data
field-symbols: &lt;f_collect00&gt; type standard table.
field-symbols: &lt;f_collect01&gt; type standard table.
field-symbols: &lt;f_collect02&gt; type standard table.
field-symbols: &lt;f_collect03&gt; type standard table.
field-symbols: &lt;f_collect04&gt; type standard table.
field-symbols: &lt;f_collect05&gt; type standard table.
field-symbols: &lt;f_collect06&gt; type standard table.
field-symbols: &lt;f_collect07&gt; type standard table.
field-symbols: &lt;f_collect08&gt; type standard table.
field-symbols: &lt;f_collect09&gt; type standard table.
* table before append subtotal lines
field-symbols: &lt;f_alv_tab&gt; type standard table.
* data for session 2: sort, filter and calculate total/subtotal
* ------------------------------------------
* table to save index of subotal / total line in excel tanle
* this ideal to control index of subtotal / total line later
* for ex, when get subtotal / total line to format
types: begin of st_subtot_indexs,
index type i,
end of st_subtot_indexs.
data: lt_subtot_indexs type table of st_subtot_indexs.
data: wa_subtot_indexs like line of lt_subtot_indexs.
* data table after append subtotal
data: lt_excel type ref to data.
data: l_tabix type i.
data: l_save_index type i.
* dyn subtotal table name
data: l_collect type string.
* subtotal range, to format subtotal (and total)
data: subranges type soi_range_list.
data: subrangeitem type soi_range_item.
data: l_sub_index type i.
* table after append subtotal lines
field-symbols: &lt;f_excel_tab&gt; type standard table.
field-symbols: &lt;f_excel_line&gt; type any.
* dyn subtotal tables
field-symbols: &lt;f_collect_tab&gt; type standard table.
field-symbols: &lt;f_collect_line&gt; type any.
field-symbols: &lt;f_filter_idx_line&gt; like line of LT_FILTER_IDX_KKBLO.
field-symbols: &lt;f_fieldcat_line&gt; like line of LT_FIELDCAT_KKBLO.
field-symbols: &lt;f_grouplevels_line&gt; like line of LT_GROUPLEVELS_KKBLO.
field-symbols: &lt;f_line&gt; type any.
* Data for session 3: map data to semantic table
* ------------------------------------------
types: begin of st_column_index,
fieldname type kkblo_fieldname,
tabname type kkblo_tabname,
col like sy-index,
end of st_column_index.
* columns index
data: lt_column_index type table of st_column_index.
data: wa_column_index like line of lt_column_index.
* table of dependent field ( currency and quantity unit field)
data: lt_fieldcat_depf type kkblo_t_fieldcat.
data: wa_fieldcat_depf type kkblo_fieldcat.
* XXL interface:
* -XXL: contain exporting columns characteristic
data: lt_sema type table of gxxlt_s initial size 0.
data: wa_sema like line of lt_sema.
* -XXL interface: header
data: lt_hkey type table of gxxlt_h initial size 0.
data: wa_hkey like line of lt_hkey.
* -XXL interface: header keys
data: lt_vkey type table of gxxlt_v initial size 0.
data: wa_vkey like line of lt_vkey.
* Number of H Keys: number of key columns
data: l_n_hrz_keys type i.
* Number of data columns in the list object: non-key columns no
data: l_n_att_cols type i.
* Number of V Keys: number of header row
data: l_n_vrt_keys type i.
* curency to format amount
data: lt_tcurx type table of tcurx.
data: wa_tcurx like line of lt_tcurx.
data: l_def type flag. &quot; currency / quantity flag
data: wa_t006 type t006. &quot; decimal place of unit
data: l_num type i. &quot; table columns number
data: l_typ type c. &quot; table type
data: wa type ref to data.
data: l_int type i.
data: l_counter type i.
field-symbols: &lt;f_excel_column&gt; type any.
field-symbols: &lt;f_fcat_column&gt; type any.
* Data for session 4: write to excel
* ------------------------------------------
data: data_starting_at type i value 1.
data: data_ending_at type i value -1.
data: sema_type type c.
data l_error type ref to c_oi_proxy_error.
data count type i.
data datac type i.
data datareal type i. &quot; exporting column number
data vkeycount type i.
data all type i.
data mit type i value 1. &quot; index of recent row?
data li_col_pos type i value 1. &quot; column position
data li_col_num type i. &quot; table columns number
field-symbols: &lt;line&gt; type any.
field-symbols: &lt;item&gt; type any.
data td type sydes_desc.
data: typ.
data: ranges type soi_range_list.
data: rangeitem type soi_range_item.
data: contents type soi_generic_table.
data: contentsitem type soi_generic_item.
data: semaitem type gxxlt_s.
data: hkeyitem type gxxlt_h.
data: vkeyitem type gxxlt_v.
data: li_commentary_rows type i. &quot;row number of title lines + 1
data: lo_error_w type ref to i_oi_error.
data: l_retcode type soi_ret_string.
data: no_flush type c value &apos;X&apos;.
data: li_head_top type i. &quot;header rows position
* Data for session 5: Save and clode document
* ------------------------------------------
data: li_document_size type i.
data: ls_path type RLGRAP-FILENAME.
* MACRO: Close_document
*-------------------------------------------
DEFINE close_document.
clear: l_is_closed.
IF lo_proxy is not initial.
* check proxy detroyed adi
call method lo_proxy-&gt;is_destroyed
IMPORTING
ret_value = l_is_closed.
* if dun detroyed yet: close -&gt; release proxy
IF l_is_closed is initial.
call method lo_proxy-&gt;close_document
* EXPORTING
* do_save = do_save
IMPORTING
error = lo_error
retcode = lc_retcode.
ENDIF.
call method lo_proxy-&gt;release_document
IMPORTING
error = lo_error
retcode = lC_retcode.
else.
lc_retcode = c_oi_errors=&gt;ret_document_not_open.
ENDIF.
* Detroy control container
IF lo_control is not initial.
CALL METHOD lo_control-&gt;destroy_control.
ENDIF.
clear:
lo_spreadsheet,
lo_proxy,
lo_control.
* free local
clear: l_is_closed.
END-OF-DEFINITION.
* Macro to catch DOI error
*-------------------------------------------
DEFINE error_doi.
if lc_retcode ne c_oi_errors=&gt;ret_ok.
close_document.
call method lo_error-&gt;raise_message
EXPORTING
type = &apos;E&apos;.
clear: lo_error.
endif.
END-OF-DEFINITION.
*--------------------------------------------------------------------*
* SESSION 0: DOI CONSTRUCTOR
*--------------------------------------------------------------------*
* check active windown
call function &apos;GUI_HAS_ACTIVEX&apos;
IMPORTING
return = l_has_activex.
if l_has_activex is initial.
raise MISS_GUIDE.
endif.
* Get Container Object of Screen
call method c_oi_container_control_creator=&gt;get_container_control
IMPORTING
control = lo_control
retcode = lC_retcode.
error_doi.
* Initialize Container control
CALL METHOD lo_control-&gt;init_control
EXPORTING
parent = CL_GUI_CONTAINER=&gt;DEFAULT_SCREEN
r3_application_name = &apos;&apos;
inplace_enabled = &apos;X&apos;
no_flush = &apos;X&apos;
register_on_close_event = &apos;X&apos;
register_on_custom_event = &apos;X&apos;
IMPORTING
error = lO_ERROR
retcode = lc_retcode.
error_doi.
* Get Proxy Document:
* check exist of document proxy, if exist -&gt; close first
if not lo_proxy is initial.
close_document.
endif.
IF i_xls is not initial.
* xls format, doctype = soi_doctype_excel97_sheet
l_doctype_excel_sheet = &apos;Excel.Sheet.8&apos;.
else.
* xlsx format, doctype = soi_doctype_excel_sheet
l_doctype_excel_sheet = &apos;Excel.Sheet&apos;.
ENDIF.
CALL METHOD lo_control-&gt;get_document_proxy
EXPORTING
document_type = l_doctype_excel_sheet
register_container = &apos;X&apos;
IMPORTING
document_proxy = lo_proxy
error = lO_ERROR
retcode = lc_retcode.
error_doi.
IF I_DOCUMENT_URL is initial.
* create new excel document
call method lo_proxy-&gt;create_document
EXPORTING
create_view_data = &apos;X&apos;
open_inplace = &apos;X&apos;
no_flush = &apos;X&apos;
IMPORTING
ERROR = lO_ERROR
retcode = lc_retcode.
error_doi.
else.
* Read excel template for i_DOCUMENT_URL
* this excel template can be store in local or server
CALL METHOD lo_proxy-&gt;open_document
EXPORTING
document_url = i_document_url
open_inplace = &apos;X&apos;
no_flush = &apos;X&apos;
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
endif.
* Check Spreadsheet Interface of Document Proxy
CALL METHOD lo_proxy-&gt;has_spreadsheet_interface
IMPORTING
is_available = li_has
error = lO_ERROR
retcode = lc_retcode.
error_doi.
* create Spreadsheet object
CHECK li_has IS NOT INITIAL.
CALL METHOD lo_proxy-&gt;get_spreadsheet_interface
IMPORTING
sheet_interface = lo_spreadsheet
error = lO_ERROR
retcode = lc_retcode.
error_doi.
*--------------------------------------------------------------------*
* SESSION 1: GET LVC DATA FROM ALV OBJECT
*--------------------------------------------------------------------*
* data table
create object lo_grid
EXPORTING
i_parent = CL_GUI_CONTAINER=&gt;SCREEN0.
call method lo_grid-&gt;get_alv_attributes
EXPORTING
io_grid = io_alv
IMPORTING
Et_table = lt_alv.
assign lt_alv-&gt;* to &lt;f_alv_tab&gt;.
* fieldcat
CALL METHOD iO_alv-&gt;GET_FRONTEND_FIELDCATALOG
IMPORTING
ET_FIELDCATALOG = lt_fieldcat_LVC.
* table name
loop at lt_fieldcat_LVC into wa_fieldcat_lvc
where not tabname is initial.
l_tabname = wa_fieldcat_lvc-tabname.
exit.
endloop.
if sy-subrc ne 0.
l_tabname = &apos;1&apos;.
endif.
clear: wa_fieldcat_lvc.
* sort table
CALL METHOD IO_ALV-&gt;GET_SORT_CRITERIA
IMPORTING
ET_SORT = lt_sort_lvc.
* filter index
CALL METHOD IO_ALV-&gt;GET_FILTERED_ENTRIES
IMPORTING
ET_FILTERED_ENTRIES = lt_filter_idx_lvc.
* group level + subtotal
CALL METHOD IO_ALV-&gt;GET_SUBTOTALS
IMPORTING
EP_COLLECT00 = lt_collect00
EP_COLLECT01 = lt_collect01
EP_COLLECT02 = lt_collect02
EP_COLLECT03 = lt_collect03
EP_COLLECT04 = lt_collect04
EP_COLLECT05 = lt_collect05
EP_COLLECT06 = lt_collect06
EP_COLLECT07 = lt_collect07
EP_COLLECT08 = lt_collect08
EP_COLLECT09 = lt_collect09
ET_GROUPLEVELS = lt_GROUPLEVELS_LVC.
assign lt_collect00-&gt;* to &lt;f_collect00&gt;.
assign lt_collect01-&gt;* to &lt;f_collect01&gt;.
assign lt_collect02-&gt;* to &lt;f_collect02&gt;.
assign lt_collect03-&gt;* to &lt;f_collect03&gt;.
assign lt_collect04-&gt;* to &lt;f_collect04&gt;.
assign lt_collect05-&gt;* to &lt;f_collect05&gt;.
assign lt_collect06-&gt;* to &lt;f_collect06&gt;.
assign lt_collect07-&gt;* to &lt;f_collect07&gt;.
assign lt_collect08-&gt;* to &lt;f_collect08&gt;.
assign lt_collect09-&gt;* to &lt;f_collect09&gt;.
* transfer to KKBLO struct
CALL FUNCTION &apos;LVC_TRANSFER_TO_KKBLO&apos;
EXPORTING
IT_FIELDCAT_LVC = lt_fieldcat_lvc
IT_SORT_LVC = lt_sort_lvc
IT_FILTER_INDEX_LVC = lt_filter_idx_lvc
IT_GROUPLEVELS_LVC = lt_grouplevels_lvc
IMPORTING
ET_FIELDCAT_KKBLO = lt_fieldcat_kkblo
ET_SORT_KKBLO = lt_sort_kkblo
ET_FILTERED_ENTRIES_KKBLO = lt_filter_idx_kkblo
ET_GROUPLEVELS_KKBLO = lt_grouplevels_kkblo
TABLES
IT_DATA = &lt;f_alv_tab&gt;
EXCEPTIONS
IT_DATA_MISSING = 1
IT_FIELDCAT_LVC_MISSING = 2
OTHERS = 3.
IF SY-SUBRC &lt;&gt; 0.
raise ex_transfer_KKBLO_ERROR.
ENDIF.
clear:
wa_fieldcat_lvc,
lt_fieldcat_lvc,
lt_sort_lvc,
lt_filter_idx_lvc,
lt_GROUPLEVELS_LVC.
clear:
lo_grid.
*--------------------------------------------------------------------*
* SESSION 2: SORT, FILTER AND CALCULATE TOTAL / SUBTOTAL
*--------------------------------------------------------------------*
* append subtotal &amp; total line
create data lt_excel like &lt;f_ALV_TAB&gt;.
assign lt_excel-&gt;* to &lt;f_excel_tab&gt;.
loop at &lt;f_alv_tab&gt; assigning &lt;f_line&gt;.
l_save_index = sy-tabix.
* filter base on filter index table
read table LT_FILTER_IDX_KKBLO assigning &lt;f_filter_idx_line&gt;
with key index = l_save_index
binary search.
if sy-subrc ne 0.
append &lt;f_line&gt; to &lt;f_excel_tab&gt;.
endif.
* append subtotal lines
read table LT_GROUPLEVELS_KKBLO assigning &lt;f_grouplevels_line&gt;
with key index_to = l_save_index
binary search.
if sy-subrc = 0.
l_tabix = sy-tabix.
do.
if &lt;f_grouplevels_line&gt;-subtot eq &apos;X&apos; and
&lt;f_grouplevels_line&gt;-hide_level is initial and
&lt;f_grouplevels_line&gt;-cindex_from ne 0.
* dynamic append subtotal line to excel table base on grouplevel table
* ex &lt;f_GROUPLEVELS_line&gt;-level = 1
* then &lt;f_collect_tab&gt; = &apos;&lt;F_COLLECT01&gt;&apos;
l_collect = &lt;f_grouplevels_line&gt;-level.
condense l_collect.
concatenate &apos;&lt;F_COLLECT0&apos;
l_collect &apos;&gt;&apos;
* &apos;-&gt;*&apos;
into l_collect.
assign (l_collect) to &lt;f_collect_tab&gt;.
* incase there&apos;re more than 1 total line of group, at the same level
* for example: subtotal of multi currency
LOOP AT &lt;f_collect_tab&gt; assigning &lt;f_collect_line&gt;.
IF sy-tabix between &lt;f_grouplevels_line&gt;-cindex_from
and &lt;f_grouplevels_line&gt;-cindex_to.
append &lt;f_collect_line&gt; to &lt;f_excel_tab&gt;.
* save subtotal lines index
wa_subtot_indexs-index = sy-tabix.
append wa_subtot_indexs to lt_subtot_indexs.
* append sub total ranges table for format later
add 1 to l_sub_index.
subrangeitem-name = l_sub_index.
condense subrangeitem-name.
concatenate &apos;SUBTOT&apos;
subrangeitem-name
into subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. &quot; start col
append subrangeitem to subranges.
clear: subrangeitem.
ENDIF.
ENDLOOP.
unassign: &lt;f_collect_tab&gt;.
unassign: &lt;f_collect_line&gt;.
clear: l_collect.
endif.
* check next subtotal level of group
unassign: &lt;f_grouplevels_line&gt;.
add 1 to l_tabix.
read table LT_GROUPLEVELS_KKBLO assigning &lt;f_grouplevels_line&gt;
index l_tabix.
if sy-subrc ne 0
or &lt;f_grouplevels_line&gt;-index_to ne l_save_index.
exit.
endif.
unassign:
&lt;f_collect_tab&gt;,
&lt;f_collect_line&gt;.
enddo.
endif.
clear:
l_tabix,
l_save_index.
unassign:
&lt;f_filter_idx_line&gt;,
&lt;f_grouplevels_line&gt;.
endloop.
* free local data
unassign:
&lt;f_line&gt;,
&lt;f_collect_tab&gt;,
&lt;f_collect_line&gt;,
&lt;f_fieldcat_line&gt;.
* append grand total line
IF &lt;f_collect00&gt; is assigned.
assign &lt;f_collect00&gt; to &lt;f_collect_tab&gt;.
if &lt;f_collect_tab&gt; is not initial.
LOOP AT &lt;f_collect_tab&gt; assigning &lt;f_collect_line&gt;.
append &lt;f_collect_line&gt; to &lt;f_excel_tab&gt;.
* save total line index
wa_subtot_indexs-index = sy-tabix.
append wa_subtot_indexs to lt_subtot_indexs.
* append grand total range (to format)
add 1 to l_sub_index.
subrangeitem-name = l_sub_index.
condense subrangeitem-name.
concatenate &apos;TOTAL&apos;
subrangeitem-name
into subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. &quot; start col
append subrangeitem to subranges.
ENDLOOP.
endif.
ENDIF.
clear:
subrangeitem,
LT_SORT_KKBLO,
&lt;f_collect00&gt;,
&lt;f_collect01&gt;,
&lt;f_collect02&gt;,
&lt;f_collect03&gt;,
&lt;f_collect04&gt;,
&lt;f_collect05&gt;,
&lt;f_collect06&gt;,
&lt;f_collect07&gt;,
&lt;f_collect08&gt;,
&lt;f_collect09&gt;.
unassign:
&lt;f_collect00&gt;,
&lt;f_collect01&gt;,
&lt;f_collect02&gt;,
&lt;f_collect03&gt;,
&lt;f_collect04&gt;,
&lt;f_collect05&gt;,
&lt;f_collect06&gt;,
&lt;f_collect07&gt;,
&lt;f_collect08&gt;,
&lt;f_collect09&gt;,
&lt;f_collect_tab&gt;,
&lt;f_collect_line&gt;.
*--------------------------------------------------------------------*
* SESSION 3: MAP DATA TO SEMANTIC TABLE
*--------------------------------------------------------------------*
* get dependent field field: currency and quantity
create data wa like line of &lt;f_excel_tab&gt;.
assign wa-&gt;* to &lt;f_excel_line&gt;.
describe field &lt;f_excel_line&gt; type l_typ components l_num.
do l_num times.
l_save_index = sy-index.
assign component l_save_index of structure &lt;f_excel_line&gt;
to &lt;f_excel_column&gt;.
if sy-subrc ne 0.
message e059(0k) with &apos;FATAL ERROR&apos; raising fatal_error.
endif.
loop at LT_FIELDCAT_KKBLO assigning &lt;f_fieldcat_line&gt;
where tabname = l_tabname.
assign component &lt;f_fieldcat_line&gt;-fieldname
of structure &lt;f_excel_line&gt; to &lt;f_fcat_column&gt;.
describe distance between &lt;f_excel_column&gt; and &lt;f_fcat_column&gt;
into l_int in byte mode.
* append column index
* this columns index is of table, not fieldcat
if l_int = 0.
wa_column_index-fieldname = &lt;f_fieldcat_line&gt;-fieldname.
wa_column_index-tabname = &lt;f_fieldcat_line&gt;-tabname.
wa_column_index-col = l_save_index.
append wa_column_index to lt_column_index.
endif.
* append dependent fields (currency and quantity unit)
if &lt;f_fieldcat_line&gt;-cfieldname is not initial.
clear wa_fieldcat_depf.
wa_fieldcat_depf-fieldname = &lt;f_fieldcat_line&gt;-cfieldname.
wa_fieldcat_depf-tabname = &lt;f_fieldcat_line&gt;-ctabname.
collect wa_fieldcat_depf into lt_fieldcat_depf.
endif.
if &lt;f_fieldcat_line&gt;-qfieldname is not initial.
clear wa_fieldcat_depf.
wa_fieldcat_depf-fieldname = &lt;f_fieldcat_line&gt;-qfieldname.
wa_fieldcat_depf-tabname = &lt;f_fieldcat_line&gt;-qtabname.
collect wa_fieldcat_depf into lt_fieldcat_depf.
endif.
* rewrite field data type
if &lt;f_fieldcat_line&gt;-inttype = &apos;X&apos;
and &lt;f_fieldcat_line&gt;-datatype(3) = &apos;INT&apos;.
&lt;f_fieldcat_line&gt;-inttype = &apos;I&apos;.
endif.
endloop.
clear: l_save_index.
unassign: &lt;f_fieldcat_line&gt;.
enddo.
* build semantic tables
l_n_hrz_keys = 1.
* Get keyfigures
loop at LT_FIELDCAT_KKBLO assigning &lt;f_fieldcat_line&gt;
where tabname = l_tabname
and tech ne &apos;X&apos;
and no_out ne &apos;X&apos;.
clear wa_sema.
clear wa_hkey.
* Units belong to keyfigures -&gt; display as str
read table lt_fieldcat_depf into wa_fieldcat_depf with key
fieldname = &lt;f_fieldcat_line&gt;-fieldname
tabname = &lt;f_fieldcat_line&gt;-tabname.
if sy-subrc = 0.
wa_sema-col_typ = &apos;STR&apos;.
wa_sema-col_ops = &apos;DFT&apos;.
* Keyfigures
else.
case &lt;f_fieldcat_line&gt;-datatype.
when &apos;QUAN&apos;.
wa_sema-col_typ = &apos;N03&apos;.
if &lt;f_fieldcat_line&gt;-no_sum ne &apos;X&apos;.
wa_sema-col_ops = &apos;ADD&apos;.
else.
wa_sema-col_ops = &apos;NOP&apos;. &quot; no dependent field
endif.
when &apos;DATS&apos;.
wa_sema-col_typ = &apos;DAT&apos;.
wa_sema-col_ops = &apos;NOP&apos;.
when &apos;CHAR&apos;.
wa_sema-col_typ = &apos;STR&apos;.
wa_sema-col_ops = &apos;DFT&apos;. &quot; dependent field
* incase numeric, ex &apos;00120&apos; -&gt; display as &apos;12&apos;
when &apos;NUMC&apos;.
wa_sema-col_typ = &apos;STR&apos;.
wa_sema-col_ops = &apos;DFT&apos;.
when others.
wa_sema-col_typ = &apos;NUM&apos;.
if &lt;f_fieldcat_line&gt;-no_sum ne &apos;X&apos;.
wa_sema-col_ops = &apos;ADD&apos;.
else.
wa_sema-col_ops = &apos;NOP&apos;.
endif.
endcase.
endif.
l_counter = l_counter + 1.
l_n_att_cols = l_n_att_cols + 1.
wa_sema-col_no = l_counter.
read table lt_column_index into wa_column_index with key
fieldname = &lt;f_fieldcat_line&gt;-fieldname
tabname = &lt;f_fieldcat_line&gt;-tabname.
if sy-subrc = 0.
wa_sema-col_src = wa_column_index-col.
else.
raise fatal_error.
endif.
* columns index of ref currency field in table
if not &lt;f_fieldcat_line&gt;-cfieldname is initial.
read table lt_column_index into wa_column_index with key
fieldname = &lt;f_fieldcat_line&gt;-cfieldname
tabname = &lt;f_fieldcat_line&gt;-ctabname.
if sy-subrc = 0.
wa_sema-col_cur = wa_column_index-col.
endif.
* quantities fields
* treat as currency when display on excel
elseif not &lt;f_fieldcat_line&gt;-qfieldname is initial.
read table lt_column_index into wa_column_index with key
fieldname = &lt;f_fieldcat_line&gt;-qfieldname
tabname = &lt;f_fieldcat_line&gt;-qtabname.
if sy-subrc = 0.
wa_sema-col_cur = wa_column_index-col.
endif.
endif.
* Treat of fixed currency in the fieldcatalog for column
data: l_num_help(2) type n.
if not &lt;f_fieldcat_line&gt;-currency is initial.
select * from tcurx into table lt_tcurx.
sort lt_tcurx.
read table lt_tcurx into wa_tcurx
with key currkey = &lt;f_fieldcat_line&gt;-currency.
if sy-subrc = 0.
l_num_help = wa_tcurx-currdec.
concatenate &apos;N&apos; l_num_help into wa_sema-col_typ.
wa_sema-col_cur = sy-tabix * ( -1 ).
endif.
endif.
wa_hkey-col_no = l_n_att_cols.
wa_hkey-row_no = l_n_hrz_keys.
wa_hkey-col_name = &lt;f_fieldcat_line&gt;-reptext.
append wa_hkey to lt_hkey.
append wa_sema to lt_sema.
endloop.
* free local data
clear:
lt_column_index,
wa_column_index,
lt_fieldcat_depf,
wa_fieldcat_depf,
lt_tcurx,
wa_tcurx,
l_num,
l_typ,
wa,
l_int,
l_counter.
unassign:
&lt;f_fieldcat_line&gt;,
&lt;f_excel_line&gt;,
&lt;f_excel_column&gt;,
&lt;f_fcat_column&gt;.
*--------------------------------------------------------------------*
* SESSION 4: WRITE TO EXCEL
*--------------------------------------------------------------------*
clear: wa_tcurx.
refresh: lt_tcurx.
* if spreadsheet dun have proxy yet
if li_has is initial.
l_retcode = c_oi_errors=&gt;ret_interface_not_supported.
call method c_oi_errors=&gt;create_error_for_retcode
EXPORTING
retcode = l_retcode
no_flush = no_flush
IMPORTING
error = lo_error_w.
exit.
endif.
create object l_error
EXPORTING
object_name = &apos;OLE_DOCUMENT_PROXY&apos;
method_name = &apos;get_ranges_names&apos;.
call method c_oi_errors=&gt;add_error
EXPORTING
error = l_error.
describe table lt_sema lines datareal.
describe table &lt;f_excel_tab&gt; lines datac.
describe table lt_vkey lines vkeycount.
if datac = 0.
raise inv_data_range.
endif.
if vkeycount ne l_n_vrt_keys.
raise dim_mismatch_vkey.
endif.
all = l_n_vrt_keys + l_n_att_cols.
if datareal ne all.
raise dim_mismatch_sema.
endif.
data: decimal type c.
* get decimal separator format (&apos;.&apos;, &apos;,&apos;, ...) in Office config
call method lo_proxy-&gt;get_application_property
EXPORTING
property_name = &apos;INTERNATIONAL&apos;
subproperty_name = &apos;DECIMAL_SEPARATOR&apos;
CHANGING
retvalue = decimal.
data: wa_usr type usr01.
select * from usr01 into wa_usr where bname = sy-uname.
endselect.
data: comma_elim(4) type c.
data: help6 type i.
field-symbols &lt;g&gt; type any.
data search_item(4) value &apos; #&apos;.
concatenate &apos;,&apos; decimal &apos;.&apos; decimal into comma_elim.
data help type i. &quot; table (with subtotal) line number
help = datac.
data: rowmax type i value 1. &quot; header row number
data: columnmax type i value 0. &quot; header columns number
loop at lt_hkey into hkeyitem.
if hkeyitem-col_no &gt; columnmax.
columnmax = hkeyitem-col_no.
endif.
if hkeyitem-row_no &gt; rowmax.
rowmax = hkeyitem-row_no.
endif.
endloop.
data: hkeycolumns type i. &quot; header columns no
hkeycolumns = columnmax.
if hkeycolumns &lt; l_n_att_cols.
hkeycolumns = l_n_att_cols.
endif.
columnmax = 0.
loop at lt_vkey into vkeyitem.
if vkeyitem-col_no &gt; columnmax.
columnmax = vkeyitem-col_no.
endif.
endloop.
data overflow type i value 1.
data testname(10) type c.
data temp2 type i. &quot; 1st item row position in excel
data realmit type i value 1.
data realoverflow type i value 1. &quot; row index in content
call method lo_spreadsheet-&gt;screen_update
EXPORTING
updating = &apos;&apos;.
call method lo_spreadsheet-&gt;load_lib.
data: str(40) type c. &quot; range names of columns range (w/o col header)
data: rows type i. &quot; row postion of 1st item line in ecxel
* calculate row position of data table
describe table iT_LISTHEADER lines li_commentary_rows.
* if grid had title, add 1 empy line between title and table
if li_commentary_rows ne 0.
add 1 to li_commentary_rows.
endif.
* add top position of block data
li_commentary_rows = li_commentary_rows + i_top - 1.
* write header (commentary rows)
data: li_commentary_row_index type i value 1.
data: li_content_index type i value 1.
data: ls_index(10) type c.
data ls_commentary_range(40) type c value &apos;TITLE&apos;.
data: li_font_bold type i.
data: li_font_italic type i.
data: li_font_size type i.
loop at iT_LISTHEADER into wa_listheader.
li_commentary_row_index = i_top + li_content_index - 1.
ls_index = li_content_index.
condense ls_index.
concatenate ls_commentary_range(5) ls_index
into ls_commentary_range.
condense ls_commentary_range.
* insert title range
call method lo_spreadsheet-&gt;insert_range_dim
EXPORTING
name = ls_commentary_range
top = li_commentary_row_index
left = i_left
rows = 1
columns = 1
no_flush = no_flush.
* format range
case wa_listheader-typ.
when &apos;H&apos;. &quot;title
li_font_size = 16.
li_font_bold = 1.
li_font_italic = -1.
when &apos;S&apos;. &quot;subtile
li_font_size = -1.
li_font_bold = 1.
li_font_italic = -1.
when others. &quot;&apos;A&apos; comment
li_font_size = -1.
li_font_bold = -1.
li_font_italic = 1.
endcase.
call method lo_spreadsheet-&gt;set_font
EXPORTING
rangename = ls_commentary_range
family = &apos;&apos;
size = li_font_size
bold = li_font_bold
italic = li_font_italic
align = 0
no_flush = no_flush.
* title: range content
rangeitem-name = ls_commentary_range.
rangeitem-columns = 1.
rangeitem-rows = 1.
append rangeitem to ranges.
contentsitem-row = li_content_index.
contentsitem-column = 1.
concatenate wa_listheader-key
wa_listheader-info
into contentsitem-value
separated by space.
condense contentsitem-value.
append contentsitem to contents.
add 1 to li_content_index.
clear:
rangeitem,
contentsitem,
ls_index.
endloop.
* set range data title
call method lo_spreadsheet-&gt;set_ranges_data
EXPORTING
ranges = ranges
contents = contents
no_flush = no_flush.
refresh:
ranges,
contents.
rows = rowmax + li_commentary_rows + 1.
all = wa_usr-datfm.
all = all + 3.
loop at lt_sema into semaitem.
if semaitem-col_typ = &apos;DAT&apos; or semaitem-col_typ = &apos;MON&apos; or
semaitem-col_typ = &apos;N00&apos; or semaitem-col_typ = &apos;N01&apos; or
semaitem-col_typ = &apos;N01&apos; or semaitem-col_typ = &apos;N02&apos; or
semaitem-col_typ = &apos;N03&apos; or semaitem-col_typ = &apos;PCT&apos; or
semaitem-col_typ = &apos;STR&apos; or semaitem-col_typ = &apos;NUM&apos;.
clear str.
str = semaitem-col_no.
condense str.
concatenate &apos;DATA&apos; str into str.
mit = semaitem-col_no.
li_col_pos = semaitem-col_no + i_left - 1.
* range from data1 to data(n), for each columns of table
call method lo_spreadsheet-&gt;insert_range_dim
EXPORTING
name = str
top = rows
left = li_col_pos
rows = help
columns = 1
no_flush = no_flush.
data dec type i value -1.
data typeinfo type sydes_typeinfo.
loop at &lt;f_excel_tab&gt; assigning &lt;line&gt;.
assign component semaitem-col_no of structure &lt;line&gt; to &lt;item&gt;.
describe field &lt;item&gt; into td.
read table td-types index 1 into typeinfo.
if typeinfo-type = &apos;P&apos;.
dec = typeinfo-decimals.
elseif typeinfo-type = &apos;I&apos;.
dec = 0.
endif.
describe field &lt;line&gt; type typ components count.
mit = 1.
do count times.
if mit = semaitem-col_src.
assign component sy-index of structure &lt;line&gt; to &lt;item&gt;.
describe field &lt;item&gt; into td.
read table td-types index 1 into typeinfo.
if typeinfo-type = &apos;P&apos;.
dec = typeinfo-decimals.
endif.
exit.
endif.
mit = mit + 1.
enddo.
exit.
endloop.
* format for each columns of table (w/o columns headers)
if semaitem-col_typ = &apos;DAT&apos;.
if semaitem-col_no &gt; vkeycount.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = all
no_flush = no_flush.
else.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = 0
no_flush = no_flush.
endif.
elseif semaitem-col_typ = &apos;STR&apos;.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = 0
no_flush = no_flush.
elseif semaitem-col_typ = &apos;MON&apos;.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = 10
no_flush = no_flush.
elseif semaitem-col_typ = &apos;N00&apos;.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = 1
decimals = 0
no_flush = no_flush.
elseif semaitem-col_typ = &apos;N01&apos;.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = 1
decimals = 1
no_flush = no_flush.
elseif semaitem-col_typ = &apos;N02&apos;.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = 1
decimals = 2
no_flush = no_flush.
elseif semaitem-col_typ = &apos;N03&apos;.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = 1
decimals = 3
no_flush = no_flush.
elseif semaitem-col_typ = &apos;N04&apos;.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = 1
decimals = 4
no_flush = no_flush.
elseif semaitem-col_typ = &apos;NUM&apos;.
if dec eq -1.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = 1
decimals = 2
no_flush = no_flush.
else.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = 1
decimals = dec
no_flush = no_flush.
endif.
elseif semaitem-col_typ = &apos;PCT&apos;.
call method lo_spreadsheet-&gt;set_format
EXPORTING
rangename = str
currency = &apos;&apos;
typ = 3
decimals = 0
no_flush = no_flush.
endif.
endif.
endloop.
* get item contents for set_range_data method
* get currency cell also
mit = 1.
data: currcells type soi_cell_table.
data: curritem type soi_cell_item.
curritem-rows = 1.
curritem-columns = 1.
curritem-front = -1.
curritem-back = -1.
curritem-font = &apos;&apos;.
curritem-size = -1.
curritem-bold = -1.
curritem-italic = -1.
curritem-align = -1.
curritem-frametyp = -1.
curritem-framecolor = -1.
curritem-currency = &apos;&apos;.
curritem-number = 1.
curritem-input = -1.
data: conv_exit(10) type c.
data: const type i.
* Change for Correction request
* Initial 10000 lines are missing in Excel Export
* if there are only 2 columns in exported List object.
if datareal gt 2.
const = 20000 / datareal.
else.
const = 20000 / ( datareal + 2 ).
endif.
data: lines type i.
data: innerlines type i.
data: counter type i.
data: curritem2 like curritem.
data: curritem3 like curritem.
data: length type i.
data: found.
* append content table (for method set_range_content)
loop at &lt;f_excel_tab&gt; assigning &lt;line&gt;.
* save line index to compare with lt_subtot_indexs,
* to discover line is a subtotal / totale line or not
* ex use to set &apos;dun display zero in subtotal / total line&apos;
l_save_index = sy-tabix.
do datareal times.
read table lt_sema into semaitem with key col_no = sy-index.
if semaitem-col_src ne 0.
assign component semaitem-col_src
of structure &lt;line&gt; to &lt;item&gt;.
else.
assign component sy-index
of structure &lt;line&gt; to &lt;item&gt;.
endif.
contentsitem-row = realoverflow.
if sy-subrc = 0.
move semaitem-col_ops to search_item(3).
search &apos;ADD#CNT#MIN#MAX#AVG#NOP#DFT#&apos;
for search_item.
if sy-subrc ne 0.
raise error_in_sema.
endif.
move semaitem-col_typ to search_item(3).
search &apos;NUM#N00#N01#N02#N03#N04#PCT#DAT#MON#STR#&apos;
for search_item.
if sy-subrc ne 0.
raise error_in_sema.
endif.
contentsitem-column = sy-index.
if semaitem-col_typ eq &apos;DAT&apos; or semaitem-col_typ eq &apos;MON&apos;.
if semaitem-col_no &gt; vkeycount.
&quot; Hinweis 512418
&quot; EXCEL bezieht Datumsangaben
&quot; auf den 31.12.1899, behandelt
&quot; aber 1900 als ein Schaltjahr
&quot; d.h. ab 1.3.1900 korrekt
&quot; 1.3.1900 als Zahl = 61
data: genesis type d value &apos;18991230&apos;.
data: number_of_days type p.
* change for date in char format &amp; sema_type = X
data: temp_date type d.
if not &lt;item&gt; is initial and not &lt;item&gt; co &apos; &apos; and not
&lt;item&gt; co &apos;0&apos;.
* change for date in char format &amp; sema_type = X starts
if sema_type = &apos;X&apos;.
describe field &lt;item&gt; type typ.
if typ = &apos;C&apos;.
temp_date = &lt;item&gt;.
number_of_days = temp_date - genesis.
else.
number_of_days = &lt;item&gt; - genesis.
endif.
else.
number_of_days = &lt;item&gt; - genesis.
endif.
* change for date in char format &amp; sema_type = X ends
if number_of_days &lt; 61.
number_of_days = number_of_days - 1.
endif.
set country &apos;DE&apos;.
write number_of_days to contentsitem-value
no-grouping
left-justified.
set country space.
translate contentsitem-value using comma_elim.
else.
clear contentsitem-value.
endif.
else.
move &lt;item&gt; to contentsitem-value.
endif.
elseif semaitem-col_typ eq &apos;NUM&apos; or
semaitem-col_typ eq &apos;N00&apos; or
semaitem-col_typ eq &apos;N01&apos; or
semaitem-col_typ eq &apos;N02&apos; or
semaitem-col_typ eq &apos;N03&apos; or
semaitem-col_typ eq &apos;N04&apos; or
semaitem-col_typ eq &apos;PCT&apos;.
set country &apos;DE&apos;.
describe field &lt;item&gt; type typ.
if semaitem-col_cur is initial.
if typ ne &apos;F&apos;.
write &lt;item&gt; to contentsitem-value no-grouping
no-sign decimals 14.
else.
write &lt;item&gt; to contentsitem-value no-grouping
no-sign.
endif.
else.
* Treat of fixed curreny for column &gt;&gt;Y9CK007319
if semaitem-col_cur &lt; 0.
semaitem-col_cur = semaitem-col_cur * ( -1 ).
select * from tcurx into table lt_tcurx.
sort lt_tcurx.
read table lt_tcurx into
wa_tcurx index semaitem-col_cur.
if sy-subrc = 0.
if typ ne &apos;F&apos;.
write &lt;item&gt; to contentsitem-value no-grouping
currency wa_tcurx-currkey no-sign decimals 14.
else.
write &lt;item&gt; to contentsitem-value no-grouping
currency wa_tcurx-currkey no-sign.
endif.
endif.
else.
assign component semaitem-col_cur
of structure &lt;line&gt; to &lt;g&gt;.
* mit = index of recent row
curritem-top = rowmax + mit + li_commentary_rows.
li_col_pos = sy-index + i_left - 1.
curritem-left = li_col_pos.
* if filed is quantity field (qfieldname ne space)
* or amount field (cfieldname ne space), then format decimal place
* corresponding with config
clear: l_def.
read table LT_FIELDCAT_KKBLO assigning &lt;f_fieldcat_line&gt;
with key tabname = l_tabname
tech = space
no_out = space
col_pos = semaitem-col_no.
IF sy-subrc = 0.
IF &lt;f_fieldcat_line&gt;-cfieldname is not initial.
l_def = &apos;C&apos;.
else.&quot;if &lt;f_fieldcat_line&gt;-qfieldname is not initial.
l_def = &apos;Q&apos;.
ENDIF.
ENDIF.
* if field is amount field
* exporting of amount field base on currency decimal table: TCURX
IF l_def = &apos;C&apos;. &quot;field is amount field
select single * from tcurx into wa_tcurx
where currkey = &lt;g&gt;.
* if amount ref to un-know currency -&gt; default decimal = 2
if sy-subrc eq 0.
curritem-decimals = wa_tcurx-currdec.
else.
curritem-decimals = 2.
endif.
append curritem to currcells.
if typ ne &apos;F&apos;.
write &lt;item&gt; to contentsitem-value
currency &lt;g&gt;
no-sign no-grouping.
else.
write &lt;item&gt; to contentsitem-value
decimals 14 currency &lt;g&gt;
no-sign no-grouping.
endif.
* if field is quantity field
* exporting of quantity field base on quantity decimal table: T006
else.&quot;if l_def = &apos;Q&apos;. &quot; field is quantity field
clear: wa_t006.
select single * from t006 into wa_t006
where MSEHI = &lt;g&gt;.
* if quantity ref to un-know unit-&gt; default decimal = 2
if sy-subrc eq 0.
curritem-decimals = wa_t006-decan.
else.
curritem-decimals = 2.
endif.
append curritem to currcells.
write &lt;item&gt; to contentsitem-value
unit &lt;g&gt;
no-sign no-grouping.
condense contentsitem-value.
ENDIF.
endif. &quot;Y9CK007319
endif.
condense contentsitem-value.
* add function fieldcat-no zero display
loop at LT_FIELDCAT_KKBLO assigning &lt;f_fieldcat_line&gt;
where tabname = l_tabname
and tech ne &apos;X&apos;
and no_out ne &apos;X&apos;.
if &lt;f_fieldcat_line&gt;-col_pos = semaitem-col_no.
if &lt;f_fieldcat_line&gt;-no_zero = &apos;X&apos;.
if &lt;item&gt; = &apos;0&apos;.
clear: contentsitem-value.
endif.
* dun display zero in total/subtotal line too
else.
clear: wa_subtot_indexs.
read table lt_subtot_indexs into wa_subtot_indexs
with key index = l_save_index.
IF sy-subrc = 0.
if &lt;item&gt; = &apos;0&apos;.
clear: contentsitem-value.
endif.
ENDIF.
endif.
endif.
endloop.
unassign: &lt;f_fieldcat_line&gt;.
if &lt;item&gt; lt 0.
search contentsitem-value for &apos;E&apos;.
if sy-fdpos eq 0.
* bring negative sign to front of amount
translate contentsitem-value using &apos;- &apos;.
condense contentsitem-value no-gaps.
concatenate &apos;-&apos; contentsitem-value
into contentsitem-value.
else.
concatenate &apos;-&apos; contentsitem-value
into contentsitem-value.
endif.
endif.
set country space.
* Hier wird nur die korrekte Kommaseparatierung gemacht, wenn die
* Zeichen einer
* Zahl enthalten sind. Das ist f<>r Timestamps, die auch &quot;:&quot; enthalten.
* F<>r die
* darf keine Kommaseparierung stattfinden.
* Changing for correction request - Y6BK041073
if contentsitem-value co &apos;0123456789.,-+E &apos;.
translate contentsitem-value using comma_elim.
endif.
else.
clear contentsitem-value.
* if type is not numeric -&gt; dun display with zero
write &lt;item&gt; to contentsitem-value no-zero.
shift contentsitem-value left deleting leading space.
endif.
append contentsitem to contents.
endif.
enddo.
realmit = realmit + 1.
realoverflow = realoverflow + 1.
mit = mit + 1.
* overflow = current row index in content table
overflow = overflow + 1.
endloop.
unassign: &lt;f_fieldcat_line&gt;.
* set item range for set_range_data method
testname = mit / const.
condense testname.
concatenate &apos;TEST&apos; testname into testname.
realoverflow = realoverflow - 1.
realmit = realmit - 1.
help = realoverflow.
rangeitem-name = testname.
rangeitem-columns = datareal.
rangeitem-rows = help.
append rangeitem to ranges.
* insert item range dim
temp2 = rowmax + 1 + li_commentary_rows + realmit - realoverflow.
* items data
call method lo_spreadsheet-&gt;insert_range_dim
EXPORTING
name = testname
top = temp2
left = i_left
rows = help
columns = datareal
no_flush = no_flush.
* get columns header contents for set_range_data method
* export columns header only if no columns header option = space
data: rowcount type i.
data: columncount type i.
if i_columns_header = &apos;X&apos;.
* append columns header to contents: hkey
rowcount = 1.
do rowmax times.
columncount = 1.
do hkeycolumns times.
loop at lt_hkey into hkeyitem where col_no = columncount
and row_no = rowcount.
endloop.
if sy-subrc = 0.
str = hkeyitem-col_name.
contentsitem-value = hkeyitem-col_name.
else.
contentsitem-value = str.
endif.
contentsitem-column = columncount.
contentsitem-row = rowcount.
append contentsitem to contents.
columncount = columncount + 1.
enddo.
rowcount = rowcount + 1.
enddo.
* incase columns header in multiline
data: rowmaxtemp type i.
if rowmax &gt; 1.
rowmaxtemp = rowmax - 1.
rowcount = 1.
do rowmaxtemp times.
columncount = 1.
do columnmax times.
contentsitem-column = columncount.
contentsitem-row = rowcount.
contentsitem-value = &apos;&apos;.
append contentsitem to contents.
columncount = columncount + 1.
enddo.
rowcount = rowcount + 1.
enddo.
endif.
* append columns header to contents: vkey
columncount = 1.
do columnmax times.
loop at lt_vkey into vkeyitem where col_no = columncount.
endloop.
contentsitem-value = vkeyitem-col_name.
contentsitem-row = rowmax.
contentsitem-column = columncount.
append contentsitem to contents.
columncount = columncount + 1.
enddo.
*--------------------------------------------------------------------*
* set header range for method set_range_data
* insert header keys range dim
li_head_top = li_commentary_rows + 1.
li_col_pos = i_left.
* insert range headers
if hkeycolumns ne 0.
rangeitem-name = &apos;TESTHKEY&apos;.
rangeitem-rows = rowmax.
rangeitem-columns = hkeycolumns.
append rangeitem to ranges.
clear: rangeitem.
call method lo_spreadsheet-&gt;insert_range_dim
EXPORTING
name = &apos;TESTHKEY&apos;
top = li_head_top
left = li_col_pos
rows = rowmax
columns = hkeycolumns
no_flush = no_flush.
endif.
endif.
* format for columns header + total + subtotal
* ------------------------------------------
help = rowmax + realmit. &quot; table + header lines
data: item type colxxl_t.
data: lt_format type soi_format_table.
data: wa_format like line of lt_format.
data: wa_format_temp like line of lt_format.
field-symbols: &lt;f_source&gt; type any.
field-symbols: &lt;f_des&gt; type any.
* columns header format
wa_format-front = -1.
wa_format-back = 15. &quot;grey
wa_format-font = space.
wa_format-size = -1.
wa_format-bold = 1.
wa_format-align = 0.
wa_format-frametyp = -1.
wa_format-framecolor = -1.
* get column header format from input record
* -&gt; map input format
if i_columns_header = &apos;X&apos;.
wa_format-name = &apos;TESTHKEY&apos;.
if i_format_col_header is not initial.
describe field i_format_col_header type l_typ components
li_col_num.
do li_col_num times.
if sy-index ne 1. &quot; dun map range name
assign component sy-index of structure i_format_col_header
to &lt;f_source&gt;.
if &lt;f_source&gt; is not initial.
assign component sy-index of structure wa_format to &lt;f_des&gt;.
&lt;f_des&gt; = &lt;f_source&gt;.
unassign: &lt;f_des&gt;.
endif.
unassign: &lt;f_source&gt;.
endif.
enddo.
clear: li_col_num.
endif.
append wa_format to lt_format.
endif.
* Zusammenfassen der Spalten mit gleicher Nachkommastellenzahl
* collect vertical cells (col) with the same number of decimal places
* to increase perfomance in currency cell format
describe table currcells lines lines.
lines = lines - 1.
do lines times.
describe table currcells lines innerlines.
innerlines = innerlines - 1.
sort currcells by left top.
clear found.
do innerlines times.
read table currcells index sy-index into curritem.
counter = sy-index + 1.
read table currcells index counter into curritem2.
if curritem-left eq curritem2-left.
length = curritem-top + curritem-rows.
if length eq curritem2-top.
if curritem-decimals eq curritem2-decimals.
move curritem to curritem3.
curritem3-rows = curritem3-rows + curritem2-rows.
curritem-left = -1.
modify currcells index sy-index from curritem.
curritem2-left = -1.
modify currcells index counter from curritem2.
append curritem3 to currcells.
found = &apos;X&apos;.
endif.
endif.
endif.
enddo.
if found is initial.
exit.
endif.
delete currcells where left = -1.
enddo.
* Zusammenfassen der Zeilen mit gleicher Nachkommastellenzahl
* collect horizontal cells (row) with the same number of decimal places
* to increase perfomance in currency cell format
describe table currcells lines lines.
lines = lines - 1.
do lines times.
describe table currcells lines innerlines.
innerlines = innerlines - 1.
sort currcells by top left.
clear found.
do innerlines times.
read table currcells index sy-index into curritem.
counter = sy-index + 1.
read table currcells index counter into curritem2.
if curritem-top eq curritem2-top and curritem-rows eq
curritem2-rows.
length = curritem-left + curritem-columns.
if length eq curritem2-left.
if curritem-decimals eq curritem2-decimals.
move curritem to curritem3.
curritem3-columns = curritem3-columns + curritem2-columns.
curritem-left = -1.
modify currcells index sy-index from curritem.
curritem2-left = -1.
modify currcells index counter from curritem2.
append curritem3 to currcells.
found = &apos;X&apos;.
endif.
endif.
endif.
enddo.
if found is initial.
exit.
endif.
delete currcells where left = -1.
enddo.
* Ende der Zusammenfassung
* item data: format for currency cell, corresponding with currency
call method lo_spreadsheet-&gt;cell_format
EXPORTING
cells = currcells
no_flush = no_flush.
* item data: write item table content
call method lo_spreadsheet-&gt;set_ranges_data
EXPORTING
ranges = ranges
contents = contents
no_flush = no_flush.
* whole table range to format all table
if i_columns_header = &apos;X&apos;.
li_head_top = li_commentary_rows + 1.
else.
li_head_top = li_commentary_rows + 2.
help = help - 1.
endif.
call method lo_spreadsheet-&gt;insert_range_dim
EXPORTING
name = &apos;WHOLE_TABLE&apos;
top = li_head_top
left = i_left
rows = help
columns = datareal
no_flush = no_flush.
* columns width auto fix
* this parameter = space in case use with exist template
IF i_columns_autofit = &apos;X&apos;.
call method lo_spreadsheet-&gt;fit_widest
EXPORTING
name = &apos;WHOLE_TABLE&apos;
no_flush = no_flush.
ENDIF.
* frame
* The parameter has 8 bits
*0 Left margin
*1 Top marginT
*2 Bottom margin
*3 Right margin
*4 Horizontal line
*5 Vertical line
*6 Thinness
*7 Thickness
* here 127 = 1111111 6-5-4-3-2-1 mean Thin-ver-hor-right-bot-top-left
* ( final DOI method call, set no_flush = space
* equal to call method CL_GUI_CFW=&gt;FLUSH )
call method lo_spreadsheet-&gt;set_frame
EXPORTING
rangename = &apos;WHOLE_TABLE&apos;
typ = 127
color = 1
no_flush = space
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
* reformat subtotal / total line after format wholw table
loop at subranges into subrangeitem.
l_sub_index = subrangeitem-rows + li_commentary_rows + rowmax.
call method lo_spreadsheet-&gt;insert_range_dim
EXPORTING
name = subrangeitem-name
left = i_left
top = l_sub_index
rows = 1
columns = datareal
no_flush = no_flush.
wa_format-name = subrangeitem-name.
* default format:
* - clolor: subtotal = light yellow, subtotal = yellow
* - frame: box
IF subrangeitem-name(3) = &apos;SUB&apos;.
wa_format-back = 36. &quot;subtotal line
wa_format_temp = i_format_subtotal.
else.
wa_format-back = 27. &quot;total line
wa_format_temp = i_format_total.
endif.
wa_format-FRAMETYP = 79.
wa_format-FRAMEcolor = 1.
wa_format-number = -1.
wa_format-align = -1.
* get subtoal + total format from intput parameter
* overwrite default format
if wa_format_temp is not initial.
describe field wa_format_temp type l_typ components li_col_num.
do li_col_num times.
if sy-index ne 1. &quot; dun map range name
assign component sy-index of structure wa_format_temp
to &lt;f_source&gt;.
if &lt;f_source&gt; is not initial.
assign component sy-index of structure wa_format to &lt;f_des&gt;.
&lt;f_des&gt; = &lt;f_source&gt;.
unassign: &lt;f_des&gt;.
endif.
unassign: &lt;f_source&gt;.
endif.
enddo.
clear: li_col_num.
endif.
append wa_format to lt_format.
clear: wa_format-name.
clear: l_sub_index.
clear: wa_format_temp.
endloop.
if lt_format[] is not initial.
call method lo_spreadsheet-&gt;set_ranges_format
EXPORTING
formattable = lt_format
no_flush = no_flush.
refresh: lt_format.
endif.
*--------------------------------------------------------------------*
call method lo_spreadsheet-&gt;screen_update
EXPORTING
updating = &apos;X&apos;.
call method c_oi_errors=&gt;flush_errors.
lo_error_w = l_error.
lc_retcode = lo_error_w-&gt;error_code.
** catch no_flush -&gt; led to dump ( optional )
* go_error = l_error.
* gc_retcode = go_error-&gt;error_code.
* error_doi.
clear:
lt_sema,
wa_sema,
lt_hkey,
wa_hkey,
lt_vkey,
wa_vkey,
l_n_hrz_keys,
l_n_att_cols,
l_n_vrt_keys,
count,
datac,
datareal,
vkeycount,
all,
mit,
li_col_pos,
li_col_num,
ranges,
rangeitem,
contents,
contentsitem,
semaitem,
hkeyitem,
vkeyitem,
li_commentary_rows,
l_retcode,
li_head_top,
&lt;f_excel_tab&gt;.
clear:
lo_error_w.
unassign:
&lt;line&gt;,
&lt;item&gt;,
&lt;f_excel_tab&gt;.
*--------------------------------------------------------------------*
* SESSION 5: SAVE AND CLOSE FILE
*--------------------------------------------------------------------*
* ex of save path: &apos;FILE://C:\temp\test.xlsx&apos;
concatenate &apos;FILE://&apos; I_save_path
into ls_path.
call method lo_proxy-&gt;save_document_to_url
EXPORTING
no_flush = &apos;X&apos;
url = ls_path
IMPORTING
error = lo_error
retcode = lc_retcode
CHANGING
document_size = li_document_size.
error_doi.
* if save successfully -&gt; raise successful message
* message i499(sy) with &apos;Document is Exported to &apos; p_path.
message i499(sy) with &apos;Data has been exported successfully&apos;.
clear:
ls_path,
li_document_size.
close_document.
endmethod. &quot;BIND_ALV</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_TABLE" VERSION="1" LANGU="E" DESCRIPT="Set cell value from a table" EXPOSURE="2" STATE="1" EDITORDER="4 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_TABLE" SCONAME="IP_TABLE" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="STANDARD TABLE"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_TABLE" SCONAME="IT_FIELD_CATALOG" VERSION="1" LANGU="E" DESCRIPT="Table binding field catalog" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_T_FIELDCATALOG" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="BIND_TABLE" SCONAME="IS_TABLE_SETTINGS" VERSION="1" LANGU="E" DESCRIPT="Excel table binding settings" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_S_TABLE_SETTINGS" PAROPTIONL="X"/>
<source>method BIND_TABLE.
DATA:
lv_row_int TYPE zexcel_cell_row,
lv_first_row TYPE zexcel_cell_row,
lv_last_row TYPE zexcel_cell_row,
lv_column_int TYPE zexcel_cell_column,
lv_column_alpha TYPE zexcel_cell_column_alpha,
lt_field_catalog TYPE zexcel_t_fieldcatalog,
lv_id TYPE i,
lv_rows TYPE i,
lv_formula TYPE string,
ls_settings TYPE zexcel_s_table_settings,
lo_table TYPE REF TO zcl_excel_table,
lt_column_name_buffer TYPE SORTED TABLE OF string WITH UNIQUE KEY table_line,
lv_value TYPE string,
lv_syindex TYPE char3.
CONSTANTS:
lc_top_left_column TYPE zexcel_cell_column_alpha VALUE &apos;B&apos;,
lc_top_left_row TYPE zexcel_cell_row VALUE &apos;3&apos;.
FIELD-SYMBOLS: &lt;ls_field_catalog&gt; TYPE zexcel_s_fieldcatalog,
&lt;fs_table_line&gt; TYPE ANY,
&lt;fs_fldval&gt; TYPE ANY.
ls_settings = is_table_settings.
IF ls_settings-top_left_column IS INITIAL.
ls_settings-top_left_column = lc_top_left_column.
ENDIF.
IF ls_settings-table_style IS INITIAL.
ls_settings-table_style = zcl_excel_table=&gt;builtinstyle_medium2.
ENDIF.
IF ls_settings-top_left_row IS INITIAL.
ls_settings-top_left_row = lc_top_left_row.
ENDIF.
IF it_field_catalog IS NOT SUPPLIED.
lt_field_catalog = zcl_excel_common=&gt;get_fieldcatalog( ip_table = ip_table ).
ELSE.
lt_field_catalog = it_field_catalog.
ENDIF.
CREATE OBJECT lo_table.
lo_table-&gt;settings = ls_settings.
lo_table-&gt;set_data( ir_data = ip_table ).
lv_id = me-&gt;excel-&gt;get_next_table_id( ).
lo_table-&gt;set_id( iv_id = lv_id ).
* lo_table-&gt;fieldcat = lt_field_catalog[].
me-&gt;tables-&gt;add( lo_table ).
lv_column_int = zcl_excel_common=&gt;convert_column2int( ls_settings-top_left_column ).
lv_row_int = ls_settings-top_left_row.
&quot; get the row number
DESCRIBE TABLE ip_table LINES lv_rows.
* It is better to loop column by column (only visible column)
LOOP AT lt_field_catalog ASSIGNING &lt;ls_field_catalog&gt; WHERE dynpfld EQ abap_true.
lv_column_alpha = zcl_excel_common=&gt;convert_column2alpha( lv_column_int ).
&quot; Due restrinction of new table object we cannot have two column with the same name
&quot; Check if a column with the same name exists, if exists add a counter
lv_value = &lt;ls_field_catalog&gt;-scrtext_m.
WHILE 1 = 1.
READ TABLE lt_column_name_buffer TRANSPORTING NO FIELDS WITH KEY table_line = lv_value BINARY SEARCH.
IF sy-subrc &lt;&gt; 0.
&lt;ls_field_catalog&gt;-scrtext_m = lv_value.
INSERT lv_value INTO TABLE lt_column_name_buffer.
EXIT.
ELSE.
lv_syindex = sy-index.
CONCATENATE &lt;ls_field_catalog&gt;-scrtext_m lv_syindex INTO lv_value.
ENDIF.
ENDWHILE.
&quot; First of all write column header
me-&gt;set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = lv_value ).
ADD 1 TO lv_row_int.
LOOP AT ip_table ASSIGNING &lt;fs_table_line&gt;.
ASSIGN COMPONENT &lt;ls_field_catalog&gt;-fieldname OF STRUCTURE &lt;fs_table_line&gt; TO &lt;fs_fldval&gt;.
me-&gt;set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = &lt;fs_fldval&gt;
).
ADD 1 TO lv_row_int.
ENDLOOP.
&quot; totals
IF &lt;ls_field_catalog&gt;-totals_function IS NOT INITIAL.
lv_formula = lo_table-&gt;get_totals_formula( ip_column = &lt;ls_field_catalog&gt;-scrtext_m ip_function = &lt;ls_field_catalog&gt;-totals_function ).
me-&gt;set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = lv_formula ).
ENDIF.
lv_row_int = ls_settings-top_left_row.
ADD 1 TO lv_column_int.
&quot; conditional formatting
IF &lt;ls_field_catalog&gt;-cond_style IS NOT INITIAL.
lv_first_row = ls_settings-top_left_row + 1. &quot; +1 to exclude header
lv_last_row = ls_settings-top_left_row + lv_rows.
&lt;ls_field_catalog&gt;-cond_style-&gt;set_range( ip_start_column = lv_column_alpha
ip_start_row = lv_first_row
ip_stop_column = lv_column_alpha
ip_stop_row = lv_last_row ).
ENDIF.
ENDLOOP.
&quot; Set field catalog
lo_table-&gt;fieldcat = lt_field_catalog[].
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="CALCULATE_COLUMN_WIDTHS" VERSION="1" LANGU="E" DESCRIPT="Calculate widths for auto-size columns" EXPOSURE="2" STATE="1" EDITORDER="6 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<source>method CALCULATE_COLUMN_WIDTHS.
TYPES:
BEGIN OF t_auto_size,
col_index TYPE int4,
width TYPE float,
END OF t_auto_size.
TYPES: tt_auto_size TYPE TABLE OF t_auto_size.
DATA: column_dimensions TYPE zexcel_t_worksheet_columndime.
DATA: column_dimension TYPE REF TO zcl_excel_worksheet_columndime.
DATA: auto_size TYPE flag.
DATA: auto_sizes TYPE tt_auto_size.
DATA: col_alpha TYPE zexcel_cell_column_alpha.
DATA: cell_value TYPE zexcel_cell_value.
DATA: count TYPE int4.
DATA: highest_row TYPE int4.
DATA: width TYPE i.
FIELD-SYMBOLS: &lt;column_dimension&gt; LIKE LINE OF column_dimensions.
FIELD-SYMBOLS: &lt;auto_size&gt; LIKE LINE OF auto_sizes.
column_dimensions[] = me-&gt;get_column_dimensions( ).
LOOP AT column_dimensions ASSIGNING &lt;column_dimension&gt;.
auto_size = &lt;column_dimension&gt;-column_dimension-&gt;get_auto_size( ).
IF auto_size = abap_true.
APPEND INITIAL LINE TO auto_sizes ASSIGNING &lt;auto_size&gt;.
&lt;auto_size&gt;-col_index = &lt;column_dimension&gt;-column_dimension-&gt;get_column_index( ).
&lt;auto_size&gt;-width = -1.
ENDIF.
ENDLOOP.
&quot; There is only something to do if there are some auto-size columns
IF NOT auto_sizes IS INITIAL.
highest_row = me-&gt;get_highest_row( ).
LOOP AT auto_sizes ASSIGNING &lt;auto_size&gt;.
col_alpha = zcl_excel_common=&gt;convert_column2alpha( &lt;auto_size&gt;-col_index ).
count = 1.
WHILE count &lt;= highest_row.
me-&gt;get_cell(
EXPORTING
ip_column = col_alpha &quot; Cell Column
ip_row = count &quot; Cell Row
IMPORTING
ep_value = cell_value &quot; Cell Value
).
&quot; For an easy start we just take the number of characters as the width
&quot; TODO: Calculate width using Font Size and Font Type
width = STRLEN( cell_value ).
IF width &gt; &lt;auto_size&gt;-width.
&lt;auto_size&gt;-width = width.
ENDIF.
count = count + 1.
ENDWHILE.
column_dimension = me-&gt;get_column_dimension( col_alpha ).
column_dimension-&gt;set_width( &lt;auto_size&gt;-width ).
ENDLOOP.
ENDIF.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="CONSTRUCTOR" VERSION="1" LANGU="E" DESCRIPT="CONSTRUCTOR" EXPOSURE="2" STATE="1" EDITORDER="7 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="2" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="CONSTRUCTOR" SCONAME="IP_EXCEL" VERSION="1" LANGU="E" DESCRIPT="Ref to parent document" CMPTYPE="1" MTDTYPE="2" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="3" TYPE="ZCL_EXCEL"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="CONSTRUCTOR" SCONAME="IP_TITLE" VERSION="1" LANGU="E" DESCRIPT="Title" CMPTYPE="1" MTDTYPE="2" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_SHEET_TITLE" PAROPTIONL="X"/>
<source>method CONSTRUCTOR.
me-&gt;excel = ip_excel.
CALL FUNCTION &apos;GUID_CREATE&apos;
IMPORTING
ev_guid_16 = me-&gt;guid.
IF ip_title IS NOT INITIAL.
title = ip_title.
ELSE.
title = me-&gt;guid.
ENDIF.
sheet_state = me-&gt;c_sheet_state_visible.
CREATE OBJECT sheet_setup.
CREATE OBJECT conditional_styles.
CREATE OBJECT data_validations.
CREATE OBJECT tables.
CREATE OBJECT drawings.
me-&gt;zif_excel_sheet_protection~initialize( ).
CREATE OBJECT hyperlinks.
* initialize active cell coordinates
active_cell-cell_row = 1.
active_cell-cell_column = 1.
* inizialize dimension range
lower_cell-cell_row = 1.
lower_cell-cell_column = 1.
upper_cell-cell_row = 1.
upper_cell-cell_column = 1.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="DELETE_MERGE" VERSION="1" LANGU="E" DESCRIPT="Delete the used merges" EXPOSURE="2" STATE="1" EDITORDER="8 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<source>method DELETE_MERGE.
DELETE sheet_content_merge INDEX 1.
DELETE sheet_content_merge INDEX 1.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="FREEZE_PANES" VERSION="1" LANGU="E" DESCRIPT="Freeze panes for supplied number of rows and/or columns" EXPOSURE="2" STATE="1" EDITORDER="9 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" MTDNEWEXC="X" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="FREEZE_PANES" SCONAME="IP_NUM_COLUMNS" VERSION="1" LANGU="E" DESCRIPT="Number of columns to freeze (starting from left-most)" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="I" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="FREEZE_PANES" SCONAME="IP_NUM_ROWS" VERSION="1" LANGU="E" DESCRIPT="Number of rows to freeze (starting from top-most)" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="I" PAROPTIONL="X"/>
<exception CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="FREEZE_PANES" SCONAME="ZCX_EXCEL" VERSION="1" LANGU="E" DESCRIPT="Exceptions for ABAP2XLSX" MTDTYPE="0" EDITORDER="1 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000"/>
<source>method FREEZE_PANES.
data: lv_xsplit type i,
lv_ysplit type i.
IF ip_num_columns IS NOT SUPPLIED AND ip_num_rows IS NOT SUPPLIED.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = &apos;Pleas provide number of rows and/or columns to freeze&apos;.
ENDIF.
IF ip_num_columns IS SUPPLIED AND ip_num_columns &lt;= 0.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = &apos;Number of columns to freeze should be positive&apos;.
ENDIF.
IF ip_num_rows IS SUPPLIED AND ip_num_rows &lt;= 0.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = &apos;Number of rows to freeze should be positive&apos;.
ENDIF.
freeze_pane_cell_column = ip_num_columns + 1.
freeze_pane_cell_row = ip_num_rows + 1.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_ACTIVE_CELL" VERSION="1" LANGU="E" DESCRIPT="Get used range dimension" EXPOSURE="2" STATE="1" EDITORDER="10 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_ACTIVE_CELL" SCONAME="EP_ACTIVE_CELL" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="STRING"/>
<source>method GET_ACTIVE_CELL.
DATA: lv_active_column TYPE zexcel_cell_column_alpha,
lv_active_row TYPE string.
lv_active_column = zcl_excel_common=&gt;convert_column2alpha( active_cell-cell_column ).
lv_active_row = active_cell-cell_row.
SHIFT lv_active_row RIGHT DELETING TRAILING space.
SHIFT lv_active_row LEFT DELETING LEADING space.
CONCATENATE lv_active_column lv_active_row INTO ep_active_cell.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_CELL" VERSION="1" LANGU="E" DESCRIPT="Get cell value" EXPOSURE="2" STATE="1" EDITORDER="11 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_CELL" SCONAME="IP_COLUMN" VERSION="1" LANGU="E" DESCRIPT="Cell Column" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_COLUMN_ALPHA"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_CELL" SCONAME="IP_ROW" VERSION="1" LANGU="E" DESCRIPT="Cell Row" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_ROW"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_CELL" SCONAME="EP_VALUE" VERSION="1" LANGU="E" DESCRIPT="Cell Value" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="1" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_VALUE"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_CELL" SCONAME="EP_RC" VERSION="1" LANGU="E" DESCRIPT="Return Value of ABAP Statements" CMPTYPE="1" MTDTYPE="0" EDITORDER="4 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="1" PARPASSTYP="1" TYPTYPE="1" TYPE="SYSUBRC"/>
<source>method GET_CELL.
DATA: lv_column TYPE zexcel_cell_column,
ls_sheet_content TYPE zexcel_s_cell_data.
FIELD-SYMBOLS: &lt;fs_sheet_content&gt; TYPE zexcel_s_cell_data.
lv_column = zcl_excel_common=&gt;convert_column2int( ip_column ).
READ TABLE sheet_content INTO ls_sheet_content WITH TABLE KEY cell_row = ip_row
cell_column = lv_column.
ep_rc = sy-subrc.
ep_value = ls_sheet_content-cell_value.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_COLUMN_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Get column dimension at a specific column" EXPOSURE="2" STATE="1" EDITORDER="12 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_COLUMN_DIMENSION" SCONAME="IP_COLUMN" VERSION="1" LANGU="E" DESCRIPT="Cell Column" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_COLUMN_ALPHA"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_COLUMN_DIMENSION" SCONAME="R_COLUMN_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Worksheet ColumnDimension" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="ZCL_EXCEL_WORKSHEET_COLUMNDIME"/>
<source>method GET_COLUMN_DIMENSION.
FIELD-SYMBOLS: &lt;fs_column_dimension&gt; LIKE LINE OF column_dimensions.
READ TABLE me-&gt;column_dimensions ASSIGNING &lt;fs_column_dimension&gt;
WITH KEY column = ip_column.
IF NOT &lt;fs_column_dimension&gt; IS ASSIGNED.
CREATE OBJECT r_column_dimension
EXPORTING
ip_index = ip_column.
APPEND INITIAL LINE TO me-&gt;column_dimensions ASSIGNING &lt;fs_column_dimension&gt;.
&lt;fs_column_dimension&gt;-column = ip_column.
&lt;fs_column_dimension&gt;-column_dimension = r_column_dimension.
ELSE.
r_column_dimension = &lt;fs_column_dimension&gt;-column_dimension.
ENDIF.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_COLUMN_DIMENSIONS" VERSION="1" LANGU="E" DESCRIPT="Get column dimensions" EXPOSURE="2" STATE="1" EDITORDER="13 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_COLUMN_DIMENSIONS" SCONAME="R_COLUMN_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Collection of column dimensions" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="ZEXCEL_T_WORKSHEET_COLUMNDIME"/>
<source>method GET_COLUMN_DIMENSIONS.
r_column_dimension[] = me-&gt;column_dimensions[].
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_COND_STYLES_ITERATOR" VERSION="1" LANGU="E" DESCRIPT="Get conditional styles iterator" EXPOSURE="2" STATE="1" EDITORDER="14 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_COND_STYLES_ITERATOR" SCONAME="EO_ITERATOR" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="CL_OBJECT_COLLECTION_ITERATOR"/>
<source>method GET_COND_STYLES_ITERATOR.
eo_iterator = me-&gt;conditional_styles-&gt;get_iterator( ).
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DATA_VALIDATIONS_ITERATOR" VERSION="1" LANGU="E" DESCRIPT="Get conditional styles iterator" EXPOSURE="2" STATE="1" EDITORDER="15 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DATA_VALIDATIONS_ITERATOR" SCONAME="EO_ITERATOR" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="CL_OBJECT_COLLECTION_ITERATOR"/>
<source>method GET_DATA_VALIDATIONS_ITERATOR.
eo_iterator = me-&gt;data_validations-&gt;get_iterator( ).
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DATA_VALIDATIONS_SIZE" VERSION="1" LANGU="E" DESCRIPT="Get the number of data validation objects" EXPOSURE="2" STATE="1" EDITORDER="16 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DATA_VALIDATIONS_SIZE" SCONAME="EP_SIZE" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="I"/>
<source>method GET_DATA_VALIDATIONS_SIZE.
ep_size = me-&gt;data_validations-&gt;size( ).
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DEFAULT_COLUMN_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Get column dimension at a specific column" EXPOSURE="2" STATE="1" EDITORDER="17 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DEFAULT_COLUMN_DIMENSION" SCONAME="R_COLUMN_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Worksheet ColumnDimension" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="ZCL_EXCEL_WORKSHEET_COLUMNDIME"/>
<source>method GET_DEFAULT_COLUMN_DIMENSION.
r_column_dimension = me-&gt;default_column_dimension.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DEFAULT_ROW_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Get column dimension at a specific column" EXPOSURE="2" STATE="1" EDITORDER="18 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DEFAULT_ROW_DIMENSION" SCONAME="R_ROW_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Worksheet ColumnDimension" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="ZCL_EXCEL_WORKSHEET_ROWDIMENSI"/>
<source>method GET_DEFAULT_ROW_DIMENSION.
r_row_dimension = me-&gt;default_row_dimension.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DIMENSION_RANGE" VERSION="1" LANGU="E" DESCRIPT="Get used range dimension" EXPOSURE="2" STATE="1" EDITORDER="19 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DIMENSION_RANGE" SCONAME="EP_DIMENSION_RANGE" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="STRING"/>
<source>method GET_DIMENSION_RANGE.
me-&gt;update_dimension_range( ).
IF upper_cell EQ lower_cell. &quot;only one cell
ep_dimension_range = upper_cell-cell_coords.
ELSE.
CONCATENATE upper_cell-cell_coords &apos;:&apos; lower_cell-cell_coords INTO ep_dimension_range.
ENDIF.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DRAWINGS" VERSION="1" LANGU="E" DESCRIPT="Gets drawing attached to the sheet" EXPOSURE="2" STATE="1" EDITORDER="20 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DRAWINGS" SCONAME="R_DRAWINGS" VERSION="1" LANGU="E" DESCRIPT="Drawings collection" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="ZCL_EXCEL_DRAWINGS"/>
<source>method GET_DRAWINGS.
r_drawings = drawings.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DRAWINGS_ITERATOR" VERSION="1" LANGU="E" DESCRIPT="Get iterator for drawings collection" EXPOSURE="2" STATE="1" EDITORDER="21 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_DRAWINGS_ITERATOR" SCONAME="EO_ITERATOR" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="CL_OBJECT_COLLECTION_ITERATOR"/>
<source>method GET_DRAWINGS_ITERATOR.
eo_iterator = drawings-&gt;get_iterator( ).
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_FREEZE_CELL" VERSION="1" LANGU="E" DESCRIPT="Gets the coordinates of cell determining freeze panes" EXPOSURE="2" STATE="1" EDITORDER="22 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_FREEZE_CELL" SCONAME="EP_ROW" VERSION="1" LANGU="E" DESCRIPT="Cell Row" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" PARDECLTYP="1" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_ROW"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_FREEZE_CELL" SCONAME="EP_COLUMN" VERSION="1" LANGU="E" DESCRIPT="Cell Column" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" PARDECLTYP="1" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_COLUMN"/>
<source>method GET_FREEZE_CELL.
ep_row = me-&gt;freeze_pane_cell_row.
ep_column = me-&gt;freeze_pane_cell_column.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_GUID" VERSION="1" LANGU="E" DESCRIPT="Get sheet guid" EXPOSURE="2" STATE="1" EDITORDER="23 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_GUID" SCONAME="EP_GUID" VERSION="1" LANGU="E" DESCRIPT="GUID in &apos;RAW&apos; format" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="OLTPGUID16"/>
<source>method GET_GUID.
ep_guid = me-&gt;guid.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_HIGHEST_COLUMN" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="24 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_HIGHEST_COLUMN" SCONAME="R_HIGHEST_COLUMN" VERSION="1" LANGU="E" DESCRIPT="Cell Column" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="ZEXCEL_CELL_COLUMN"/>
<source>method GET_HIGHEST_COLUMN.
me-&gt;update_dimension_range( ).
r_highest_column = me-&gt;lower_cell-cell_column.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_HIGHEST_ROW" VERSION="1" LANGU="E" EXPOSURE="2" STATE="1" EDITORDER="25 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_HIGHEST_ROW" SCONAME="R_HIGHEST_ROW" VERSION="1" LANGU="E" DESCRIPT="Natural number" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="INT4"/>
<source>method GET_HIGHEST_ROW.
me-&gt;update_dimension_range( ).
r_highest_row = me-&gt;lower_cell-cell_row.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_HYPERLINKS_ITERATOR" VERSION="1" LANGU="E" DESCRIPT="Get iterator for links collection" EXPOSURE="2" STATE="1" EDITORDER="26 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_HYPERLINKS_ITERATOR" SCONAME="EO_ITERATOR" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="CL_OBJECT_COLLECTION_ITERATOR"/>
<source>method GET_HYPERLINKS_ITERATOR.
eo_iterator = hyperlinks-&gt;get_iterator( ).
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_HYPERLINKS_SIZE" VERSION="1" LANGU="E" DESCRIPT="Gets the size of links collection" EXPOSURE="2" STATE="1" EDITORDER="27 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_HYPERLINKS_SIZE" SCONAME="EP_SIZE" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="I"/>
<source>method GET_HYPERLINKS_SIZE.
ep_size = hyperlinks-&gt;size( ).
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_MERGE" VERSION="1" LANGU="E" DESCRIPT="Get the merge range" EXPOSURE="2" STATE="1" EDITORDER="28 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_MERGE" SCONAME="MERGE_RANGE" VERSION="1" LANGU="E" DESCRIPT="Table of Strings" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="STRING_TABLE"/>
<source>method GET_MERGE.
DATA: lv_column_start TYPE string,
lv_column_end TYPE string,
lv_row TYPE string,
lv_index TYPE sy-tabix,
ls_sheet_content TYPE zexcel_s_cell_data,
range_from TYPE string,
range_to TYPE string,
lv_merge_range TYPE string,
lv_count TYPE string.
FIELD-SYMBOLS: &lt;fs_sheet_content&gt; TYPE zexcel_s_cell_data.
DESCRIBE TABLE sheet_content_merge LINES lv_count.
WHILE lv_count GT lv_index.
* LOOP AT sheet_content_merge ASSIGNING &lt;fs_sheet_content&gt;.
lv_index = lv_index + 1.
READ TABLE sheet_content_merge ASSIGNING &lt;fs_sheet_content&gt; INDEX lv_index.
lv_column_start = zcl_excel_common=&gt;convert_column2alpha( &lt;fs_sheet_content&gt;-cell_column ).
lv_row = &lt;fs_sheet_content&gt;-cell_row.
SHIFT lv_column_start RIGHT DELETING TRAILING space.
SHIFT lv_column_start LEFT DELETING LEADING space.
SHIFT lv_row RIGHT DELETING TRAILING space.
SHIFT lv_row LEFT DELETING LEADING space.
CONCATENATE lv_column_start lv_row
INTO range_from.
lv_index = lv_index + 1.
READ TABLE sheet_content_merge ASSIGNING &lt;fs_sheet_content&gt; INDEX lv_index.
lv_column_end = zcl_excel_common=&gt;convert_column2alpha( &lt;fs_sheet_content&gt;-cell_column ).
SHIFT lv_column_end RIGHT DELETING TRAILING space.
SHIFT lv_column_end LEFT DELETING LEADING space.
CONCATENATE lv_column_end lv_row
INTO range_to.
CONCATENATE range_from range_to INTO lv_merge_range
SEPARATED BY &apos;:&apos;.
APPEND lv_merge_range TO merge_range.
ENDWHILE.
* ENDLOOP.
* READ TABLE sheet_content_merge ASSIGNING &lt;fs_sheet_content&gt; INDEX 1.
* IF sy-subrc EQ 0 AND &lt;fs_sheet_content&gt; IS ASSIGNED.
* lv_column_start = zcl_excel_common=&gt;convert_column2alpha( &lt;fs_sheet_content&gt;-cell_column ).
* lv_row = &lt;fs_sheet_content&gt;-cell_row.
* SHIFT lv_column_start RIGHT DELETING TRAILING space.
* SHIFT lv_column_start LEFT DELETING LEADING space.
* SHIFT lv_row RIGHT DELETING TRAILING space.
* SHIFT lv_row LEFT DELETING LEADING space.
* CONCATENATE lv_column_start lv_row
* INTO range_from.
* ENDIF.
* READ TABLE sheet_content_merge ASSIGNING &lt;fs_sheet_content&gt; INDEX 2.
* IF sy-subrc EQ 0 AND &lt;fs_sheet_content&gt; IS ASSIGNED.
* lv_column_end = zcl_excel_common=&gt;convert_column2alpha( &lt;fs_sheet_content&gt;-cell_column ).
* SHIFT lv_column_end RIGHT DELETING TRAILING space.
* SHIFT lv_column_end LEFT DELETING LEADING space.
* CONCATENATE lv_column_end lv_row
* INTO range_to.
* ENDIF.
* IF range_from NE space AND range_to NE space.
* CONCATENATE range_from range_to INTO ep_merge_range
* SEPARATED BY &apos;:&apos;.
* ENDIF.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_ROW_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Get column dimension at a specific column" EXPOSURE="2" STATE="1" EDITORDER="29 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_ROW_DIMENSION" SCONAME="IP_ROW" VERSION="1" LANGU="E" DESCRIPT="Cell Column" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="INT4"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_ROW_DIMENSION" SCONAME="R_ROW_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Worksheet ColumnDimension" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="ZCL_EXCEL_WORKSHEET_ROWDIMENSI"/>
<source>method GET_ROW_DIMENSION.
FIELD-SYMBOLS: &lt;fs_row_dimension&gt; LIKE LINE OF row_dimensions.
READ TABLE me-&gt;row_dimensions ASSIGNING &lt;fs_row_dimension&gt;
WITH KEY row = ip_row.
IF NOT &lt;fs_row_dimension&gt; IS ASSIGNED.
CREATE OBJECT r_row_dimension
EXPORTING
ip_index = ip_row.
APPEND INITIAL LINE TO me-&gt;row_dimensions ASSIGNING &lt;fs_row_dimension&gt;.
&lt;fs_row_dimension&gt;-row = ip_row.
&lt;fs_row_dimension&gt;-row_dimension = r_row_dimension.
ELSE.
r_row_dimension = &lt;fs_row_dimension&gt;-row_dimension.
ENDIF.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_ROW_DIMENSIONS" VERSION="1" LANGU="E" DESCRIPT="Get column dimensions" EXPOSURE="2" STATE="1" EDITORDER="30 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_ROW_DIMENSIONS" SCONAME="R_ROW_DIMENSION" VERSION="1" LANGU="E" DESCRIPT="Collection of column dimensions" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="ZEXCEL_T_WORKSHEET_ROWDIMENSIO"/>
<source>method GET_ROW_DIMENSIONS.
r_row_dimension[] = me-&gt;row_dimensions[].
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_TABLES_ITERATOR" VERSION="1" LANGU="E" DESCRIPT="Get iterator for tables collection" EXPOSURE="2" STATE="1" EDITORDER="31 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_TABLES_ITERATOR" SCONAME="EO_ITERATOR" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="CL_OBJECT_COLLECTION_ITERATOR"/>
<source>method GET_TABLES_ITERATOR.
eo_iterator = tables-&gt;if_object_collection~get_iterator( ).
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_TABLES_SIZE" VERSION="1" LANGU="E" DESCRIPT="Gets the size of tables collection" EXPOSURE="2" STATE="1" EDITORDER="32 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="GET_TABLES_SIZE" SCONAME="EP_SIZE" VERSION="1" LANGU="E" DESCRIPT="Size" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="I"/>
<source>method GET_TABLES_SIZE.
ep_size = tables-&gt;if_object_collection~size( ).
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL" VERSION="1" LANGU="E" DESCRIPT="Set cell value" EXPOSURE="2" STATE="1" EDITORDER="33 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL" SCONAME="IP_COLUMN" VERSION="1" LANGU="E" DESCRIPT="Cell Column" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_COLUMN_ALPHA"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL" SCONAME="IP_ROW" VERSION="1" LANGU="E" DESCRIPT="Cell Row" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_ROW"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL" SCONAME="IP_VALUE" VERSION="1" LANGU="E" DESCRIPT="Cell Value" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="SIMPLE" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL" SCONAME="IP_FORMULA" VERSION="1" LANGU="E" DESCRIPT="Cell Formula" CMPTYPE="1" MTDTYPE="0" EDITORDER="4 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_FORMULA" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL" SCONAME="IP_STYLE" VERSION="1" LANGU="E" DESCRIPT="Single-Character Indicator" CMPTYPE="1" MTDTYPE="0" EDITORDER="5 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_STYLE" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL" SCONAME="IP_HYPERLINK" VERSION="1" LANGU="E" DESCRIPT="Hyperlink" CMPTYPE="1" MTDTYPE="0" EDITORDER="6 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101115" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="3" TYPE="ZCL_EXCEL_HYPERLINK" PAROPTIONL="X"/>
<source>method SET_CELL.
DATA: lv_column TYPE zexcel_cell_column,
ls_sheet_content TYPE zexcel_s_cell_data,
lv_row_alpha TYPE string,
lv_value TYPE zexcel_cell_value,
lv_data_type TYPE zexcel_cell_data_type,
lv_value_type TYPE abap_typekind,
lo_style TYPE REF TO zcl_excel_style,
lv_style_guid TYPE zexcel_cell_style.
FIELD-SYMBOLS: &lt;fs_sheet_content&gt; TYPE zexcel_s_cell_data.
IF ip_value IS NOT SUPPLIED AND ip_formula IS NOT SUPPLIED.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = &apos;Pleas provide the vaue or formula&apos;.
ENDIF.
lv_style_guid = ip_style.
IF ip_value IS SUPPLIED.
DESCRIBE FIELD ip_value TYPE lv_value_type.
CASE lv_value_type.
WHEN cl_abap_typedescr=&gt;typekind_int OR cl_abap_typedescr=&gt;typekind_int1 OR cl_abap_typedescr=&gt;typekind_int2 OR
cl_abap_typedescr=&gt;typekind_float OR cl_abap_typedescr=&gt;typekind_packed.
lv_value = zcl_excel_common=&gt;number_to_excel_string( ip_value = ip_value ).
WHEN cl_abap_typedescr=&gt;typekind_char OR cl_abap_typedescr=&gt;typekind_string OR cl_abap_typedescr=&gt;typekind_num.
lv_value = ip_value.
lv_data_type = &apos;s&apos;.
WHEN cl_abap_typedescr=&gt;typekind_date.
lv_value = zcl_excel_common=&gt;date_to_excel_string( ip_value = ip_value ).
IF ip_style IS NOT SUPPLIED. &quot;get default date format for user in case parameter is initial
lo_style = excel-&gt;add_new_style( ).
* cl_abap_datfm=&gt;get_date_format_des( IMPORTING ex_dateformat = lo_style-&gt;number_format-&gt;format_code ). &quot;IF Issue #35 -
lo_style-&gt;number_format-&gt;format_code = zcl_excel_style_number_format=&gt;c_format_date_ddmmyyyydot. &quot;IF Issue #35 +
lv_style_guid = lo_style-&gt;get_guid( ).
ENDIF.
WHEN cl_abap_typedescr=&gt;typekind_time.
lv_value = zcl_excel_common=&gt;time_to_excel_string( ip_value = ip_value ).
IF ip_style IS NOT SUPPLIED. &quot;get default time format for user in case parameter is initial
lo_style = excel-&gt;add_new_style( ).
lo_style-&gt;number_format-&gt;format_code = zcl_excel_style_number_format=&gt;c_format_date_time6.
lv_style_guid = lo_style-&gt;get_guid( ).
ENDIF.
WHEN OTHERS.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = &apos;Invalid data type of input value&apos;.
ENDCASE.
ENDIF.
IF ip_hyperlink IS BOUND.
ip_hyperlink-&gt;set_cell_reference( ip_column = ip_column
ip_row = ip_row ).
me-&gt;hyperlinks-&gt;add( ip_hyperlink ).
ENDIF.
lv_column = zcl_excel_common=&gt;convert_column2int( ip_column ).
READ TABLE sheet_content ASSIGNING &lt;fs_sheet_content&gt; WITH KEY cell_row = ip_row
cell_column = lv_column.
IF sy-subrc EQ 0.
&lt;fs_sheet_content&gt;-cell_value = lv_value.
&lt;fs_sheet_content&gt;-cell_formula = ip_formula.
&lt;fs_sheet_content&gt;-cell_style = lv_style_guid.
&lt;fs_sheet_content&gt;-data_type = lv_data_type.
ELSE.
ls_sheet_content-cell_row = ip_row.
ls_sheet_content-cell_column = lv_column.
ls_sheet_content-cell_value = lv_value.
ls_sheet_content-cell_formula = ip_formula.
ls_sheet_content-cell_style = lv_style_guid.
ls_sheet_content-data_type = lv_data_type.
lv_row_alpha = ip_row.
SHIFT lv_row_alpha RIGHT DELETING TRAILING space.
SHIFT lv_row_alpha LEFT DELETING LEADING space.
CONCATENATE ip_column lv_row_alpha INTO ls_sheet_content-cell_coords.
APPEND ls_sheet_content TO sheet_content.
SORT sheet_content BY cell_row cell_column.
&quot; me-&gt;update_dimension_range( ).
ENDIF.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL_STYLE" VERSION="1" LANGU="E" DESCRIPT="Set cell style" EXPOSURE="2" STATE="1" EDITORDER="34 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" MTDNEWEXC="X" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL_STYLE" SCONAME="IP_COLUMN" VERSION="1" LANGU="E" DESCRIPT="Cell Column" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_COLUMN_ALPHA"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL_STYLE" SCONAME="IP_ROW" VERSION="1" LANGU="E" DESCRIPT="Cell Row" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_ROW"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL_STYLE" SCONAME="IP_STYLE" VERSION="1" LANGU="E" DESCRIPT="Single-Character Indicator" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_STYLE"/>
<exception CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_CELL_STYLE" SCONAME="ZCX_EXCEL" VERSION="1" LANGU="E" DESCRIPT="Exceptions for ABAP2XLSX" MTDTYPE="0" EDITORDER="1 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115"/>
<source>method SET_CELL_STYLE.
DATA: lv_column TYPE zexcel_cell_column,
ls_sheet_content TYPE zexcel_s_cell_data,
lv_row_alpha TYPE string,
lo_style TYPE REF TO zcl_excel_style,
lv_style_guid TYPE zexcel_cell_style.
FIELD-SYMBOLS: &lt;fs_sheet_content&gt; TYPE zexcel_s_cell_data.
lv_style_guid = ip_style.
lv_column = zcl_excel_common=&gt;convert_column2int( ip_column ).
READ TABLE sheet_content ASSIGNING &lt;fs_sheet_content&gt; WITH KEY cell_row = ip_row
cell_column = lv_column.
IF sy-subrc EQ 0.
&lt;fs_sheet_content&gt;-cell_style = lv_style_guid.
ELSE.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = &apos;No Data in this cell&apos;.
ENDIF.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_MERGE" VERSION="1" LANGU="E" DESCRIPT="Set the merge range" EXPOSURE="2" STATE="1" EDITORDER="35 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_MERGE" SCONAME="IP_COLUMN_START" VERSION="1" LANGU="E" DESCRIPT="Cell Column Start" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_COLUMN_ALPHA" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_MERGE" SCONAME="IP_COLUMN_END" VERSION="1" LANGU="E" DESCRIPT="Cell Column End" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_COLUMN_ALPHA" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_MERGE" SCONAME="IP_ROW" VERSION="1" LANGU="E" DESCRIPT="Cell Row" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_ROW" PAROPTIONL="X"/>
<source>method SET_MERGE.
DATA: lv_column_start TYPE zexcel_cell_column,
lv_column_end TYPE zexcel_cell_column,
ls_sheet_content TYPE zexcel_s_cell_data,
lv_row_alpha TYPE string.
FIELD-SYMBOLS: &lt;fs_sheet_content&gt; TYPE zexcel_s_cell_data.
lv_column_start = zcl_excel_common=&gt;convert_column2int( ip_column_start ).
lv_column_end = zcl_excel_common=&gt;convert_column2int( ip_column_end ).
ls_sheet_content-cell_row = ip_row.
ls_sheet_content-cell_column = lv_column_start.
lv_row_alpha = ip_row.
SHIFT lv_row_alpha RIGHT DELETING TRAILING space.
SHIFT lv_row_alpha LEFT DELETING LEADING space.
CONCATENATE ip_column_start lv_row_alpha INTO ls_sheet_content-cell_coords.
APPEND ls_sheet_content TO sheet_content_merge.
ls_sheet_content-cell_row = ip_row.
ls_sheet_content-cell_column = lv_column_end.
lv_row_alpha = ip_row.
SHIFT lv_row_alpha RIGHT DELETING TRAILING space.
SHIFT lv_row_alpha LEFT DELETING LEADING space.
CONCATENATE ip_column_end lv_row_alpha INTO ls_sheet_content-cell_coords.
APPEND ls_sheet_content TO sheet_content_merge.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_TABLE" VERSION="1" LANGU="E" DESCRIPT="Set cell value from a table" EXPOSURE="2" STATE="1" EDITORDER="36 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_TABLE" SCONAME="IP_TABLE" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="STANDARD TABLE"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_TABLE" SCONAME="IP_HDR_STYLE" VERSION="1" LANGU="E" DESCRIPT="Style identifier" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_STYLE" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_TABLE" SCONAME="IP_BODY_STYLE" VERSION="1" LANGU="E" DESCRIPT="Style identifier" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_STYLE" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_TABLE" SCONAME="IP_TABLE_TITLE" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="4 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="STRING"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_TABLE" SCONAME="IP_TOP_LEFT_COLUMN" VERSION="1" LANGU="E" DESCRIPT="Cell Column" CMPTYPE="1" MTDTYPE="0" EDITORDER="5 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_COLUMN_ALPHA" PARVALUE="&apos;B&apos;" PAROPTIONL="X"/>
<parameter CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="SET_TABLE" SCONAME="IP_TOP_LEFT_ROW" VERSION="1" LANGU="E" DESCRIPT="Cell Row" CMPTYPE="1" MTDTYPE="0" EDITORDER="6 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="ZEXCEL_CELL_ROW" PARVALUE="3" PAROPTIONL="X"/>
<source>method SET_TABLE.
DATA: lo_tabdescr TYPE REF TO cl_abap_structdescr,
lr_data TYPE REF TO data,
ls_newline TYPE REF TO data,
ls_header TYPE x030l,
lt_dfies TYPE ddfields,
lv_row_header TYPE zexcel_cell_row VALUE &apos;2&apos;,
lv_col_header TYPE zexcel_cell_column_alpha VALUE &apos;B&apos;,
lv_row_int TYPE zexcel_cell_row,
lv_column_int TYPE zexcel_cell_column,
lv_column_alpha TYPE zexcel_cell_column_alpha,
lv_cell_value TYPE zexcel_cell_value.
FIELD-SYMBOLS: &lt;fs_table_line&gt; TYPE ANY,
&lt;fs_fldval&gt; TYPE ANY,
&lt;fs_dfies&gt; TYPE dfies,
&lt;fs_cell_value&gt; TYPE zexcel_cell_value.
lv_column_int = zcl_excel_common=&gt;convert_column2int( ip_top_left_column ).
lv_row_int = ip_top_left_row.
CREATE DATA lr_data LIKE LINE OF ip_table.
lo_tabdescr ?= cl_abap_structdescr=&gt;describe_by_data_ref( lr_data ).
ls_header = lo_tabdescr-&gt;get_ddic_header( ).
lt_dfies = lo_tabdescr-&gt;get_ddic_field_list( ).
* It is better to loop column by column
LOOP AT lt_dfies ASSIGNING &lt;fs_dfies&gt;.
lv_column_alpha = zcl_excel_common=&gt;convert_column2alpha( lv_column_int ).
&quot; First of all write column header
lv_cell_value = &lt;fs_dfies&gt;-scrtext_m.
me-&gt;set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = lv_cell_value
ip_style = ip_hdr_style ).
ADD 1 TO lv_row_int.
LOOP AT ip_table ASSIGNING &lt;fs_table_line&gt;.
ASSIGN COMPONENT &lt;fs_dfies&gt;-fieldname OF STRUCTURE &lt;fs_table_line&gt; TO &lt;fs_fldval&gt;.
MOVE &lt;fs_fldval&gt; TO lv_cell_value.
me-&gt;set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = lv_cell_value
ip_style = ip_body_style ).
ADD 1 TO lv_row_int.
ENDLOOP.
lv_row_int = ip_top_left_row.
ADD 1 TO lv_column_int.
ENDLOOP.
endmethod.</source>
</method>
<method CLSNAME="ZCL_EXCEL_WORKSHEET" CMPNAME="UPDATE_DIMENSION_RANGE" VERSION="1" LANGU="E" DESCRIPT="Update dimension range" EXPOSURE="0" STATE="1" EDITORDER="37 " DISPID="0 " AUTHOR="HUNGHM" CREATEDON="20101112" CHANGEDBY="HUNGHM" CHANGEDON="20101115" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<source>method UPDATE_DIMENSION_RANGE.
DATA: ls_sheet_content TYPE zexcel_s_cell_data,
lt_sheet_content TYPE zexcel_t_cell_data_unsorted,
lv_row_alpha TYPE string,
lv_column_alpha TYPE zexcel_cell_column_alpha.
* update dimension range
lt_sheet_content = sheet_content.
&quot;upper left corner
SORT lt_sheet_content BY cell_row.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
upper_cell-cell_row = ls_sheet_content-cell_row.
SORT lt_sheet_content BY cell_column.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
upper_cell-cell_column = ls_sheet_content-cell_column.
lv_row_alpha = upper_cell-cell_row.
lv_column_alpha = zcl_excel_common=&gt;convert_column2alpha( upper_cell-cell_column ).
SHIFT lv_row_alpha RIGHT DELETING TRAILING space.
SHIFT lv_row_alpha LEFT DELETING LEADING space.
CONCATENATE lv_column_alpha lv_row_alpha INTO upper_cell-cell_coords.
&quot;bottom right corner
SORT lt_sheet_content BY cell_row DESCENDING.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
lower_cell-cell_row = ls_sheet_content-cell_row.
SORT lt_sheet_content BY cell_column DESCENDING.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
lower_cell-cell_column = ls_sheet_content-cell_column.
lv_row_alpha = lower_cell-cell_row.
lv_column_alpha = zcl_excel_common=&gt;convert_column2alpha( lower_cell-cell_column ).
SHIFT lv_row_alpha RIGHT DELETING TRAILING space.
SHIFT lv_row_alpha LEFT DELETING LEADING space.
CONCATENATE lv_column_alpha lv_row_alpha INTO lower_cell-cell_coords.
endmethod.</source>
</method>
</CLAS>