Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Creating Objects and Values →  CREATE DATA 

CREATE DATA - TYPE, LIKE

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


CREATE DATA dref [area_handle] 
                 { {TYPE [LINE OF] {type|(name)}}
                 | {LIKE [LINE OF] dobj} }.

Effect

The type of the new data object is defined by the specified type or data object.

  • type can be any data type from ABAP Dictionary, in particular the structure of a database table, a classic view, or a CDS entity of a CDS view, a public data type of a global class, or any data type of the same program that is already been defined with TYPES and that is either more specific than or identical to the static type of dref. Alternatively, a character-like data object name can be specified in parentheses that contains the name of the existing data type when the statement is executed. This is not case-sensitive. The name in name can also be an absolute type name. If a standard table type with a generic primary table key is specified after TYPE, a new bound table type with standard key is created and used.
  • A data object that is visible at this point can be specified for dobj. The new data object inherits the current data type. If dobj is specified as a formal parameter or field symbol, it can be fully or partially generic. When the statement CREATE DATA is executed, a data object must be bound to a generically typed field symbol or parameter and the type of the data object is used. In the case of a fully typed field symbol or parameter, the declared type is used. A data object does not have to be bound.

The optional addition LINE OF can be used if type or the name in name is a table type, or if dobj is an internal table. As a result, the new data object inherits the attributes of the row type of the internal table.


Notes


Continue

Creating Structured Data Objects - Example