Office Integration via ABAP OO Interfaces - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Office Integration via ABAP OO Interfaces

Description:

Eduard Bartsch, Rainer Ehre, Herbert Neuendorf. Benefits. Integration of any desktop application that supports OLE documents through the ... – PowerPoint PPT presentation

Number of Views:1399
Avg rating:3.0/5.0
Slides: 24
Provided by: Consu5
Category:

less

Transcript and Presenter's Notes

Title: Office Integration via ABAP OO Interfaces


1
Office Integration via ABAP OO Interfaces
  • ABAP Component IntegrationEduard Bartsch, Rainer
    Ehre, Herbert Neuendorf

2
Benefits
  • Integration of any desktop application that
    supports OLE documents through the same, easy to
    use set of ABAP OO interfaces
  • Better integration technology
  • In-Place viewing and editing of documents
  • Communication through events
  • Generic data exchange technology (internal
    tables)
  • Integration of different word processors through
    one ABAP OO interface
  • More solid R/3 standard solutions that are based
    on desktop office applications

3
Office Integration - Objectives
  • Generic architecture through standard technology
  • Integration of all OLE2-enabled desktop
    applications
  • Use of standard technology - OLE2 Documents, OLE
    Automation...
  • New integration technologies
  • In-Place Viewing and Editing of Documents
  • Linking Exchanging of SAP data
  • Event handling
  • Standard ABAP interfaces
  • generic word processor interface for different
    word processor applications ( e.g. Word97,
    WordPerfect, WordPro, Starwriter )
  • avoid (reduce) tool specific macro programming

4
Office Integration - Programming Model
  • GUI 4.0 based programming model
  • SAP Document Container as GUI Control
  • installation, instantiation, methods, events
  • SAP Data Provider plugable converters, various
    data sources via URLs
  • Office Integration API completely object oriented
  • Interface technology
  • generic document interface, Link server
    interface, internal table interface, word
    processor interface, spreadsheet interface...
  • Event handling through ABAP OO events

5
Generic ABAP document interface
  • Integrate any OLE2 Documents based desktop
    application
  • open and save documents via the memory instead of
    the file system
  • create, print, play, view, and close documents
  • enable communication between the desktop
    application and R/3 via one standardized SAP
    event Application.ActiveDocument.Container.SendCu
    stomEvent(On_Change)
  • Install SAP-specific menu bars, menus, and menu
    items

6
Linking of SAP data
  • Application independence
  • Link to SAP data within a Word documentLINK
    SAP.Objects.1 SAPOLELinkServer OrderEntries!R1C1R
    1C3 \t
  • OLE application pulls link data
  • R/3 application updates link data
  • Not just links to SAP fields as texts, but also
    links to SAP internal tables, bitmaps, images,
    RTF
  • Easy to use by end user (just select a link item
    using standard R/3 dialog, then use the standard
    Paste Special application dialog to paste the
    link into a document)
  • Customizing support not R/3 program but
    customer/user decides where and how the SAP data
    should be displayed

7
Exchanging of SAP data (internal tables)
  • Easy upload of SAP data, e.g. from EXCEL
    spreadsheet
  • Dynamic fill in and formatting of SAP data, e.g.
    using Word's table construct
  • Generic ABAP Interface for read and write of ABAP
    internal tables
  • Generic read and write of ABAP internal tables by
    the desktop application's macro language
  • Document container as automation server
  • Table ActiveX (SAP Automation Controls)
  • Read internal table within a Word
    documentApplication.ActiveDocument.Container.Tab
    les("Customers")

8
Generic ABAP word processor interface
  • Integration of different word processing
    applications (Microsoft, Lotus, Corel, Star
    Division) hidden behind one generic ABAP
    word-processor interface (R/3 4.0C)
  • selection
  • navigation
  • text manipulation
  • special operations like add template

