Create... - kazumov/abap GitHub Wiki

Create ...

create ...
   |
   +- create object ...
   |    |
   |    +- defining class implicitly
   |    |
   |    +- defining class explicitly 
   |    
   +- create data ...
        |
        +- defining the data type implicitly
        |  
        +- defining the data type using predefined ABAP types
        |
        +- defining the data type using an existing type 
        |
        +- creating data with reference to a type description object
        |
        +- creating reference variables
        |
        +- creating internal tables

Create Object

Defining Class Implicitly

create object oref [area_handle] [parameter_list].

Example:

class c1 definition.
...
endclass.
...
data oref type ref to c1.
...
create object oref.

Example with area_handle.

Example with parameter_list.

Defining Class Explicitly

create object oref [area_handle] type class [parameter_list].

Example:

class c1 definition. 
  ... 
endclass. 
  ... 
data oref type ref to object. " generic object as a type of object
  ... 
create object oref type c1.   " strict type defined 

create object oref [area_handle] type (name) [parameter_list].

create object oref [area_handle] type (name) [parameter_tables].

Example with parameter_tables.

Shortcut instance operator new:

new oref. is equivalent to create object oref type class.

Create Data

Main article: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcreate_data.htm