CREATE OBJECT - OLE
CREATE OBJECT ole class [NO FLUSH] [QUEUE-ONLY].
This statement creates the automation object
ole of the automation class
class. The object
ole must be of type
ole2_object, which is defined in ABAP Dictionary in the
type group OLE2.
When specifying the automation class
class, a character-like data object is expected, which contains the name of the class.
The system automatically executes an authorization check if the column AUTH_CHK in the database table TOLE contains the value "X" for the class. The authorization status can be checked with the function module AUTHORITY_CHECK_OLE.
|0||Automation object created.|
|1||Error in communication to the SAP GUI|
|2||Error in function call in the SAP GUI|
|3||Problems with memory allocation on the presentation server.|
For the declaration of
ole, exactly the type
ole2_objectmust be specified. It is not sufficient to specify another type declared with a reference to
An automation object
olecreated using CREATE OBJECT ole must also be released by using
FREE OBJECT oleto avoid memory bottle necks and terminations of the application to be controlled.
CREATE OBJECTfor OLE should not be confused with the statement of the same name in ABAP Objects.
... NO FLUSH
When using the addition
NO FLUSH, calls from automation methods are collected
in the automation buffer until the function module FLUSH (which is provided for this purpose) is called and the
FREE OBJECT statement is passed or, at the most, until a change of
screen. They are then passed
to the automation server on the current presentation server for asynchronous execution. Without this
addition, the flush is executed and the pass takes place as soon as a statement that does not belong
to the automation command set is reached. Note that in the ABAP Debugger, the return values of the individual automation statements are not available until after the pass to the presentation server.
The effect of the addition
QUEUE-ONLY is that during the flush, the created
object is not passed as a return value using methods called by
CALL METHOD OF
to the specified ABAP data object
rc. In this case, the automation buffer
can only contain the statements
GET PROPERTY using the addition
QUEUE-ONLY. When executing the program in the ABAP Debugger, the return values are passed by default.
In this example, the automation object
app is created, which has access to
all methods and attributes of the class APPLICATION in the MS ExcelLibrary. This class contains methods with which, for example, an Excel document can be opened or copied.
DATA app TYPE ole2_object. CREATE OBJECT app 'Excel.Application' NO FLUSH.