Code: Alles auswählen.
* first get the SAP DOI i_oi_container_control interface
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING control = control
error = error.
* check no errors occured
CALL METHOD error->raise_message EXPORTING type = 'E'.
*Erzeugung Container-Objekt und Verknüpfung mit Custom Control
CREATE OBJECT container
EXPORTING container_name = 'EXCELCONT'.
* initialize the SAP DOI Container, tell it to run in the container
* specified above and tell it to run Excel in-place
CALL METHOD control->init_control
EXPORTING r3_application_name =
'Excel'
inplace_enabled = 'X'
inplace_scroll_documents = 'X'
inplace_resize_documents = 'X'
parent = container
register_on_close_event = 'X'
register_on_custom_event = 'X'
no_flush = ''
IMPORTING error = errors.
* save error object in collection
APPEND errors.
* ask the SAP DOI container for a i_oi_document_proxy for Excel
CALL METHOD control->get_document_proxy
EXPORTING document_type = 'Excel.Sheet'
no_flush = ''
* REGISTER_CONTAINER = 'X'
IMPORTING document_proxy = document
error = errors.
APPEND errors.
CALL METHOD document->open_document
EXPORTING
* DOCUMENT_TITLE = ' '
document_url = path
* NO_FLUSH = ' '
OPEN_INPLACE = 'X '
* OPEN_READONLY = ' '
* PROTECT_DOCUMENT = ' '
* STARTUP_MACRO = ''
* USER_INFO =
IMPORTING
error = errors.
APPEND errors.
* check if our document proxy can serve a spreadsheet interface data:
DATA: has TYPE i.
CALL METHOD document->has_spreadsheet_interface
EXPORTING no_flush = ''
IMPORTING is_available = has
error = errors.
APPEND errors.
CALL METHOD document->get_spreadsheet_interface
EXPORTING no_flush = ' '
IMPORTING
sheet_interface = spreadsheet
error = errors.
APPEND errors.
LOOP AT errors.
CALL METHOD errors->raise_message
EXPORTING type = 'E'.
ENDLOOP.
FREE errors.
* Performance-Verbesserung
CALL METHOD spreadsheet->load_lib
EXPORTING no_flush = ''
IMPORTING error = errors.
APPEND errors.
CALL METHOD control->set_focus
EXPORTING no_flush = ' '
IMPORTING error = errors.
APPEND errors.
LOOP AT errors.
CALL METHOD errors->raise_message
EXPORTING type = 'E'.
ENDLOOP.
FREE errors.