sapdev logo background
sapdev logo sapdev logo
Comments

ABAP CREATE OBJECT EXPLICIT Statement syntax, information and example SAP source code



Return to Statement index



CREATE OBJECT - TYPE

Short Reference

ABAP Syntax_2 CREATE OBJECT oref [
area_handle ]
TYPE { class [
parameter_list ] }
| { (name) [
parameter_list | parameter_tables
] }.

What does it do? For class , any concrete
class that is more specific than or identical to the static type of the object reference variable oref can be specified. oref can be a class reference variable or an interface reference variable. An instance of the specified class class is created.
As an alternative to being specified directly, name can be used to specify a character-like data object that contains the class name in uppercase letters when the statement is executed. The class name in
name can also be an absolute type name .
Latest notes: If the class is specified dynamically, the parameters can either be specified statically in
parameter_list or dynamically in parameter_tables .
When a class is used, the instance operator NEW acts like the statement CREATE OBJECT oref TYPE class and can be used in general expression positions . See Dynamic Calls .

Example ABAP Coding Creates an instance of a class c1 using an explicit reference to the class. The static type of the reference variable is the root class object and is therefore more general than any other class.
CLASS c1 DEFINITION.
...
ENDCLASS.

...

DATA oref TYPE REF TO object.

...

CREATE OBJECT oref TYPE c1.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




CREATE_OBJECT_AREA_HANDLE
CREATE_OBJECT_IMPLICIT




comments powered by Disqus