Types of SAP ABAP Data Types Leeaning
In SAP ABAP programming, we need to use various variables to store various information. Variables are nothing but memory locations that are ordered to store values. This means that when you create a variable you reserve some space in memory. You might want to store information from various types of data such as characters, integers, floating points, etc. Based on the type of data from a variable, the operating system allocates memory and decides what can be stored in ordered memory.
The following are the basic data types that are often used:
Baca Juga: Tutorial Lengkap SAP ABAP
The following table shows the data type, how much memory is needed to store the value in memory, and the minimum and maximum values that can be stored in the variable types above
Example:
In this example, we have a character string type C with a predetermined length of 40. STRING is a data type that can be used for character strings of variable length (text strings). The STRING data object type in general must be used for content such as characters whose length is still not important.
Complex and Reference Types
complex types are classified into Structure types and Table types. In structure types, basic types and structures (ie structures embedded in structures) are grouped together.
Dasar Tipe Data
The following are the basic data types that are often used:
Type | Keyword |
---|---|
Byte field | X |
Text field | C |
Integer | I |
Floating point | F |
Packed number | P |
Text string | STRING |
Baca Juga: Tutorial Lengkap SAP ABAP
The following table shows the data type, how much memory is needed to store the value in memory, and the minimum and maximum values that can be stored in the variable types above
Type | Typical Length | Typical Range |
---|---|---|
X | 1 byte | Any byte values (00 to FF) |
C | 1 character | 1 to 65535 |
N (numeric text filed) | 1 character | 1 to 65535 |
D (character-like date) | 8 characters | 8 characters |
T (character-like time) | 6 characters | 6 characters |
I | 4 bytes | -2147483648 to 2147483647 |
F | 8 bytes | 2.2250738585072014E-308 sd 1.7976931348623157E+308 positive atau negative |
P | 8 bytes | [-10^(2len -1) +1] to [+10^(2len -1) 1] (dimana len = fixed length) |
STRING | Variable | Any alphanumeric characters |
XSTRING (byte string) | Variable | Any byte values (00 to FF) |
1
2
3
4
5
6
7
8
9
10
11
12
| REPORT YR_SEP_12. DATA text_line TYPE C LENGTH 40. text_line = 'A Chapter on Data Types' . Write text_line. DATA text_string TYPE STRING. text_string = 'A Program in ABAP' . Write / text_string. DATA d_date TYPE D. d_date = SY-DATUM. Write / d_date. |
In this example, we have a character string type C with a predetermined length of 40. STRING is a data type that can be used for character strings of variable length (text strings). The STRING data object type in general must be used for content such as characters whose length is still not important.
1
2
3
4
| A Chapter on Data Types A Program in ABAP (tanggal pada saat kode dibuat ”DDMMYYYY”)<span style= "font-family: "times new roman";" ><span style= "white-space: normal;" > </span></span> |
complex types are classified into Structure types and Table types. In structure types, basic types and structures (ie structures embedded in structures) are grouped together.
- Line or row type - Internal table rows can be basic, complex or reference types.
- Key - Specifies a field or group of fields as internal table keys that identify table rows
- Access method - Explains how the ABAP program accesses individual table entries.