DATA TYPES IN ABAP

ABAP Variables are instances of data types. Variables are created during program execution and destroyed after program execution.

The various data types in ABAP are listed in table form below :




Data Type

Initial
field length

Valid
field length

Initial value

Meaning
Numeric types
I
4
4
0
Integer (whole number)
F
8
8
0
Floating point number
P
8
1 - 16
0
Packed number
Character types
C
1
1 - 65535
  …   '
Text field
(alphanumeric characters)
D
8
8
'00000000'
Date field
(Format: YYYYMMDD)
N
1
1 - 65535
'0 … 0'
Numeric text field
(numeric characters)
T
6
6
'000000'
Time field
(format: HHMMSS)
Hexadecimal type
X
1
1 - 65535
X'0 … 0'
Hexadecimal field


There are two predefined ABAP data types with variable length that are generically known as strings:
  • STRING for character strings


A string is a sequence of characters with variable length.The length of a string is the number of characters multiplied by the length required for the internal representation of a single character.
  • XSTRING for byte strings


A byte string is a hexadecimal type with variable length. It can contain any number of bytes. The length of a byte string is the same as the number of bytes.

EXAMPLE OF EACH DATA TYPE :

DATA : 
       name(12TYPE c ,  "character
       empno(5TYPE n ,  "numeric character
       salary   TYPE DECIMALS 2 ,  " packet decimal
       tdate    TYPE d ,    " date"
       time     TYPE t ,  " time"
       text     TYPE string . "string"

No comments:

Post a Comment