SAP ABAP Data types

ABAP Data types are defined as the users view on the data, i.e.  it is the data format at user interface. The data format is based on the type of database is using.

SAP ABAP uses various data types in the work areas for data, the different data types are as follows.

Types of data types

  1. Elementary data types
  2. Complex data types
  3. Reference data types
ADVERTISEMENT

Elementary data types : – Elementary data types are further categorize into two types

  • Fixed Length
  • Variable Length

Fixed Length

KeywordData TypeExample
CText field“Hello World”
NNumeric00500
DDate“20171201”
TTime“233010”
PPacked Number200.50
IInteger500
FFloat point number4e5

Variable Length

KeywordType
STRINGCharacter Sequence
XSTRINGByte Sequence

Pre-defined elementary ABAP data types

SAP delivers predefined data types with length and templates, where the field length is defined in bytes.

Data TypeInt. field lengthValid field lengthInitial valueDescription
 Character Types
C11 – 65535‘….’It is a text field for alphanumeric characters
 N 1 1 – 65535 ‘0 … 0’ Numerical text field for only numeric characters
D 88 ‘00000000’ Date field allows in format YYYYMMDD
 T 66 ‘000000’ Time field allows in format HHMMSS
 Numeric Types
 I 440 For Integers (Whole numbers)
F 880 For floating point number
P 81 – 160 Packed decimal numbers

Important notes

  • Data type N is not a numeric type, type N objects con only contains numeric characters (0…….9), but they are not represented as internally as numbers.
  • The value range of data type I number is -2**31 to 2**31-1 and consists only whole numbers. Data type I (Integer) is used for the values of counters, number of items, indexes, etc.
  • Data type P allows digits after the decimal point. The number of decimal place is generic and is determined in the program. Type P can be used for distance,weights, etc.
  • The Non-numeric data types such as C (Text field), D(Data), N(Numeric), T (Time) are character types. Fields in this type are allowed to enter characters and it takes enough memory for coding.

Complex types : –  Complex types includes structures types and table types.

Reference Types : – Reference types includes data references and object references.