Bilal Saleem
Bilal Saleem

Reputation: 633

Typing field-symbols with ANY or DATA

I'm currently learning ABAP and wanted to know what is the difference between the following ways of defining a field symbol?

Method 1

FIELD-SYMBOLS <fs> TYPE data.

Method 2

FIELD-SYMBOLS <fs> TYPE any.

I understand that both are typed generically and that the data type will be assigned at runtime. What I don't understand is how the two are different (or if they are at all).

Upvotes: 3

Views: 2897

Answers (1)

Sandra Rossi
Sandra Rossi

Reputation: 13636

Yes TYPE ANY and TYPE DATA are exactly the same. Excerpt from ABAP documentation, Generic ABAP types :

The generic type any can, like all generic types listed here except data and object, only be specified directly after TYPE and has exactly the same effect there as the generic type data. After TYPE REF TO, only data (for fully generic data reference variables) and object (for fully generic object reference variables) can be specified. Specifying REF TO any would define a fully generic reference variable covering data references and object references. This is not currently possible.

Upvotes: 2

Related Questions