9
ABAP Office Integration OO Interfaces
i_oi_ole_container_control (4.0A) inplace
viewing/editing
i_oi_document_factory (4.0A) editing in separate
window
i_oi_link_server (4.0A) Links SAP objects like
fields, internal tables, Bitmaps, and other
formats
i_oi_table_collection (4.0C) Exchange SAP data
through internal tables
i_oi_word_processor_document (4.0C) word
processing specific functionality
ABAP spreadsheet interface
i_oi_document_proxy (4.0A) Open, Close, Save,
Play, Print, generic event handling
10
Generic ABAP document interface
i_oi_document_proxy Events on_custom_event on_clo
se_document Methods create_document open_docume
nt play_document view_document close_document
save_document_to_url release_document save_as sa
ve_copy_as print_document page_setup select_all
clear_selection cut_selection copy_selection p
aste_clipboard paste_special execute_macro add_m
enu_bar add_menu_popup add_menu_item delete_menu
_item get_document_type has_standard_interface is_
open has_changed get_document_handle is_destroy
ed has_wordprocessor_interface get_wordprocess
or_interface
11
Generic Link Server Interface and generic
Internal Table Server Interface
i_oi_link_server Methods start_link_server stop
_link_server add_string_item add_table_item add_b
inary_item remove_link_item copy_link_item_to_clip
board execute_copy_link_dialog
i_oi_table_collection Methods add_table add_tab
le_by_url get_table get_table_by_url remove_table
remove_all_tables
12
Container Automation Server Model
Dim table as objectDim row as object set table
ThisDocument.Container.Tables("Customers").Table f
or each row in table.rows print
row.value("Name") next
Container
LinkServer
Active
Name
Items
Tables
Name
Type
Table
Data
13
Easy-to-Use ABAP OO Integration Interfaces
c_oi_factory_creator class_methods
get_document_factory
14
Easy-to-Use ABAP OO Integration Interfaces
c_oi_ole_container_control interface_methods init
_control destroy_control link_control set_window_p
roperty set_inplace_border_space release_all_docum
ents get_document_proxy get_link_server
i_oi_ole_container_control
c_oi_ole_control_creator class_methodsget_ole_con
tainer_control
i_oi_document_proxy
c_oi_ole_document_proxy events on_close_document
on_custom_event interface_methods open_document
close_document save_as execute_macro get_wordproce
ssor_interface ...
i_oi_link_server
c_oi_ole_link_server interface_methods start_link
_server stop_link_server add_string_item add_table
_item add_binary_item remove_link_item copy_link_i
tem_to_clipboard execute_copy_link_dialog
c_oi_ole_word_processor interface_methods install
_template set_template search replace
i_oi_word_processor
15
ABAP Example Open document
"--- define interface reference variables
DATAfactory TYPE REF TO i_oi_document_factory,
document TYPE REF TO i_oi_document_proxy.
"--- create factory instance and
initialize CALL METHOD c_oi_factory_creatorgtget_d
ocument_factory EXPORTING factory_type
OLE IMPORTING factory factory
retcode retcode. CALL METHOD factory-gtstart_fact
ory EXPORTING "--- determine document
URL and type of document "--- e.g. read document
into ABAP internal table, ship it to desktop via
Data Provider "--- and get back URL or use any
WWW Url. "--- create document type specific
proxy instance CALL METHOD factory-gtget_document_p
roxy EXPORTING document_type docType
IMPORTING document_proxy document retcode
retcode. "--- open
document CALL METHOD document-gtopen_document
EXPORTING document_url URL open_inplace
space RECEIVING retcode retcode.
16
ABAP Example Resolve link in document
"--- define interface reference variables
DATAfactory TYPE REF TO i_oi_document_factory,
document TYPE REF TO i_oi_document_proxy,
link_server TYPE REF TO i_oi_link_server. "---
create factory instance and initialize CALL
METHOD c_oi_factory_creatorgtget_document_factory
EXPORTING factory_type OLE
IMPORTING factory factory retcode
retcode. CALL METHOD factory-gtstart_factory
EXPORTING "--- create link server instance and
initialize CALL METHOD factory-gtget_link_server
IMPORTING link_server link_server retcode
retcode. CALL METHOD link_server-gtstart_link_serve
r RECEIVING retcode retcode. "--- determine
document URL and type of document "--- e.g. read
document into ABAP internal table, ship it to
desktop via Data Provider "--- and get back URL
or use any WWW Url. "--- create document type
specific proxy instance CALL METHOD
factory-gtget_document_proxy EXPORTING
document_type docType IMPORTING
document_proxy document retcode
retcode. "--- register link name and value CALL
METHOD link_server-gtadd_string_item EXPORTING
item_name CUSTOMER item_value
Hasso RECEIVING retcode retcode. "---
open document CALL METHOD document-gtopen_document
EXPORTING document_url URL open_inplace
space RECEIVING retcode retcode.
17
ABAP Example Event handling
Handler
Register Handler
CLASS CEvent_Handler DEFINITION. PUBLIC
SECTION. CLASS-METHODS OnClose FOR EVENT
on_close_document OF i_oi_document_proxy
IMPORTING document_proxy has_changed.
OnCustomEvent FOR EVENT on_custom_event OF
i_oi_document_proxy IMPORTING document_proxy
event_name param1 param2
param3. ENDCLASS. CLASS CEvent_Handler
IMPLEMENTATION. METHOD OnClose. "--- handle
close event here ENDMETHOD. METHOD
OnCustomEvent. "--- handle custom event
here ENDMETHOD. ENDCLASS.
DATA doc TYPE REF TO i_oi_document_proxy "-
-- create document type specific proxy CALL
METHOD factory-gtget_document_proxy EXPORTING
document_type docType IMPORTING
document_proxy doc retcode
retcode. "--- register for events of
document proxy SET HANDLER CEvent_HandlergtOnC
lose FOR doc. SET HANDLER
CEvent_HandlergtOnCustomEvent FOR doc.
18
VBA Example R/3 Data into Word Table
Sub R3UpdateTables() Dim R3Table As Object
Dim WordTbl As Table Set WordTbl
ThisDocument.Tables(2) Set R3Table
ThisDocument.Container.LinkServer.Items("Agenda").
Table Call R3ExpandTable(WordTbl,R3Table,1,3,
0,0,Array("","Proposal","Name","Comment"),False) E
nd Sub Public Sub R3ExpandTable(WordTbl As
Table, R3Table As Object, _
LowerB, UpperB, LeftB, RightB As Long, _
SelectedCols As
Variant, AdjustRowCount As Boolean) End Sub
19
VBA Example Get R/3 data from/into Excel
Private Sub Workbook_Activate() Dim R3Table
As Object Dim ExcelRange As Excel.Range
Set R3Table ThisWorkbook.Container.Tables("SA
LES_OUT").Table Set ExcelRange
Sheet1.Range(Sheet1.Cells(1, 1),
Sheet1.Cells(R3Table.Rows.Count,
R3Table.Columns.Count)) ExcelRange.Value
R3Table.Data End Sub Private Sub
Chart_SeriesChange(ByVal SeriesIndex As Long,
ByVal PointIndex As Long) Dim R3Table As
Object Dim Row As Object Set R3Table
ThisWorkbook.Container.Tables("SALES_IN").Table
R3Table.Rows.RemoveAll For i 1 To
6 Set Row R3Table.Rows.Add For
j 1 To R3Table.Columns.Count
Row.Cell(j) Sheet1.Cells(i, j).Value
Next j Next i Call
ThisWorkbook.Container.SendCustomEvent("ON_CHANGE"
) End Sub
20
GUI 4.0 Programming Model
R/3
SAPGUI
Running object table
I_oi_link_server add_string_item
SAP document container control
OrderNumber 4711
SAPOLELinkServer
OrderNumber 4711
MS Word
I_oi_document_proxy open_document save_document on
_custom_event on_close_document
4711 LINK SAPOLELinkServer OrderNumber doc
SAP data provider
doc
doc
21
SAPs Control Enabling Technology
ABAP
OLE Documents OLE Automation
c_oi_factory_creator
c_oi_ole_control_creator
get_ole_container_control
get_document_factory
SAPGUI
i_oi_ole_container_control
i_oi_document_factory
c_oi_ole_document_factory container_control
Word97
c_oi_ole_container_control container_control
get_table_collection
get_link_server
i_oi_table_collection
i_oi_link_server
InitControl
c_oi_ole_link_server container_control
SAP.DocumentContainerControl.1
get_document_proxy
i_oi_document_proxy
c_oi_ole_document_proxy container_control doc_coo
kie standard_proxy_handle word_processor_handle
c_ole_container_control h_control
SAP.DocumentContainer.1
get_word_processor_interface
SAP.OfficeIntegration.Word97Proxy.1
i_oi_word_processor
c_oi_ole_word_processor proxy_ref
22
SAPGUI
Word97
OLE Links
Word Document
OLE Documents
LINK SAPOLELinkServer OrderNumber
IOleObjectIOleInPlaceObjectIOleInPlaceActiveObje
ctIOleCommandTarget
IDispatch
OLE Automation
SAP.OfficeIntegration.Word97Proxy.1
23
Try it !
  • R/3 4.0 System, development class
    SOFFICEINTEGRATION
  • Demo programs
  • SAPRDEMOWORD97INTEGRATION starts MS Word97 with a
    document stored in the R/3 database, adds a
    template from there, adds menu bars, menus and
    menu items, catches events triggered in Word,
    executes macros, and also uses AUTOMATION for
    search and replace
  • SAPRDEMOEXCELINTEGRATION starts EXCEL in-place in
    a SAP screen
  • SAPRDEMODOCUMENTCONTAINER shows a VISIO document
    which describes the ABAP OO Office Integration
    interfaces. You can start any OLE application to
    create documents and show them in-place.
  • SAPRDEMOOFFICEINTEGRATION displays a list of all
    installed OLE applications, creates and opens OLE
    documents in a separate window
Write a Comment
User Comments (0)
About PowerShow.com