If you’re new to SAP ABAP and want to write clean, functional programs, mastering the core statements is your first milestone. In this post, we’ll walk through the 10 most essential ABAP commands every beginner should know with real code examples, practical tips, and visual aids to help you understand when and how to use them effectively.
1) ABAP Statement : DATA
DATA is used to declare variables in ABAP. You define the type and optionally assign a default value.
💻Code Example
DATA lv_name TYPE string.
lv_name = 'Sherlock Holmes'.
💡Tip:
Use DATA(...) =
for modern inline declarations
DATA(lv_age) = 30.
2) ABAP Statement : WRITE
Displays data on the screen (SAP list output). Used often in classical reports.
💻Code Example
WRITE: / 'Hello World!', lv_name.
💡Tip:
For modern UIs WRITE
is rarely used but for learning, it’s great to understand output basics.
3) ABAP Statement : SELECT
Retrieves data from database tables. It’s one of the most used statements.
💻Code Example
SELECT * FROM mara INTO TABLE @DATA(lt_mara) UP TO 10 ROWS.
💡Tip:
Avoid SELECT *
in productive code. Always prefer specifying fields for performance
4) ABAP Statement : LOOP AT
Used to iterate through internal tables (arrays).
💻Code Example
LOOP AT lt_mara INTO DATA(ls_mara).
WRITE: / ls_mara-matnr.
ENDLOOP.
💡Tip:
Use LOOP AT GROUP BY
for grouped logic (advanced)
5) ABAP Statement : IF / ELSEIF / ELSE / ENDIF
Conditional branching
💻Code Example
IF lv_age < 18.
WRITE: 'Minor'.
ELSEIF lv_age < 65.
WRITE: 'Adult'.
ELSE.
WRITE: 'Senior'.
ENDIF.
💡Tip:
Too many nested IF
s? Use CASE
for cleaner logic.
6) ABAP Statement : READ TABLE
Used to read a single line from an internal table.
💻Code Example
READ TABLE lt_mara INTO DATA(ls_mara) WITH KEY matnr = '12345'.
💡Tip:
With sorted tables, useBINARY SEARCH
for faster access.
7) ABAP Statement : CLEAR
Resets the value of a variable or structure.
💻Code Example
CLEAR lv_name
💡Tip:
You can also clear internal tables:
CLEAR lt_mara
8)ABAP Statement : APPEND
Adds a row to the end of an internal table.
💻Code Example
APPEND ls_mara TO lt_mara.
💡Tip:
Modern syntax:
APPEND VALUE #( matnr = '12345') TO lt_mara.
9) ABAP Statement : DELETE
Removes entries from internal tables.
💻Code Example
DELETE lt_mara WHERE matnr = '12345'
💡Tip:
Use DELETE ADJACENT DUPLICATES FROM
to remove duplicates
10) ABAP Statement : MOVE ( veya = ataması)
Used to assign values. Modern ABAP uses =
instead of MOVE
.
💻Code Example
lv_result = lv_value1 + lv_value2.
💡Tip:
Avoid using MOVE
modern code prefers the assignment operator.
These 10 ABAP statements form the foundation of most real-world SAP development tasks. If you’re just getting started, try to build a small project or mini-report using each of them. In future posts, we’ll explore more advanced ABAP features like OOP, dynamic programming , and integration with Fiori apps.