ABAP Keyword Documentation → ABAP − Reference → Creating Objects and Values → CREATE OBJECT
CREATE OBJECT - parameter_list
Other versions: 7.31 | 7.40 | 7.54
Syntax
... [EXPORTING p1 = a1 p2 = a2 ...]
[EXCEPTIONS exc1 = n1 exc2 = n2 ... [OTHERS = n_others]].
Effect
The additions EXPORTING
and EXCEPTIONS
are used
to pass actual parameters to the instance constructor statically or to assign return values to non-class-based exceptions.
-
When using the addition
EXPORTING
, the non-optional input parameters p1 p2 ... of the instance constructor of the instantiated class must be specified using the type-friendly actual parametersa1 a2 ...
(the other input parameters are optional). As in regular method calls,a1
,a2
, ... are general expression positions. In other words, functions and expressions can be passed as actual parameters, alongside data objects. Special rules apply in this case. If a subclass does not have an instance constructor implemented explicitly, the interface of the instance constructor from the next-highest superclass that explicitly implements the instance constructor is used. -
The addition
EXCEPTIONS
can be used to assign return values to non-class-based exceptionsexc1 exc2...
The syntax and semantics are the same as in the parameter list for static method calls.
Example
Creates a Control Framework (CFW) dialog box and passes input parameters to the instance constructor
of the global class CL_GUI_DIALOGBOX_CONTAINER. The class is defined implicitly using the static type of the reference variable dialog_box
.
DATA dialog_box TYPE REF TO cl_gui_dialogbox_container.
CREATE OBJECT dialog_box
EXPORTING parent = cl_gui_container=>desktop
width = 1000
height = 350.