Show TOC

Office Integration ImplementationLocate this document in the navigation structure

Use

When you program office applications to start in the SAP GUI window, the interface i_oi_container_control is used to create and manage any further objects for Desktop Office Integration. To create an instance for this object:

Declaration

Your data declaration section must begin with the following declarations:

TYPE-POOLS soi. CLASS c_oi_errors DEFINITION LOAD.

The type pool contains important constants and type definitions. The class definition is used for error handling from the method calls of the Desktop Office Integration.

  1. Declare an instance for the central object of the Office Integration with reference to the interface i_oi_container_control :

    DATA control TYPE REF TO i_oi_container_control.

  2. Declare an object variable for all of the documents that you want to have open at once.

    DATA: document TYPE REF TO i_oi_document_proxy.

  3. Declare an object variable for the data transfer (optional):

    If you are working with the Link Server:

    DATA: link_server TYPE REF TO i_oi_link_server.

    If you are working with the Table Collection:

    DATA: table_coll TYPE REF TO i_oi_table_collection.

Initialization

Note

The following steps must only occur once in your program.

  1. Create the instance control .

    CALL METHOD c_oi_container_control_creator=>get_container_control
    IMPORTING control = control
    retcode = retcode.
                      
  2. If you want to use Desktop Office Integration in-place, you also need to create a container :

    DATA: container TYPE REF TO cl_gui_custom_container
    CREATE OBJECT container  EXPORTING container_name = 'CONTAINER'.
                      
  3. Call the method init_control . You have now created the central object for Desktop Office Integration and the connection to the relevant GUI control.

    CALL METHOD control->init_control
    EXPORTING r3_application_name = 'Demo Document Container'
    inplace_enabled = 'X'
    parent = container
    IMPORTING retcode = retcode.
                      
  4. Create an instance document for each document that you want to open:

    CALL METHOD control->get_document_proxy
    EXPORTING document_type = document_type
    document_format = document_format
    IMPORTING document_proxy = document
    retcode = retcode.
                      
  5. Create the instance for data transfer (Link Server: method get_link_server ; Table Collection: method get_table_collection) (optional).

  6. Create any application-specific interfaces:

    The Word Processor Interface

    The Form Interface

    The Mail Merge Interface

    The Script Collection

    The Table Interface

Processing

  1. Define the processing steps for your documents (open, close, save, ...)

Closing

  1. When you have finished editing a document, close it, save it, and release the memory area.

  2. When you no longer need the link server, close it and release the memory area (optional).

  3. Destroy the container instance (see item 6):

    CALL METHOD container->free.

  4. At the end of the program, use the method destroy_control to delete the instance control . Before doing this, however, you should delete all of the other instances that you had generated.

Note

Remember that you should include error handling after each method call.

When you destroy object and interface instances in Desktop Office Integration, remember that ABAP Objects, unlike other object-oriented languages, has no destructors. This means that when you release the i_oi_container_control instance using the FREE statement, only the memory space on the application server is released. The SAPgui controls and documents on the presentation server are not destroyed. For this reason, you should always call the methods that destroy the SAPgui controls and close the documents.

Note

Any parameters not contained in the individual method descriptions are listed under Generic Parameters .