---
description: ABAP stands for - Advanced Business Application Programming.It is a programming language for developing applications for the SAP R/3 system. The latest version of ABAP is called ABA
title: Introduction to ABAP: Datatypes, Operators &#038; Editor &#8211; Tutorial
image: https://www.guru99.com/images/introduction-to-sap-abap.png
---

 

[Skip to content](#main) 

**⚡ Smart Summary**

Introduction to ABAP covers the language SAP created for building applications on the R/3 system. This resource explains the data types, the operators, the control statements, the internal table, and the SE38 editor where every ABAP program begins.

* 🔤 **Declaration Syntax:** DATA variable\_name TYPE variable\_type declares every variable in ABAP.
* 🔢 **Data Types:** I, F and P hold numbers; C, D, N and T hold characters; X holds hexadecimal data.
* ➗ **Operators:** Arithmetic operators change values, while logical operators such as EQ, NE, GT and LT drive decisions.
* 🔁 **Control Statements:** IF, CASE, WHILE and DO determine which lines of a program actually run.
* 📋 **Internal Tables:** An internal table holds multiple rows in memory and is the workhorse of every ABAP report.
* 🖥️ **Editor:** Transaction SE38 is the ABAP Editor, where programs are written, checked and executed.

[ Read More ](javascript:void%280%29;) 

![Introduction to SAP ABAP](https://www.guru99.com/images/introduction-to-sap-abap.png)

## What is ABAP?

ABAP stands for Advanced Business Application Programming. It is a programming language for developing applications for the SAP R/3 system.

The latest version of ABAP is called ABAP Objects and supports object-oriented programming. SAP will run applications written using ABAP/4, the earlier ABAP version, as well as applications using ABAP Objects.

This introduction does not attempt to document every [ABAP language](https://www.guru99.com/what-is-abap.html) construct. It introduces the key concepts quickly, so that you can start writing working programs and then move on to the more advanced topics.

## Data Types

Every ABAP program starts by declaring the data it will work with.

Syntax to declare a variable in ABAP –

DATA Variable_Name TYPE Variable_Type.

Example:

DATA employee_number TYPE I.

The following is a list of data types supported by ABAP.

| 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                       |

The eight types above are the classic fixed-length types. ABAP also offers two variable-length types that beginners meet almost immediately: **STRING** for text of any length, and **XSTRING** for binary data of any length.

## ABAP Operators

Once data is declared, operators are what change it and compare it.

### Assigning values

a = 16.
MOVE 16 TO a.
WRITE a TO b.

All three statements move a value. The equals sign is the modern form, while MOVE and WRITE TO are the older equivalents you will still meet in legacy programs.

### Arithmetic operations

COMPUTE a = a * 100.

ABAP also supports ADD, SUBTRACT, MULTIPLY and DIVIDE as standalone keywords, but the COMPUTE form shown above is the one used most often.

### Logical operators

Logical operators return true or false, and they are what every control statement in the next section tests. Each has a word form and a symbol form, and the two are interchangeable.

| Word form | Symbol form | Meaning                  |
| --------- | ----------- | ------------------------ |
| EQ        | \=          | Equal to                 |
| NE        | <>          | Not equal to             |
| GT        | \>          | Greater than             |
| GE        | \>=         | Greater than or equal to |
| LT        | <           | Less than                |
| LE        | <=          | Less than or equal to    |

## Control Statements

Control statements use the logical operators above to decide which lines of code run, and how often.

### IF … ENDIF

IF [NOT] exp [ AND / OR [NOT] exp ].
  ........
[ELSEIF exp.
  .......]
[ELSE.
  .......]
ENDIF.

### RELATED ARTICLES

* [SAP ABAP Data Dictionary (SE11) ](https://www.guru99.com/abap-data-dictionary-tutorial.html "SAP ABAP Data Dictionary (SE11)")
* [SAP Process On Value & Process On Help-Request ](https://www.guru99.com/process-on-value-help.html "SAP Process On Value & Process On Help-Request")
* [ALV Reports in SAP Tutorial – ABAP List Viewer ](https://www.guru99.com/alv-list-view-programming.html "ALV Reports in SAP Tutorial – ABAP List Viewer")
* [ALE, EDI & IDocs Introducion & Difference: SAP Tutorial ](https://www.guru99.com/what-is-edi-ale-and-idoc.html "ALE, EDI & IDocs Introducion & Difference: SAP Tutorial")

### CASE statement

CASE variable.
  WHEN value1.
    .........
  WHEN value2.
    .........
  [WHEN OTHERS.
    .........]
ENDCASE.

### WHILE loop

WHILE <logical expression>.
  .....
ENDWHILE.

### DO loop

DO <n> TIMES.
  .....
ENDDO.

A WHILE loop runs for as long as its condition holds. A DO loop runs a fixed number of times, or endlessly until an EXIT statement stops it.

## Internal Tables in ABAP

Single variables are rarely enough. Business programs read many rows at once, and the internal table is the structure that holds them in memory.

An internal table is a dynamic array. It has no fixed size, it lives only for the duration of the program, and it is the standard way to move rows between the database and the screen.

" Declare an internal table and a work area
DATA: lt_employees TYPE TABLE OF pa0001,
      ls_employee  TYPE pa0001.

" Fill it from the database
SELECT * FROM pa0001 INTO TABLE lt_employees UP TO 10 ROWS.

" Read it row by row
LOOP AT lt_employees INTO ls_employee.
  WRITE: / ls_employee-pernr, ls_employee-ename.
ENDLOOP.

The three operations above cover most day-to-day work: declare the table, fill it with a SELECT, then walk it with LOOP AT. APPEND adds a row, READ TABLE finds one, and DELETE removes rows that match a condition.

## ABAP/4 Editor

All the syntax above is typed into a single place.

Transaction **SE38** opens the ABAP Editor, where you will spend most of your time as a developer creating and modifying programs.

[](https://www.guru99.com/images/sap/2011/02/13.png)

_The ABAP/4 Editor, transaction SE38_

## How to Write Your First ABAP Program

The screen above is where the following steps take place. The sequence below produces a working report in a few minutes.

1. **Open the editor.** Enter transaction code **SE38** in the SAP GUI command field and press Enter.
2. **Name the program.** Type a name beginning with **Z** or **Y**, for example `ZHELLO_WORLD`. Those two letters are the customer namespace, and SAP guarantees it will never overwrite them during an upgrade.
3. **Create it.** Click **Create**, enter a short description, and choose **Executable program** as the type.
4. **Assign a package.** Choose **Local Object** for practice work. A local object stays in your system and needs no transport request.
5. **Write the code.**

REPORT zhello_world.

DATA employee_name TYPE string.
employee_name = 'Guru99'.

WRITE: / 'Hello, ABAP!',
       / 'Welcome', employee_name.

1. **Check the syntax.** Press **Ctrl + F2**. The status bar reports any error and the line that caused it.
2. **Activate the program.** Press **Ctrl + F3**. An inactive program cannot run.
3. **Execute.** Press **F8**. The output list opens and displays both WRITE lines.

The forward slash in the WRITE statement forces a new line. Removing it prints everything on one line, which is the first formatting habit most beginners pick up.

## Common ABAP Transaction Codes

A handful of transaction codes cover almost everything a new ABAP developer needs.

| Transaction | Purpose                                                                           |
| ----------- | --------------------------------------------------------------------------------- |
| SE38        | ABAP Editor. Create, edit, check and run programs.                                |
| SE80        | Object Navigator. A single workbench for programs, classes, packages and screens. |
| SE11        | ABAP Dictionary. Define and inspect database tables, data elements and domains.   |
| SE16N       | Data Browser. View the contents of any table without writing a SELECT.            |
| SE37        | Function Builder. Create and test function modules.                               |
| SE24        | Class Builder. Create global classes for ABAP Objects.                            |
| ST22        | Dump analysis. Read the runtime error when a program terminates.                  |

SE38 and SE11 are enough to build a first report. ST22 becomes the most valuable of the group the moment a program crashes.

## FAQs

🔠 Why must a custom ABAP program name start with Z or Y?

Z and Y form the customer namespace. SAP never ships objects with those prefixes, so an upgrade cannot overwrite your program. Names outside that namespace risk being replaced.

🆚 What is the difference between ABAP/4 and ABAP Objects?

ABAP/4 is the procedural version, built on reports and subroutines. ABAP Objects adds classes, interfaces and inheritance. Both run in the same system, so old and new code coexist.

💾 Should a variable be typed as P or F for currency amounts?

Use P, the packed type. It stores decimals exactly, which is what money requires. Type F is a floating point number and introduces rounding errors that make financial totals unreliable.

🤖 Can AI help a beginner learn ABAP faster?

Yes. An AI assistant can explain a dump, translate pseudocode into ABAP, and suggest a cleaner LOOP. Always run the syntax check, since generated code can reference tables your system lacks.

🧠 Is AI-generated ABAP safe to move into production?

Not without review. Generated code often ignores authorisation checks, performance rules and the ABAP Cloud released API list. Treat it as a first draft, then test it as you would any code.

#### Summarize this post with:

ChatGPT Perplexity Grok Google AI 

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.** 

##### Sign up for the newsletter

Subscribe for Free 

You have successfully subscribed.  
Please check your inbox. 

![AI-Newsletter]() Chosen by over **350,000+** professionals 

[Scroll to top ](#wrapper)Scroll to top 

× 

Toggle Menu Close 

Search for: 

Search

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/introduction-to-sap-abap.png","url":"https://www.guru99.com/images/introduction-to-sap-abap.png","width":"700","height":"250","caption":"Introduction to SAP ABAP","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/introduction-to-abap.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/abap-tutorial","name":"SAP - ABAP"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/introduction-to-abap.html","name":"Introduction to ABAP: Datatypes, Operators &#038; Editor &#8211; Tutorial"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/introduction-to-abap.html#webpage","url":"https://www.guru99.com/introduction-to-abap.html","name":"Introduction to ABAP: Datatypes, Operators &#038; Editor &#8211; Tutorial","dateModified":"2026-07-14T18:03:42+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/introduction-to-sap-abap.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/introduction-to-abap.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/sophia","name":"Sophia Mitchell","description":"I'm Sophia Mitchell, an expert in SAP ABAP, APO, and BODS, specializing in developing high-performance, scalable SAP applications.","url":"https://www.guru99.com/author/sophia","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/sophia-mitchell-author.png","url":"https://www.guru99.com/images/sophia-mitchell-author.png","caption":"Sophia Mitchell","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"SAP - ABAP","headline":"Introduction to ABAP: Datatypes, Operators &#038; Editor &#8211; Tutorial","description":"ABAP stands for - Advanced Business Application Programming.It is a programming language for developing applications for the SAP R/3 system. The latest version of ABAP is called ABA","keywords":"sap-abap, sap","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/sophia","name":"Sophia Mitchell"},"dateModified":"2026-07-14T18:03:42+05:30","image":{"@id":"https://www.guru99.com/images/introduction-to-sap-abap.png"},"copyrightYear":"2026","name":"Introduction to ABAP: Datatypes, Operators &#038; Editor &#8211; Tutorial","subjectOf":[{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"Why must a custom ABAP program name start with Z or Y?","acceptedAnswer":{"@type":"Answer","text":"Z and Y form the customer namespace. SAP never ships objects with those prefixes, so an upgrade cannot overwrite your program. Names outside that namespace risk being replaced."}},{"@type":"Question","name":"What is the difference between ABAP/4 and ABAP Objects?","acceptedAnswer":{"@type":"Answer","text":"ABAP/4 is the procedural version, built on reports and subroutines. ABAP Objects adds classes, interfaces and inheritance. Both run in the same system, so old and new code coexist."}},{"@type":"Question","name":"Should a variable be typed as P or F for currency amounts?","acceptedAnswer":{"@type":"Answer","text":"Use P, the packed type. It stores decimals exactly, which is what money requires. Type F is a floating point number and introduces rounding errors that make financial totals unreliable."}},{"@type":"Question","name":"Can AI help a beginner learn ABAP faster?","acceptedAnswer":{"@type":"Answer","text":"Yes. An AI assistant can explain a dump, translate pseudocode into ABAP, and suggest a cleaner LOOP. Always run the syntax check, since generated code can reference tables your system lacks."}},{"@type":"Question","name":"Is AI-generated ABAP safe to move into production?","acceptedAnswer":{"@type":"Answer","text":"Not without review. Generated code often ignores authorisation checks, performance rules and the ABAP Cloud released API list. Treat it as a first draft, then test it as you would any code."}}]}],"@id":"https://www.guru99.com/introduction-to-abap.html#schema-1144153","isPartOf":{"@id":"https://www.guru99.com/introduction-to-abap.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/introduction-to-abap.html#webpage"}}]}
```
