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.
-
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.
-
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.
-
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
-
Create instance control.
CALL METHOD c_oi_container_control_creator=>get_container_control IMPORTING control = control retcode = retcode.
-
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'.
-
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.
-
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.
-
Create the instance for data transfer (Link Server: Method get_link_server; Table Collection: method get_table_collection) (optional).
-
Create any application-specific interfaces:
Processing
-
Define the processing steps for your documents (open, close, save, ...)
Closing
-
When you have finished editing a document, close it, save it, and release the memory area.
-
When you no longer need the link server, close it and release the memory area (optional).
-
Destroy the container instance (see item 6):
CALL METHOD container->free.
-
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.