In the previous unit of this course it was shown how to use dictionary objects of type Database Table to define tables on the database. It was also shown how Data Elements are used to specify the technical and semantical properties of table fields. Finally, a dictionary object of type Structure was created and included into the field list of a database table.
All three dictionary object types, Data Element, Database Table, and Structure, can also serve as data types for variables, method parameters, and so on.
Dictionary objects of type Table Type are not related to the definition of database tables. Their only purpose is to be used as data types in ABAP coding.
The nature of the data types are rather obvious. A Data Element is a scalar type, a Structure is a structure type and a Table Type is the type of an internal table. The only surprise might be nature of Database Tables.When used as data types, database tables are structure types. Avoid using database tables directly as data types.
In the past, ABAP developers often used dictionary objects as data types. This was mainly because there were no real alternatives for global data types, that is data types that are available in any ABAP code within the system. This changed when it became possible to define types in global classes and interfaces. The public types of a global class and types in interfaces have the same visibility as dictionary types. They also have an advantage: Types in classes and interfaces come with the context of the class or the interface. Dictionary types only have the package they belong to.