CREATE OBJECT
Use
The ABAP keyword CREATE OBJECT generates an object of the class obj class.
|
Basic Form |
CREATE OBJECT obj class |
|
Addition |
LANGUAGE langu |
To address an OLE automation server (such as Microsoft Excel) from ABAP, the server must be registered with the SAP system.
The CREATE statement generates the initial object of this class and this can be processed further with the related keywords. The return value SY-SUBRC indicates the result of the generation. It can have the following values:
-
SY-SUBRC = 0:
Object successfully created.
-
SY-SUBRC = 1:
SAP GUI communication error.
-
SY-SUBRC = 2:
Error when calling function in SAP GUI. The front-end ports of SAP's OLE implementation modules are implemented only under Microsoft Windows and Apple Macintosh.
-
SY-SUBRC = 3:
The OLE-API call resulted in an error - possibly a storage space problem.
-
SY-SUBRC = 4:
The object is not registered with SAP.
Extras
The addition LANGUAGE determines the language chosen for method and attribute names of the object class. If you do not specify a language, English is used as the default.
CREATE OBJECT belongs to a group of key words that allows you to process external objects with ABAP. At present, only the object model OLE2 is supported. All objects to be processed must therefore be of type OLE2_OBJECT. This type and other necessary data are defined in the INCLUDE module OLE2INCL.
To generate an EXCEL object:
INCLUDE OLE2INCL.
DATA EXCEL TYPE OLE2_OBJECT.
CREATE OBJECT EXCEL 'Excel.Application'.