This class provides document management for sheet of Excel File.
Method:
- GET_SHEETS Get the names of all worksheets in Excel File
DATA: IT_SHEETS TYPE SOI_SHEETS_TABLE.
CALL METHOD IREF_SPREADSHEET->GET_SHEETS
EXPORTING
NO_FLUSH = ' '
IMPORTING
SHEETS = IT_SHEETS
ERROR = IREF_ERROR.
- SELECT_SHEET Activate a Sheet
CALL METHOD IREF_SPREADSHEET->SELECT_SHEET
EXPORTING
NAME = WA_SHEETS-SHEET_NAME
IMPORTING
ERROR = IREF_ERROR.
IF IREF_ERROR->HAS_FAILED = 'X'.
CONTINUE.
ENDIF.
- SET_SELECTION Set range to read the data
CALL METHOD IREF_SPREADSHEET->SET_SELECTION
EXPORTING
TOP = 4
LEFT = 1
ROWS = 2000
COLUMNS = 8.
- INSERT_RANGE Insert a New Range
CALL METHOD IREF_SPREADSHEET->INSERT_RANGE
EXPORTING
NAME = 'Test'
ROWS = 2000
COLUMNS = 8
NO_FLUSH = ''
IMPORTING
ERROR = IREF_ERROR.
- GET_RANGES_DATA Get the data of a range in spreadsheet
DATA : L_IT_RANGE TYPE SOI_DIMENSION_TABLE,
L_WA_RANGE TYPE SOI_DIMENSION_ITEM.
* create data range to selected
L_WA_RANGE-ROW = 2.
L_WA_RANGE-COLUMN = 1.
L_WA_RANGE-ROWS = 2000.
L_WA_RANGE-COLUMNS = 9.
APPEND L_WA_RANGE TO L_IT_RANGE.
CALL METHOD IREF_SPREADSHEET->GET_RANGES_DATA
EXPORTING
RANGESDEF = L_IT_RANGE "indicate range in which data to be read
IMPORTING
CONTENTS = IT_DATA "Internal table to contain the data
ERROR = IREF_ERROR
CHANGING
RANGES = IT_RANGES.
No comments:
Post a Comment