GET

Basic form 6

GET PROPERTY OF obj p = f.

Addition:

1. ... NO FLUSH
2. ... QUEUE-ONLY

Effect

Transfers attribute p of object obj to field f.
Object obj must be of type OLE2_OBJECT.

Normally, all consecutive OLE statements are buffered by the ABAP processor and sent to the presentation server in bundled form. This means that it is possible for a statement to refer to the results of preceding statements.
In debugging, however, you should remember that the values of the return parameters cannot be displayed until directly before execution of the first ABAP statement external to OLE.
Even a command which refers to an object not yet generated by any OLE statement terminates the bundling.

The return code value of SY-SUBRC indicates whether all the bundled commands have been successfully executed.

The Return Code is set as follows:

SY-SUBRC = 0:
All commands were successfully executed.
SY-SUBRC = 1:
When communicating with the presentation
server, a system error occurred. The system
field SY-MSGLI contains a short
description of the error.
SY-SUBRC = 2:
A method call resulted in an error.
SY-SUBRC = 3:
Setting a property resulted in an error.
SY-SUBRC = 4:
Reading a property resulted in an error.

In the last 3 cases, a dialog box containing an error note is displayed on the presentation server.
GET PROPERTY belongs to a group of key words that allows you to process external objects with ABAP/4. At present, only the object model OLE2 is supported, i.e. all objects must be of type OLE2_OBJECT. This type and other necessary data are defined in the include program OLE2INCL.

Addition_1

... NO FLUSH

The addition NO FLUSH continues the collection process, even if the next command is not an OLE statement. This means that you can set a series of properties in a loop and download them to the presentation server in a single transport operation.
If you do not use NO FLUSH, you must ensure that you do not rely on the contents of return parameters not yet filled.
Also, all objects must be initialized in a bundle, i.e. they must be generated by an OLE call that has already been executed.
Every FREE statement always causes a download of the buffer.

Addition 2

... QUEUE-ONLY

Effect

Ensures that, when GET PROPERTY is called, the return is used only by subsequent automation commands within the queue, under certain conditions. If these conditions are met, it is not then returned to the appropriate ABAP variable:

1.) If the queue contains only CREATE OBJECT, CALL METHOD, and GET PROPERTY calls with return codes and the QUEUE-ONLY addition.

2.) If the flush mode in the Debugger is deactivated.

Even if developers use this addition, they still need to call FREE OBJECT to destroy frontend objects returned by GET PROPERTY again. Otherwise, bottlenecks in memory may occur or the controlling application may abort.

Example

Read the 'Visible' Property of an Excel Worksheet.

TYPE-POOLS OLE2.
DATA: EXCEL   TYPE OLE2_OBJECT,
      VISIBLE TYPE I.
CREATE OBJECT EXCEL 'Excel.Application'.
GET PROPERTY OF EXCEL 'Visible' = VISIBLE.

Related

SET PROPERTY
CALL METHOD
CREATE OBJECT
FREE OBJECT