Data Types (2024)

All programming languages distinguish between various types of data with various uses, such as ….. type data for storing or displaying values and numerical data for calculations. The attributes in question are described using data types. You can define, for example, how data is stored in the repository, and how the ABAP statements work with the data.

Data types can be divided into elementary, reference, and complex types.

Elementary Types

These are data types of fixed or variable length that are not made up of other types.

The difference between variable length data types and fixed length data types is that the length and the memory space required by data objects of variable length data types can change dynamically during runtime, and that these data types cannot be defined irreversibly while the data object is being declared.

Predefined and User-Defined Elementary Data Types

You can also define your own elementary data types in ABAP using the TYPES statement. You base these on the predefined data types. This determines all of the technical attributes of the new data type. For example, you could define a data type P_2 with two decimal places, based on the predefined data type P. You could then use this new type in your data declarations.

Reference Types

Reference types are deep data types that describe reference variables, that is, data objects that contain references. A reference variable can be defined as a component of a complex data object such as a structure or internal table as well as a single field.

Complex Data Types

Complex data types are made up of other data types. A distinction is made here between structured types and table types.

Structures

The instances of structured types are known as structures, and are used in ABAP programs to group work areas that logically belong together. Since the individual elements within a structure can be of any type, and can also themselves be structures or internal tables, the possible uses of structures are very wide-ranging. For example, you can use a structure with elementary data types to display lines from a database table within a program. You can also use structures containing aggregated elements to include all of the attributes of a screen or control in a single data object.

The following terms are important when we talk about structures:

  • Nested and non-nested structures
  • Flat and deep structures

Nestedstructures are structures that in turn contain one or more other structures as components.

Flatstructures contain only elementary data types of fixed length (no internal tables, reference types, or strings). The term flat structure can apply regardless of whether the structure is nested or not. Nested structures are flat so long as none of the specified types is contained in any nesting level.

Any structure that contains at least one internal table, reference type, or string as a component (regardless of nesting) is known accordingly as a deep structure.

Only in the case of flat structures is the data content of the structure actually within the memory of the structure itself, while deep structures contain pointers to the data at the position of the deepest components. Since the field contents are not stored with the field descriptions in the case of deep structures, assignments, offset and length specifications and other operations are handled differently from flat structures.

Internal Tables

Internal tables consists of a series of lines that all have the same data type. Internal tables are characterized by:

  • Their line type
  • A table key that is used to identify table rows. The key can be unique or non-unique.
  • The table type that defines how ABAP will access individual table entries (non-sorted and sorted index tables and hash tables).

You should use internal tables whenever you need to use structured data within a program. One imprint use is to store data from the database within a program.

Examples for Complex Data Types

The following list contains examples of complex data types in ascending order of complexity:

  1. Structures consisting of a series of elementary data types of fixed length (non-nested, flat structures)
  2. An internal table whose line type is an elementary type (vector).
  3. Internal tables whose line type is a non-nested structure ('real' table)
  4. Structures with structures as components (nested structures, flat or deep)
  5. structures containing internal tables as components (deep structures)
  6. Internal tables whose line type contains further internal tables.

Data Types (1)

The graphic shows how elementary fields can be combined to form complex types.

Further Information about Data Types

- Definition and visibility of data types at various levels of the SAP system.

- Compatibility .

Data Types (2024)

FAQs

Data Types? ›

4 Types Of Data- Nominal, Ordinal, Discrete And Continuous.

What are the five data types? ›

Data types
  • String (or str or text). Used for a combination of any characters that appear on a keyboard, such as letters, numbers and symbols.
  • Character (or char). Used for single letters.
  • Integer (or int). Used for whole numbers.
  • Float (or Real). ...
  • Boolean (or bool).

What are 4 data types? ›

4 Types Of Data- Nominal, Ordinal, Discrete And Continuous.

What are the 3 basic data types? ›

Basic types: numbers, strings, and booleans.

What is meant by data type? ›

In software programming, data type refers to the type of value a variable has and what type of mathematical, relational or logical operations can be applied without causing an error.

What are the basic data types? ›

Basic Data Types
  • Integer.
  • Double or Real.
  • String.
  • Boolean.
  • Date/Time.
  • Object.
  • Variant.

What are the eight basic data types? ›

There are 8 Primitive data types in Java – Boolean, char, byte, int, short, long, float, and double. In this article, we'll cover the Jump Statements in Java, such as break, continue and return, along with examples and explanations. The below article covers the iteration statements or loops in Java.

What are the 4 main data types used in programming? ›

Most programming languages support various types of data, including integer, real, character or string, and Boolean.

What are the two main types of data? ›

There are two general types of data – quantitative and qualitative and both are equally important.

What are the four major data? ›

4 Types of Data: Nominal, Ordinal, Discrete, Continuous | upGrad blog.

What is the most basic data type? ›

The most common basic data types are int , double , char , and bool .

How many data types are? ›

Most modern computer languages recognize five basic categories of data types: Integral, Floating Point, Character, Character String, and composite types, with various specific subtypes defined within each broad category.

What is an example of a real data type? ›

A 'Real' data type is numerical data which contains decimal numbers. It would be used when extra detail is required and a whole number would not provide enough information. Examples of where a 'real' data type is used can be seen below: Weight in Kg.

What is the difference between type and data type? ›

The terms are sometimes mixed, but usually a "data type" refers to a type introduced using the data keyword, which has constructors you can pattern match on. These are also called algebraic data types". Just "type" is a more general term which also includes types created using newtype , function types and so on.

What are 5 most common data types and explain each of them with example? ›

Common data types include integers, floating-point numbers, booleans, characters, and strings. Appropriate data types enhance code accuracy, memory usage, type safety, and readability.

What are the 5 data types in C++? ›

In C++, there are five basic data types: int, float, char, bool, and double. Integers, floating-point numbers, characters, Boolean values, & double-precision floating-point numbers are each represented by one of these data types.

What are the five types of variables in a computer? ›

Constants, global variables, class variables, instance variables, and local variables.

Top Articles
Latest Posts
Article information

Author: Neely Ledner

Last Updated:

Views: 6321

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.