Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Creating Objects →  CREATE OBJECT 

CREATE OBJECT - parameter_list

Short Reference

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 parameters p1 p2 ... of the instance constructor of the instantiated class using the type-specific actual parameters a1 a2 .... You have the option of specifying the optional input parameters. As with normal method calls, either data objects or functions and expressions can be declared as actual parameters. 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.
  • You can use the addition EXCEPTIONS to assign return values to non-class-based exceptions exc1 exc2....

The syntax and meaning are the same as those that apply to the parameter list of the CALL METHOD statement.


Example

The following example illustrates how a dialog box of the Control Framework (CFW) is generated 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.