ABAP Data Types

Likes the most common languages, ABAP has a set of predefined or elementary types.  The developer can use these elementary types and create a wide range of data and types, even very complex ones.

In an ABAP program, the system accepts all data types defined in the ABAP Dictionary or in type-pools. The types can also be defined inside the program; in this case, that particular type will be only acceptable within that program.

ABAP Primary Types include: Numeric (I for integers, F for floating point), Packed (P), Character (C for simple characters, N for strings that can be used in computation), Hexadeximal (X) and Date fields (D) and Time fields (T). Date and Time fields have dual behaviour: in input or output context the behave like strings; in computation, like numeric integers. In this way, calculation of dates and time becomes very easy and natural.

Overview of predefined data and types

ABAP data and types

Before you can use a variable it must be declared. To declare a variable in ABAP you must indicate: name, type, length (if applicable), additional modifiers (for example, the number of decimals for type P) and you may also declare an initial value:

* Primitive Types
DATA:   counter	TYPE i,
	accum   TYPE i,
        factor(2) TYPE p DECIMALS 2,
	name(20)	 TYPE c.

* Dictionary Data
DATA:	country	 TYPE country.

* Internal Tables
DATA: t_flishts TYPE STANDARD TABLES OF flightinfo.

* Objects
DATA:	booking TYPE REF TO cl_flt_booking.