SAP Office Excel Intergration
- *&---------------------------------------------------------------------*
- *& Report DEMOEXCELINTEGRATION *
- *&---------------------------------------------------------------------*
- INCLUDE rdemoexcelintegration2top.
- DATA: control TYPE REF TO i_oi_container_control.
- DATA: container TYPE REF TO cl_gui_custom_container.
- DATA: link_server TYPE REF TO i_oi_link_server.
- DATA: table_coll TYPE REF TO i_oi_table_collection.
- DATA: document_type TYPE soi_document_type
- VALUE soi_doctype_excel_chart,
- document_format TYPE soi_document_type.
- DATA: doc_size TYPE i, doc_url TYPE t_url,
- doc_table TYPE sbdst_content.
- DATA: usa_sales TYPE i VALUE 1000,
- europe_sales TYPE i VALUE 2000,
- japan_sales TYPE i VALUE 1000,
- asia_sales TYPE i VALUE 100,
- america_sales TYPE i VALUE 100,
- africa_sales TYPE i VALUE 100.
- DATA: total_sales TYPE i VALUE 0.
- DATA: BEGIN OF test_line, region(50), sales TYPE i, END OF test_line.
- DATA: test_table LIKE TABLE OF test_line.
- DATA: wa_test_table LIKE test_line.
- *---------------------------------------------------------------------*
- * CLASS c_excel_document DEFINITION
- *---------------------------------------------------------------------*
- * ........ *
- *---------------------------------------------------------------------*
- CLASS c_excel_document DEFINITION.
- PUBLIC SECTION.
- DATA: proxy TYPE REF TO i_oi_document_proxy.
- DATA: document_type TYPE soi_document_type.
- DATA: data_table TYPE sbdst_content,
- data_size TYPE i,
- doc_url TYPE t_url.
- METHODS: constructor
- IMPORTING control TYPE REF TO i_oi_container_control
- document_type TYPE soi_document_type.
- METHODS: on_close_document
- FOR EVENT on_close_document OF i_oi_document_proxy
- IMPORTING document_proxy has_changed.
- METHODS: on_custom_event
- FOR EVENT on_custom_event OF i_oi_document_proxy
- IMPORTING document_proxy event_name param_count
- param1 param2 param3.
- METHODS: create_document
- IMPORTING open_inplace TYPE c DEFAULT ' '
- value(no_flush) TYPE c DEFAULT ' '
- EXPORTING error TYPE REF TO i_oi_error.
- METHODS: open_document
- IMPORTING open_inplace TYPE c DEFAULT ' '
- open_readonly TYPE c DEFAULT ' '
- value(no_flush) TYPE c DEFAULT ' '
- EXPORTING error TYPE REF TO i_oi_error.
- METHODS: open_document_url
- IMPORTING open_inplace TYPE c DEFAULT ' '
- open_readonly TYPE c DEFAULT ' '
- doc_url TYPE t_url DEFAULT ' '
- EXPORTING error TYPE REF TO i_oi_error.
- METHODS: retrieve_document
- IMPORTING documents TYPE document_list
- EXPORTING document_format TYPE soi_document_type
- doc_url TYPE t_url.
- METHODS: close_document
- IMPORTING do_save TYPE c DEFAULT ' '
- value(no_flush) TYPE c DEFAULT ' '
- EXPORTING error TYPE REF TO i_oi_error.
- PRIVATE SECTION.
- DATA: control TYPE REF TO i_oi_container_control.
- ENDCLASS.
- DATA: document TYPE REF TO c_excel_document.
- DATA: error TYPE REF TO i_oi_error.
- DATA: error_table TYPE TABLE OF REF TO i_oi_error.
- DATA: bds_instance TYPE REF TO cl_bds_document_set.
- *&---------------------------------------------------------------------*
- *& Module STATUS_0100 OUTPUT
- *&---------------------------------------------------------------------*
- MODULE status_0100 OUTPUT.
- SET PF-STATUS 'MAIN0100'.
- SET TITLEBAR '001'.
- IF control IS INITIAL.
- CLEAR error_table.
- DATA: b_has_activex.
- CALL FUNCTION 'GUI_HAS_ACTIVEX'
- IMPORTING
- return = b_has_activex.
- IF b_has_activex IS INITIAL. MESSAGE e007. ENDIF.
- CALL METHOD c_oi_container_control_creator=>get_container_control
- IMPORTING control = control
- error = error.
- APPEND error TO error_table.
- CREATE OBJECT container
- EXPORTING container_name = 'CONTAINER'.
- CALL METHOD control->init_control
- EXPORTING r3_application_name =
- 'R/3 Basis' "#EC NOTEXT
- inplace_enabled = 'X'
- inplace_scroll_documents = 'X'
- parent = container
- register_on_close_event = 'X'
- register_on_custom_event = 'X'
- no_flush = 'X'
- IMPORTING error = error.
- APPEND error TO error_table.
- CALL METHOD control->get_link_server
- EXPORTING no_flush = 'X'
- IMPORTING link_server = link_server
- error = error.
- APPEND error TO error_table.
- CALL METHOD link_server->start_link_server
- EXPORTING no_flush = 'X'
- IMPORTING error = error.
- APPEND error TO error_table.
- CALL METHOD control->get_table_collection
- EXPORTING no_flush = 'X'
- IMPORTING table_collection = table_coll
- error = error.
- APPEND error TO error_table.
- CALL METHOD table_coll->add_table
- EXPORTING table_name = 'SALES_IN'
- table_type = table_coll->table_type_input
- no_flush = ' '
- IMPORTING error = error
- CHANGING data_table = test_table.
- APPEND error TO error_table.
- LOOP AT error_table INTO error.
- CALL METHOD error->raise_message EXPORTING type = 'E'.
- ENDLOOP.
- CLEAR error_table.
- PERFORM refresh_sales.
- CREATE OBJECT document
- EXPORTING control = control
- document_type = document_type.
- ENDIF.
- IF bds_instance IS INITIAL.
- CREATE OBJECT bds_instance.
- ENDIF.
- ENDMODULE. " STATUS_0100 OUTPUT
- *&---------------------------------------------------------------------*
- *& Module USER_COMMAND_0100 INPUT
- *&---------------------------------------------------------------------*
- MODULE user_command_0100 INPUT.
- DATA: l_fcode LIKE fcode.
- l_fcode = fcode.
- CLEAR fcode.
- CALL METHOD cl_gui_cfw=>dispatch.
- CASE l_fcode.
- WHEN 'EXIT'. "Zurück
- IF NOT document IS INITIAL.
- CALL METHOD document->close_document.
- FREE document.
- ENDIF.
- IF NOT link_server IS INITIAL.
- CALL METHOD link_server->stop_link_server.
- FREE link_server.
- ENDIF.
- IF NOT table_coll IS INITIAL.
- FREE table_coll.
- ENDIF.
- IF NOT control IS INITIAL.
- CALL METHOD control->destroy_control.
- FREE control.
- ENDIF.
- IF NOT bds_instance IS INITIAL.
- FREE bds_instance.
- ENDIF.
- LEAVE PROGRAM.
- WHEN 'CREATE'.
- IF NOT control IS INITIAL.
- CALL METHOD document->create_document.
- CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
- ENDIF.
- WHEN 'SELECT'.
- IF NOT control IS INITIAL.
- DATA: documents TYPE document_list.
- DATA: descr TYPE document_descr.
- CLEAR documents.
- descr-document_name = 'Car Sales Chart'(do1).
- descr-document_id = 'DEMOEXCELCHART1'.
- APPEND descr TO documents.
- descr-document_name = 'Car Sales Chart 2'(do3).
- descr-document_id = 'DEMOEXCELCHART2'.
- APPEND descr TO documents.
- descr-document_name = 'Car Sales Sheet'(do2).
- descr-document_id = 'DEMOEXCELSHEET1'.
- APPEND descr TO documents.
- CLEAR doc_url.
- CALL METHOD document->retrieve_document
- EXPORTING documents = documents
- IMPORTING document_format = document_format
- doc_url = doc_url.
- IF NOT doc_url IS INITIAL.
- CALL METHOD document->close_document.
- CALL METHOD document->open_document_url
- EXPORTING open_inplace = 'X'
- doc_url = doc_url
- IMPORTING error = error.
- CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
- ELSE.
- MESSAGE e010.
- ENDIF.
- ENDIF.
- WHEN 'OPEN'.
- IF document->data_size NE 0.
- IF NOT control IS INITIAL.
- CALL METHOD document->open_document
- IMPORTING error = error.
- CALL METHOD error->raise_message EXPORTING type = 'E'.
- ENDIF.
- ELSE.
- MESSAGE e005.
- ENDIF.
- WHEN 'INPLACE'.
- IF document->data_size NE 0.
- IF NOT control IS INITIAL.
- CALL METHOD document->open_document
- EXPORTING open_inplace = 'X'
- open_readonly = 'X'
- IMPORTING error = error.
- CALL METHOD error->raise_message EXPORTING type = 'E'.
- ENDIF.
- ELSE.
- MESSAGE e005.
- ENDIF.
- WHEN 'SAVEAS'.
- IF NOT document IS INITIAL AND NOT document->proxy IS INITIAL.
- CALL METHOD document->proxy->save_as
- EXPORTING prompt_user = 'X'
- IMPORTING error = error.
- CALL METHOD error->raise_message EXPORTING type = 'E'.
- ELSE.
- MESSAGE e000.
- ENDIF.
- WHEN 'CLOSE'.
- IF NOT document IS INITIAL.
- CALL METHOD document->close_document
- EXPORTING do_save = 'X'
- IMPORTING error = error.
- CALL METHOD error->raise_message EXPORTING type = 'E'.
- ELSE.
- MESSAGE e000.
- ENDIF.
- WHEN 'COPYLINK'.
- IF NOT link_server IS INITIAL.
- PERFORM refresh_sales.
- CALL METHOD link_server->execute_copy_link_dialog
- IMPORTING error = error.
- CALL METHOD error->raise_message EXPORTING type = 'E'.
- ELSE.
- MESSAGE e004.
- ENDIF.
- WHEN 'REFRESH'.
- IF NOT link_server IS INITIAL.
- PERFORM refresh_sales.
- ELSE.
- MESSAGE e004.
- ENDIF.
- IF NOT document IS INITIAL AND NOT document->proxy IS INITIAL.
- CALL METHOD document->proxy->execute_macro
- EXPORTING macro_string = 'module1.R3StartupMacro'
- param_count = 1
- param1 = 10
- IMPORTING error = error.
- * CHANGING retvalue = usa_sales.
- * CALL METHOD c_oi_errors=>show_message EXPORTING type = 'E'.
- ELSE.
- MESSAGE e000.
- ENDIF.
- WHEN 'PRINT'.
- IF NOT document IS INITIAL AND NOT document->proxy IS INITIAL.
- CALL METHOD document->proxy->print_document
- EXPORTING prompt_user = 'X'
- IMPORTING error = error.
- CALL METHOD error->raise_message EXPORTING type = 'E'.
- ELSE.
- MESSAGE e000.
- ENDIF.
- ENDCASE.
- ENDMODULE. " USER_COMMAND_0100 INPUT
- ************************************************************************
- * CLASS c_excel_document IMPLEMENTATION.
- ************************************************************************
- CLASS c_excel_document IMPLEMENTATION.
- METHOD: constructor.
- * IMPORTING control TYPE REF TO i_oi_container_control
- * document_type TYPE soi_document_type
- me->control = control.
- me->document_type = document_type.
- ENDMETHOD.
- METHOD create_document.
- * IMPORTING open_inplace TYPE c DEFAULT ' '
- * EXPORTING error TYPE REF TO i_oi_error.
- IF NOT proxy IS INITIAL.
- CALL METHOD me->close_document.
- ENDIF.
- CALL METHOD control->get_document_proxy
- EXPORTING document_type = document_type
- register_container = 'X'
- IMPORTING document_proxy = proxy
- error = error.
- IF error->error_code NE c_oi_errors=>ret_ok.
- EXIT.
- ENDIF.
- CALL METHOD proxy->create_document
- EXPORTING create_view_data = 'X'
- open_inplace = open_inplace
- document_title = 'R/3 Demo' "#EC NOTEXT
- IMPORTING error = error.
- IF error->error_code NE c_oi_errors=>ret_ok.
- EXIT.
- ENDIF.
- SET HANDLER me->on_close_document FOR proxy.
- SET HANDLER me->on_custom_event FOR proxy.
- ENDMETHOD.
- METHOD open_document.
- * IMPORTING open_inplace TYPE c DEFAULT ' '
- * open_readonly TYPE c DEFAULT ' '
- * EXPORTING error TYPE REF TO i_oi_error.
- IF NOT proxy IS INITIAL.
- CALL METHOD me->close_document.
- ENDIF.
- CALL METHOD control->get_document_proxy
- EXPORTING document_type = document_type
- register_container = 'X'
- IMPORTING document_proxy = proxy
- error = error.
- IF error->error_code NE c_oi_errors=>ret_ok.
- EXIT.
- ENDIF.
- CALL METHOD proxy->open_document_from_table
- EXPORTING document_table = data_table
- document_size = data_size
- open_inplace = open_inplace
- open_readonly = open_readonly
- document_title = 'R/3 Demo'
- IMPORTING error = error.
- IF error->error_code NE c_oi_errors=>ret_ok.
- EXIT.
- ENDIF.
- SET HANDLER me->on_close_document FOR proxy.
- SET HANDLER me->on_custom_event FOR proxy.
- CALL METHOD proxy->update_document_links
- IMPORTING error = error.
- ENDMETHOD.
- METHOD open_document_url.
- * IMPORTING open_inplace TYPE c DEFAULT ' '
- * open_readonly TYPE c DEFAULT ' '
- * doc_url TYPE t_url DEFAULT ' '
- * EXPORTING error TYPE REF TO i_oi_error.
- DATA: save_error TYPE REF TO i_oi_error.
- IF NOT proxy IS INITIAL.
- CALL METHOD me->close_document.
- ENDIF.
- CALL METHOD control->get_document_proxy
- EXPORTING document_type = document_type
- register_container = 'X'
- IMPORTING document_proxy = proxy
- error = error.
- IF error->error_code NE c_oi_errors=>ret_ok.
- EXIT.
- ENDIF.
- me->doc_url = doc_url.
- CALL METHOD proxy->open_document
- EXPORTING document_url = doc_url
- open_inplace = open_inplace
- open_readonly = open_readonly
- IMPORTING error = error.
- IF error->error_code NE c_oi_errors=>ret_ok.
- EXIT.
- ENDIF.
- data: is_available TYPE I.
- data: sheet_interface TYPE REF TO i_oi_spreadsheet.
- CALL METHOD proxy->has_spreadsheet_interface
- IMPORTING is_available = is_available
- error = error.
- if is_available EQ 1.
- CALL METHOD proxy->get_spreadsheet_interface
- IMPORTING sheet_interface = sheet_interface
- error = error.
- CALL METHOD sheet_interface->select_sheet
- EXPORTING name = 'Sheet1'
- IMPORTING error = error.
- CALL METHOD proxy->update_document_links
- IMPORTING error = error.
- CALL METHOD sheet_interface->select_sheet
- EXPORTING name = 'Chart1'
- IMPORTING error = error.
- endif.
- * Document shall also be available in ITAB for respective operations:
- CALL METHOD proxy->save_document_to_table
- IMPORTING error = save_error
- CHANGING document_table = data_table
- document_size = data_size.
- IF NOT save_error IS INITIAL.
- IF save_error->error_code NE c_oi_errors=>ret_ok.
- error = save_error.
- EXIT.
- ENDIF.
- ENDIF.
- SET HANDLER me->on_close_document FOR proxy.
- SET HANDLER me->on_custom_event FOR proxy.
- CALL METHOD proxy->update_document_links
- IMPORTING error = error.
- ENDMETHOD.
- METHOD retrieve_document.
- * importing documents type document_list
- * exporting document_format type soi_document_format
- * doc_url type t_url.
- *------BDS-Data-Structures:---------------------------------------------
- * Tables and WAs:
- DATA: doc_signature TYPE sbdst_signature,
- wa_doc_signature LIKE LINE OF doc_signature,
- doc_components TYPE sbdst_components,
- wa_doc_components LIKE LINE OF doc_components,
- doc_properties TYPE sbdst_properties,
- wa_doc_properties LIKE LINE OF doc_properties,
- doc_uris TYPE sbdst_uri,
- wa_doc_uris LIKE LINE OF doc_uris.
- * ID's:
- DATA: doc_classname TYPE sbdst_classname VALUE 'SOFFICEINTEGRATION',
- doc_classtype TYPE sbdst_classtype VALUE 'OT',
- doc_object_key TYPE sbdst_object_key VALUE 'SOFFICEINTEGRATION',
- doc_mimetype TYPE bapicompon-mimetype.
- *-----------------------------------------------------------------------
- DATA: field_desc TYPE TABLE OF rsvbfidesc.
- DATA: wa_field_desc TYPE rsvbfidesc.
- DATA: l_nr LIKE sy-tabix.
- CLEAR: field_desc, wa_field_desc.
- wa_field_desc-fieldnum = 1.
- wa_field_desc-display = 'X'.
- APPEND wa_field_desc TO field_desc.
- l_nr = 0.
- CALL FUNCTION 'RS_VALUES_BOX'
- EXPORTING
- left_upper_col = 5
- left_upper_row = 5
- pagesize = 10
- title = 'Select document'(sdc)
- IMPORTING
- linenumber = l_nr
- TABLES
- field_desc = field_desc
- value_tab = documents
- EXCEPTIONS
- OTHERS = 1.
- IF sy-subrc EQ 0 AND l_nr NE 0.
- READ TABLE documents INDEX l_nr INTO descr.
- IF sy-subrc EQ 0.
- CLEAR: wa_doc_signature, wa_doc_components, wa_doc_uris.
- CLEAR: doc_signature, doc_components, doc_uris.
- wa_doc_signature-prop_name = 'DESCRIPTION'.
- wa_doc_signature-prop_value = descr-document_id.
- APPEND wa_doc_signature TO doc_signature.
- CALL METHOD bds_instance->get_info
- EXPORTING classname = doc_classname
- classtype = doc_classtype
- object_key = doc_object_key
- CHANGING components = doc_components
- signature = doc_signature
- EXCEPTIONS nothing_found = 1
- error_kpro = 2
- internal_error = 3
- parameter_error = 4
- not_authorized = 5
- not_allowed = 6.
- IF sy-subrc NE 0 AND sy-subrc NE 1.
- MESSAGE e016.
- ENDIF.
- IF sy-subrc = 1.
- MESSAGE e017.
- ENDIF.
- CALL METHOD bds_instance->get_with_url
- EXPORTING classname = doc_classname
- classtype = doc_classtype
- object_key = doc_object_key
- CHANGING uris = doc_uris
- signature = doc_signature
- EXCEPTIONS nothing_found = 1
- error_kpro = 2
- internal_error = 3
- parameter_error = 4
- not_authorized = 5
- not_allowed = 6.
- IF sy-subrc NE 0 AND sy-subrc NE 1.
- MESSAGE e016.
- ENDIF.
- IF sy-subrc = 1.
- MESSAGE e017.
- ENDIF.
- READ TABLE doc_components INTO wa_doc_components INDEX 1.
- READ TABLE doc_uris INTO wa_doc_uris INDEX 1.
- doc_mimetype = wa_doc_components-mimetype.
- doc_url = wa_doc_uris-uri.
- CASE doc_mimetype.
- WHEN 'application/x-rtf' OR 'text/rtf'.
- document_format = soi_docformat_rtf.
- WHEN 'application/x-oleobject'.
- document_format = soi_docformat_compound.
- WHEN 'text/plain'.
- document_format = soi_docformat_text.
- WHEN OTHERS.
- document_format = soi_docformat_native.
- ENDCASE.
- ENDIF.
- ENDIF.
- ENDMETHOD.
- METHOD close_document.
- * IMPORTING do_save TYPE c DEFAULT ' '
- * EXPORTING error TYPE REF TO i_oi_error.
- DATA: is_closed TYPE i, has_changed TYPE i.
- DATA: save_error TYPE REF TO i_oi_error.
- IF NOT proxy IS INITIAL.
- CALL METHOD proxy->is_destroyed IMPORTING ret_value = is_closed.
- IF is_closed IS INITIAL.
- CALL METHOD proxy->close_document
- EXPORTING do_save = do_save
- IMPORTING has_changed = has_changed
- error = error.
- IF error->error_code NE c_oi_errors=>ret_ok.
- EXIT.
- ENDIF.
- ENDIF.
- IF NOT has_changed IS INITIAL.
- CALL METHOD proxy->save_document_to_table
- EXPORTING no_flush = 'X'
- IMPORTING error = save_error
- CHANGING document_table = data_table
- document_size = data_size.
- ENDIF.
- CALL METHOD proxy->release_document
- IMPORTING error = error.
- IF NOT save_error IS INITIAL.
- IF save_error->error_code NE c_oi_errors=>ret_ok.
- error = save_error.
- ENDIF.
- ENDIF.
- SET HANDLER me->on_close_document FOR proxy ACTIVATION ' '.
- SET HANDLER me->on_custom_event FOR proxy ACTIVATION ' '.
- ELSE.
- CALL METHOD c_oi_errors=>create_error_for_retcode
- EXPORTING retcode = c_oi_errors=>ret_document_not_open
- no_flush = ' '
- IMPORTING error = error.
- ENDIF.
- ENDMETHOD.
- METHOD on_close_document.
- * FOR EVENT on_close_document OF c_oi_container_control
- * IMPORTING document_proxy has_changed.
- DATA: answer, do_save.
- IF has_changed EQ 1.
- CALL FUNCTION 'POPUP_TO_CONFIRM'
- EXPORTING
- titlebar = 'Office Integration Demo'(oid)
- text_question = 'Save Document?'(sav)
- display_cancel_button = ' '
- IMPORTING
- answer = answer.
- IF answer EQ '1'.
- do_save = 'X'.
- ELSE.
- do_save = ' '.
- ENDIF.
- CALL METHOD me->close_document
- EXPORTING do_save = do_save
- IMPORTING error = error.
- CALL METHOD error->raise_message
- EXPORTING type = 'E'.
- ENDIF.
- ENDMETHOD.
- METHOD on_custom_event.
- * FOR EVENT on_custom_event OF i_oi_document_proxy
- * IMPORTING document_proxy event_name param_count
- * param1 param2 param3.
- IF event_name EQ 'ON_SERIES_CHANGE'.
- CALL METHOD table_coll->get_table
- EXPORTING table_name = 'SALES_IN'
- IMPORTING error = error
- CHANGING data_table = test_table.
- CALL METHOD error->raise_message
- EXPORTING type = 'E'.
- CLEAR wa_test_table.
- READ TABLE test_table INTO wa_test_table INDEX 1.
- usa_sales = wa_test_table-sales.
- CLEAR wa_test_table.
- READ TABLE test_table INTO wa_test_table INDEX 2.
- europe_sales = wa_test_table-sales.
- CLEAR wa_test_table.
- READ TABLE test_table INTO wa_test_table INDEX 3.
- japan_sales = wa_test_table-sales.
- CLEAR wa_test_table.
- READ TABLE test_table INTO wa_test_table INDEX 4.
- asia_sales = wa_test_table-sales.
- CLEAR wa_test_table.
- READ TABLE test_table INTO wa_test_table INDEX 5.
- america_sales = wa_test_table-sales.
- CLEAR wa_test_table.
- READ TABLE test_table INTO wa_test_table INDEX 6.
- africa_sales = wa_test_table-sales.
- CLEAR wa_test_table.
- ENDIF.
- ENDMETHOD.
- ENDCLASS.
- ************************************************************************
- * FORM refresh_sales.
- ************************************************************************
- FORM refresh_sales.
- DATA: BEGIN OF item_line,
- region(60),
- sales TYPE i,
- date TYPE d,
- time TYPE t,
- weight TYPE f,
- amount TYPE p DECIMALS 3,
- id(10) TYPE n,
- END OF item_line.
- DATA: sales_table LIKE TABLE OF item_line.
- DATA: wa_sales_table LIKE item_line.
- DATA: fields_table TYPE TABLE OF rfc_fields.
- DATA: wa_fields_table TYPE rfc_fields.
- DATA: ind TYPE i.
- CALL FUNCTION 'DP_GET_FIELDS_FROM_TABLE'
- TABLES
- data = sales_table
- fields = fields_table.
- READ TABLE fields_table INDEX 1 INTO wa_fields_table.
- wa_fields_table-fieldname = 'Region'."#EC NOTEXT
- MODIFY fields_table FROM wa_fields_table INDEX 1.
- CLEAR wa_fields_table.
- READ TABLE fields_table INDEX 2 INTO wa_fields_table.
- wa_fields_table-fieldname = 'Sales'. "#EC NOTEXT
- MODIFY fields_table FROM wa_fields_table INDEX 2.
- CLEAR: sales_table, wa_sales_table.
- wa_sales_table-region = 'USA'(usa).
- wa_sales_table-sales = usa_sales.
- APPEND wa_sales_table TO sales_table.
- CLEAR wa_sales_table.
- wa_sales_table-region = 'Europe'(eur).
- wa_sales_table-sales = europe_sales.
- APPEND wa_sales_table TO sales_table.
- CLEAR wa_sales_table.
- wa_sales_table-region = 'Japan'(jap).
- wa_sales_table-sales = japan_sales.
- APPEND wa_sales_table TO sales_table.
- CLEAR wa_sales_table.
- wa_sales_table-region = 'Asia'(asi).
- wa_sales_table-sales = asia_sales.
- APPEND wa_sales_table TO sales_table.
- CLEAR wa_sales_table.
- wa_sales_table-region = 'America'(ame).
- wa_sales_table-sales = america_sales.
- APPEND wa_sales_table TO sales_table.
- CLEAR wa_sales_table.
- wa_sales_table-region = 'Africa'(afr).
- wa_sales_table-sales = africa_sales.
- APPEND wa_sales_table TO sales_table.
- CLEAR wa_sales_table.
- LOOP AT sales_table INTO wa_sales_table.
- ind = sy-tabix.
- wa_sales_table-date = sy-datum + ind.
- wa_sales_table-time = sy-uzeit + ind.
- wa_sales_table-weight = 100000 * ind.
- wa_sales_table-amount = 11111 * ind.
- wa_sales_table-id = ind.
- MODIFY sales_table FROM wa_sales_table INDEX ind.
- ENDLOOP.
- CALL METHOD table_coll->add_table
- EXPORTING table_name = 'SALES_OUT'
- table_type = table_coll->table_type_output
- no_flush = 'X'
- IMPORTING error = error
- CHANGING data_table = sales_table
- fields_table = fields_table.
- CALL METHOD link_server->add_table_item2
- EXPORTING item_name = 'Sales' "#EC NOTEXT
- item_title = 'Car Sales Figures'(sal)
- no_flush = 'X'
- IMPORTING error = error
- CHANGING data_table = sales_table
- fields_table = fields_table.
- CALL METHOD link_server->add_string_item
- EXPORTING item_name = 'ChartTitle'
- item_title = 'Chart Title'(ti0)
- item_value = 'Car Sales by Region'(ti1)
- no_flush = 'X'
- IMPORTING error = error.
- CALL METHOD link_server->add_string_item
- EXPORTING item_name = 'ColumnTitle1'
- item_title = 'Column Title 1'(ti2)
- item_value = 'Region'(ti3)
- no_flush = 'X'
- IMPORTING error = error.
- CALL METHOD link_server->add_string_item
- EXPORTING item_name = 'ColumnTitle2'
- item_title = 'Column Title 2'(ti4)
- item_value = 'Sold Cars'(ti5)
- no_flush = ' '
- IMPORTING error = error.
- ENDFORM.
- *----------------------------------------------------------------------*
- * INCLUDE RDEMOEXCELINTEGRATIONTOP2 *
- *----------------------------------------------------------------------*
- REPORT saprdemoexcelintegration2 MESSAGE-ID demoofficeintegratio.
- SET SCREEN 100.
- TYPE-POOLS: sbdst, soi.
- CLASS c_oi_errors DEFINITION LOAD.
- TYPES: BEGIN OF document_descr,
- document_name(40), document_id(64),
- END OF document_descr.
- TYPES: document_list TYPE TABLE OF document_descr.
- TYPES: t_url LIKE bapiuri-uri.
- DATA: fcode LIKE sy-ucomm.
SAP Office Excel Intergration的更多相关文章
- Microsoft Office Excel 不能访问文件及COM无法访问
Microsoft Office Excel 不能访问文件及COM无法访问 Microsoft Office Excel 不能访问文件“*.xls”. 可能的原因有: 1 文件名称或路径不存在. 2 ...
- Microsoft Office Excel 不能访问文件 的解决办法
Microsoft Office Excel 不能访问文件"a.xls". 可能的原因有: ? 文件名称或路径不存在. ? 文件正被其他程序使用. ? 您正要保存的工作簿与当前 ...
- PHPExcel 是用来操作Office Excel 文档的一个PHP类库
PHPExcel 是用来操作Office Excel 文档的一个PHP类库,它基于微软的OpenXML标准和PHP语言.可以使用它来读取.写入不同格式的电子表格,如 Excel (BIFF) .xls ...
- [Excel操作]Microsoft Office Excel 不能访问文件
最近,客户服务器迁移,因操作系统环境变化而引起的的环境问题一堆,遇到的问题并解决方法在“[Excel]操作”类别会体现. Microsoft Office Excel 不能访问文件“C:\\LMSEx ...
- Microsoft Office Excel 不能访问文件
问题描述: Microsoft Office Excel 不能访问文件“XX.xls”.可能的原因有: 1 文件名称或路径不存在.2 文件正被其他程序使用.3 您正要保存的工作簿与当前打开的工作簿同名 ...
- ERP中通过EDI导入资料的时候出现【Microsoft Office Excel不能访问文件‘C:\Windows\TEMP\433....’
问题描述: ERP中导入单据的时候报错,Microsoft Office Excel不能访问文件'C:\Windows\TEMP\433....可能的原因有:·文件名称或路径不存在,文件正被其他程序使 ...
- OS + Windows 10 / office excel vlookup / CredSSP
s https://support.microsoft.com/zh-cn/help/10749/windows-10-find-product-key 查找 Windows 7 或 Windows ...
- office excel中怎么添加批注及修改批注用户名
office excel中怎么添加批注及修改批注用户名 参考:https://jingyan.baidu.com/article/c33e3f48a52853ea15cbb5db.html 1. of ...
- CVE-2011-0104 Microsoft Office Excel缓冲区溢出漏洞 分析
漏洞简述 Microsoft Excel是Microsoft Office组件之一,是流行的电子表格处理软件. Microsoft Excel中存在缓冲区溢出漏洞,远程攻击者可利用此 ...
随机推荐
- Linux 开启远程访问
系统:Ubuntu16.0 虚拟机 问题:Windows访问Ubun被拒绝 解决方法: 1.先检测是否安装SSH服务 1 sudo apt-get install ssh 2.编辑ssh配置文件 1 ...
- 汇编语言实验1—Debug基础操作
1.使用Debug,将下面的程序段写入内存,逐条执行,观察每条指令执行后CPU中相关寄存器中内容的变化. 记录1:最后一条指令执行完BX=(4026)H,AL=(66)H,检验结果. 两种写入:e命令 ...
- JavaScript学习总结6-apply
JS中的apply方法可以控制this指向 任何JS支持的类型都可以转化为JSON JS对象是键值对型的,JSON是字符串型的 原型对象:__proto__ JS万物皆对象,ES6开始提供了对后端开发 ...
- 【课程汇总】OpenHarmony全场景Demo数字管家系列课(附链接)
小孩放学了,做作业的时间到,窗帘.护眼灯自动打开,关掉电视和扫地机,给小孩一个安静舒适的学习环境:碰到学习难题,可以随时请求你的远程指导:晚上回家休息了,选择舒适的氛围灯,伴随着睡眠音乐进入梦乡:出门 ...
- python爬取快手小姐姐视频
流程分析 一.导入需要的三方库 import re #正则表表达式文字匹配 import requests #指定url,获取网页数据 import json #转化json格式 import os ...
- 自己的~/.vimrc
" 语法高亮syntax on " 搜索高亮set hlsearch " 显示行号set number" let mapleader="," ...
- 虚拟机(Vmvare)与配置,得到一台学习机
准备: 1.Vmvare 2.CentOS7.4镜像 安装与配置操作系统: 1.配置虚拟机上网 2.配置静态ip地址 开始安装 1. 2.直接下一步选择我们准备好的镜像,然后下一步 3.修改虚拟机的名 ...
- 让服务调用更简单 - Caller.HttpClient
前言 绝大多数项目都离不开服务调用,服务的调用方式通常是基于Http.RPC协议的调用,需要获取到对应服务的域名或者ip地址以及详细的控制器方法后才能进行调用,如果项目需要支持分布式部署,则需要借助服 ...
- 异步编程利器:CompletableFuture
一.一个示例回顾Future 一些业务场景我们需要使用多线程异步执行任务,加快任务执行速度. JDK5新增了Future接口,用于描述一个异步计算的结果.虽然 Future 以及相关使用方法提供了异步 ...
- 探索 Python/Django 支持分布式多租户数据库,如 Postgres+Citus
在 确定分布策略 中,我们讨论了在多租户用例中使用 Citus 所需的与框架无关的数据库更改. 在这里,我们专门研究如何借助 django-multitenant 库将多租户 Django 应 用程序 ...