# ABAP Basics
In this section, we'll delve into the fundamental building blocks of ABAP (Advanced Business Application Programming), covering ABAP data types, variables and constants, operators, and control structures.
## ABAP Data Types
ABAP provides a rich set of data types to work with different kinds of data. These data types can be categorized into the following main groups:
1. Elementary Data Types: These are the basic data types used to store single values. Some common elementary data types include:
2. Structured Data Types: These data types allow you to work with complex structures. Examples include:
3. Reference Types: Reference types are used for creating references to data objects. The primary reference type is `DATA`.
4. Object-Oriented Types: If you're working with object-oriented programming in ABAP, you'll use types like `CLASS` and `INTERFACE` to define classes and interfaces.
## Variables and Constants
In ABAP, you can declare variables and constants to store and manipulate data. Here's how you declare and use them:
### Variables
```abap DATA: lv_integer TYPE i, “ Declaration with a type
lv_string TYPE string, " Declaration with a predefined data type lv_custom TYPE zcustom. " Declaration with a user-defined type (e.g., a structure)
```
### Constants
```abap CONSTANTS: c_max_attempts TYPE i VALUE 3, ” Constant with a value
c_message TYPE string VALUE 'Hello'. " Constant with a string value
```
## Operators and Expressions
ABAP supports various operators for performing operations on data. These include:
1. Arithmetic Operators:
```abap DO n TIMES.
" Code to execute n times
ENDDO.
WHILE condition.
" Code to execute while condition is true
ENDWHILE.
LOOP AT internal_table INTO work_area.
" Code to iterate through an internal table
ENDLOOP. ```
These control structures help you control the flow of your ABAP programs, make decisions, and iterate over data structures like internal tables.
In this section, we've covered the foundational aspects of ABAP, including data types, variables, constants, operators, and control structures. These are essential building blocks for writing ABAP programs to interact with SAP systems and perform business logic.