CREATE OBJECT

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. You can use transaction SOLE (more information: Registering External Applications in an ABAP System ) to assign an automation server to a class.

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 generated.

  • SY-SUBRC = 1:

    SAP GUI communication error.

  • SY-SUBRC = 2:

    SAP GUI function call error. 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.

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 is part of a group of keywords that you can use to process external objects in 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.

More information:

SET PROPERTY , GET PROPERTY , CALL METHOD , and FREE OBJECT .