Professional Documents
Culture Documents
REPORT ztest_andre.
* Global definitions
INCLUDE officeintegrationinclude.
DATA:
* OKCODE
gv_okcode TYPE syucomm,
* SAP Desktop Office Integration Interfaces
gc_container TYPE REF TO cl_gui_custom_container,
gc_control TYPE REF TO i_oi_container_control,
gc_document TYPE REF TO i_oi_document_proxy,
gc_spreadsheet TYPE REF TO i_oi_spreadsheet,
gc_error TYPE REF TO i_oi_error,
gt_errors TYPE REF TO i_oi_error OCCURS 0 WITH HEADER LINE,
gv_initialized TYPE c.
*----------------------------------------------------------------------*
* CLASS lcl_excel_event_handler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_excel_event_handler DEFINITION.
PUBLIC SECTION.
METHODS: on_close_document
FOR EVENT on_close_document OF i_oi_document_proxy
IMPORTING document_proxy has_changed.
ENDCLASS. "lcl_excel_event_handler DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_excel_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_excel_event_handler IMPLEMENTATION.
METHOD on_close_document.
BREAK-POINT.
ENDMETHOD. "on_close_document
ENDCLASS. "lcl_excel_event_handler IMPLEMENTATION
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* Status
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS '100'.
SET TITLEBAR '100'.
DATA:
* Structure and table to retreive file from Local PC
lw_file_table TYPE file_table,
lt_file_table TYPE filetable,
* Variable for local PC file name
lv_filename TYPE string,
* Table to upload file
lt_upload TYPE STANDARD TABLE OF t_row,
* File length
lv_filelength TYPE i,
* Return code
lv_rc TYPE i,
* Return from Method open_document_from_table
lf_retcode TYPE soi_ret_string,
* Spreadsheet available
lv_spread_available TYPE i.
REFRESH lt_upload.
CLEAR lv_filelength.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = lv_filename
filetype = 'BIN'
IMPORTING
filelength = lv_filelength
* HEADER =
CHANGING
data_tab = lt_upload
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc <> 0.
* Implement suitable error handling here
LEAVE PROGRAM.
ENDIF.
gc_spreadsheet->select_sheet(
EXPORTING
name = 'septembre' " Name of Worksheet
no_flush = ' ' " Flush?
IMPORTING
error = gt_errors " Error?
retcode = lf_retcode " Text of Error
).
gc_spreadsheet->set_selection(
EXPORTING
left = 1 " Line of Top Left-Hand Cell
top = 60 " Column of Top Left-Hand Cell
rows = 1 " Lines
columns = 50 " Columns
* no_flush = ' ' " Flush?
updating = -1 " Screen Updating
* IMPORTING
* error = " Error?
* retcode = " Text of Error
).
CALL METHOD gc_spreadsheet->insert_range
EXPORTING
name = 'ranges'
rows = '1'
columns = '5'
no_flush = ''
IMPORTING
error = gt_errors.
APPEND gt_errors.
* gc_spreadsheet->hide_rows(
* EXPORTING
* name = 'ranges' " Name of Range
** no_flush = ' ' " Flush?
* IMPORTING
* error = gt_errors " Error?
* retcode = lf_retcode " text
* ).
* APPEND gt_errors.
LOOP AT gt_errors.
CALL METHOD gt_errors->raise_message
EXPORTING
type = 'E'.
ENDLOOP.
FREE gt_errors.
START-OF-SELECTION.
* Start with the screen
SET SCREEN 100.