Ansicht
Dokumentation

ABAPCREATE_OBJECT_EXPLICIT - CREATE OBJECT EXPLICIT

ABAPCREATE_OBJECT_EXPLICIT - CREATE OBJECT EXPLICIT

ROGBILLS - Synchronize billing plans   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

CREATE OBJECT, TYPE

Short Reference



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


Effect

Creation of an instance of an explicitly specified class. A concrete class that is more specific than or identical to the static type of the object reference variable oref can be specified. The reference variable oref can be a class reference variable or an interface reference variable. The name of the class can be specified as follows:

  • class
Direct static specification as class.
  • (name)
Specification as the content of a character-like data object name. The data object name must contain the name of the class in uppercase letters when the statement is executed. The class name in name can also be an absolute type name. The following can be specified for name:
  • Literal or constant

If the data object name is specified as a character literal or as a constant, it can be evaluated statically and the specified class is recognized as the used object.
  • Variable

If the data object name is specified as a variable, it is specified only dynamically and the content is not evaluated statically.
When the statement is executed, name is not evaluated until runtime (in both cases).

The class must be usable at the current position:

  • The addition CREATE of the class definition must allow objects to be created.
  • The package check must allow an object of a global class to be created.

Notes

Example

Creation of an instance of a class cls 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. Components must be accessed dynamically or a cast must be performed as shown here.






General Material Data   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 4298 Date: 20240328 Time: 194107     sap01-206 ( 51 ms )