Office Integration Implementation 

When you program office applications to start in the R/3 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

1. 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:
  2. DATA control TYPE REF TO i_oi_container_control.

  3. Declare an object variable for all of the documents that you want to have open at once.
  4. DATA: document TYPE REF TO i_oi_document_proxy.

  5. 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

The following steps must only occur once in your program.

  1. Create the instance control.
  2. CALL METHOD c_oi_container_control_creator=>get_container_control

         IMPORTING control = control

                   retcode = retcode.

  3. If you want to use Desktop Office Integration in-place, you also need to create a container:
  4. DATA: container TYPE REF TO cl_gui_custom_container.

    CREATE OBJECT container
           EXPORTING container_name = 'CONTAINER'.

  5. Call the method init_control.
    You have now created the central object for Desktop Office Integration and the connection to the relevant GUI control.
  6. CALL METHOD control->init_control

         EXPORTING r3_application_name = 'Demo Document Container'

                   inplace_enabled = 'X'

                   parent = container

         IMPORTING retcode = retcode.

  7. Create an instance document for each document that you want to open:
  8. CALL METHOD control->get_document_proxy

         EXPORTING document_type = document_type

                   document_format = document_format

         IMPORTING document_proxy = document

                   retcode = retcode.

  9. Create the instance for data transfer (Link Server: method get_link_server; Table Collection: method get_table_collection) (optional).
  10. 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, ...)
  2. Closing

  3. When you have finished editing a document, close it, save it, and release the memory area.
  4. When you no longer need the link server, close it and release the memory area (optional).
  5. Destroy the container instance (see item 6):
  6. CALL METHOD container->free.

  7. 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.

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.

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