TYPES - TYPE, LIKE
Short Reference
ABAP Syntax_2 TYPES dtype { {TYPE [LINE OF] type}
| {LIKE [LINE OF] dobj} }.
ABAP_ADDITION:
... LINE OF ...
What does it do? If a data type type or a data object dobj
is specified, dtype assumes all the properties of the specified
data type or data object.
type can be a non-generic type from ABAP Dictionary, allowed by
the package check, including in particular the structure of a database t
able, or it can be a public type from a global class allowed by the
package check, or a non-generic data type of the same program that has
already been defined by TYPES .
A data object that is visible at
this point can be specified for
dobj . If a field symbol or formal parameter is specified for
dobj , the symbol or parameter must be fully
typed . The declared type is inherited. The evaluation of the
statement does not require a data object to be bound.
If a reference is made to a data type in ABAP Dictionary, its primary
components are converted to predefined ABAP types according to the table
of predefined types in ABAP
Dictionary .
Latest notes: You can use LIKE to refer to data objects, and also
to the public attributes of global classes.
A data type that is declared by a direct TYPE or LIKE
reference to a boxed component
is assigned its data type but is not a boxed component .
ABAP_ADDITION ... LINE OF ...
What does it do? The optional addition LINE OF can be used if
type is a table type or if dobj is an internal table. If this
addition is used, dtype inherits the properties of the line type
of the internal table.
Example ABAP Coding These TYPES statements define two data types
local to the program. The first assumes a table type from a
type group of ABAP Dictionary, and the
second corresponds to the line type of this table type.
DATA: event_table TYPE cntl_simple_events,
event LIKE LINE OF event_table.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved