SAP® Documentation

Single view

ABAPDATA_REFERRING - DATA REFERRING

ABAP Short Reference   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

DATA - TYPE, LIKE

Short Reference



Syntax

DATA var ${ ${TYPE $[LINE OF$] type$}
         $| ${LIKE $[LINE OF$] dobj$} $}
         $[VALUE  val$|${IS INITIAL$}$]
         $[READ-ONLY$].

Effect

When a type data type or a dobj data object is specified, the data type of variable var is already fully defined before the declaration. The syntax and meaning of the additions TYPE and LIKE are exactly the same as the definition of the data types with TYPES, except for the following:

  • In the case of DATA, a table type can be specified after TYPE that is generic with respect to its secondary table key (thanks to the addition WITH FURTHER SECONDARY KEYS). This type attribute is not relevant for the declared data object.

If TYPE and LIKE are not specified, a data object with the bound data type c of length 1 is created.

Notes

  • For internal tables, the declaration of the primary table key as a standard key can be critical for various reasons. It is best to define the key fields explicitly instead. In the statement above, therefore, check whether a table with standard key is created by mistake if using a generic standard table type.
  • If an enumerated type is specified after TYPE or a data object with this type is specified after LIKE, an enumerated variable is created.

Example

Uses the TYPE addition to declare a work area for a SELECT statement. Uses the LIKE addition to declare a further data objects of the same type.

DATA wa TYPE scarr.
SELECT SINGLE *
       FROM scarr
       WHERE carrid = 'BA'
       INTO @wa.

DATA buffer LIKE wa.
buffer = wa.








Vendor Master (General Section)   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 3853 Date: 20191018 Time: 054733     sap01-206 ( 26 ms )

Our Service

Looking for Support? Questions?

The

Consolut

Callback-Service

Leave us your contact details and we will call you back. Panels marked with * are mandatory.