sapdev logo background
sapdev logo sapdev logo
Comments

ABAP CREATE DATA EXISTING Statement syntax, information and example SAP source code



Return to Statement index



CREATE DATA - TYPE, LIKE

Short Reference

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

What does it do? The type of the generated data object is defined by the specified type or data object.
type can be any data type from the ABAP Dictionary, in particular the structure of a database table, a public data type of a global class, or any data type of the same program that has already been defined with TYPES and that is either more specific than or identical to the static type of dref . Alternatively, you can specify a character-like data object name in parentheses which 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 generated and used.
A data object that is visible at this point can be specified for dobj . The generated data object inherits the current data type. If dobj is specified as a formal parameter or field symbol, it can be completely or partially generic. When the CREATE DATA statement is executed, a data object must be connected to a generically typed field symbol or parameter. The type of the data object is used. In the case of a completely typed field symbol or parameter, the declared type is used. A data object does not have to be connected.
You can use the optional addition LINE OF if type or the name in name is a table type, or if dobj is an internal table. As a result, the generated data object inherits the attributes of the row type of the internal table.

Latest notes: LIKE can be used to refer to data objects, and also to the public attributes of global classes.

If, in name , a type of another program is specified using an absolute type name , this program is loaded into a new additional program group or into the current
program group , depending on the program type (if not already loaded).

When a data type is used, the
instance operator NEW acts like the statement CREATE DATA dref TYPE type and can be used in general expression positions .

Example ABAP Coding See Creating Structured Data Objects .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




CREATE_DATA_BUILT_IN
CREATE_DATA_HANDLE




comments powered by Disqus