SAP Document Container

Use

This instance for centrally managing the Desktop Office integration is defined with reference to the interface i_oi_container_control.

Interface i_oi_container_control has methods that you can call for the instance. You use these methods to create additional instances that you need for Desktop Office Integration.

When you program office applications to start in the SAP GUI window, 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 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

  1. Create 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 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 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:

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.