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 codes to non-class-based exceptions.
-
When using the addition
EXPORTING, you must specify the non-optional input parametersp1 p2 ...of the instance constructor of the instantiated class using the type-specific actual parametersa1 a2 .... You have the option of specifying the optional input parameters. 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
EXCEPTIONScan 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
The following example illustrates how a dialog box of the Control Framework (CFW) is created and how
input parameters are passed 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.