ABAPCREATE_OBJECT_OLE2 - CREATE OBJECT OLE2
Vendor Master (General Section) PERFORM Short ReferenceThis documentation is copyright by SAP AG.
CREATE OBJECT - OLE
Syntax
CREATE OBJECT ole class [NO FLUSH] [QUEUE-ONLY].
Additions 1. ... NO FLUSH 2. ... QUEUE-ONLY
Effect
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 the ABAP Dictionary in thetype groupOLE2. 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 tableTOLE contains the value "X" for the class. The authorization status can be checked with the function moduleAUTHORITY_CHECK_OLE.
Note
For the declaration of ole, exactly the type ole2_object must be specified. It is not sufficient to specify another type declared with a reference to ole2_object.
System Fields
| sy-subrc | Meaning |
| 0 | Automation object is created. |
| 1 | Communication to SAP GUI with errors. |
| 2 | Function call in SAP GUI with errors. |
| 3 | Problems with memory allocation on the presentation server. |
Note
An automation object ole created using CREATE OBJECT ole must also be released by using FREE OBJECT ole to avoid memory bottle necks and terminations of the application to be controlled.
Addition 1
... NO FLUSH
Effect
When using the addition NO FLUSH, calls from automation methods are collected in the automationbuffer 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 ofscreen.They are then transferred to the automation server on the current presentation server for asynchronousexecution. Without this addition, the flush is executed and the transfer takes place as soon as a statementthat does not belong to the automation command set is reached. Note that in the ABAP Debugger, the returnvalues of the individual automation statements are not available until after the transfer to the presentation server.
Addition 2
... QUEUE-ONLY
Effect
The effect of the addition QUEUE-ONLY is that during the flush, the created object is not transferredas 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 CREATE OBJECT, CALL METHOD,and GET PROPERTY using the addition QUEUE-ONLY. When executing the program in the ABAP Debugger, the return values are passed by default.
Example
In this example, the automation object app is created, which has access to all methods and attributesof the class APPLICATION in the MS Excel Library. 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.
PERFORM Short Reference Addresses (Business Address Services)
This documentation is copyright by SAP AG.
Length: 4504 Date: 20120522 Time: 042758 triton ( 220 ms )






