Learn SAP Free
Back to Dashboard
ABAP Programming

MOVE Statement in ABAP – How to Transfer Data Between Variables

Daksh | July 22, 2026 | 8 min read

MOVE Statement in ABAP

Once you know how to declare variables with the DATA statement, the next natural question is — how do I move data from one variable to another? That is where the MOVE statement comes in.

In real SAP projects, you are constantly transferring data. You pull a customer name from the database and put it into a local variable. You copy values from one structure to another before passing them to a function module. You move data from a work area into an internal table row. All of this involves transferring data between variables.

Now, ABAP gives you two ways to do this — the classic MOVE statement and the modern assignment operator (=). Both do the same thing, but you will see both styles in production code because older programs use MOVE and newer programs use the equals sign. You need to understand both.

This guide covers everything about data transfer in ABAP, from simple variable-to-variable moves to structure-level transfers using MOVE-CORRESPONDING.


What Does the MOVE Statement Do?

The MOVE statement copies the value from one variable (the source) into another variable (the target). After the move, both variables hold the same value, but they are still independent — changing one will not affect the other.

Think of it like copying a file on your computer. You have the original file and a copy. Editing the copy does not change the original.


Basic Syntax

Classic MOVE Syntax

MOVE source TO target.

Modern Assignment Syntax (Preferred)

target = source.

Both of these do exactly the same thing. The modern style is shorter and easier to read, so most developers prefer it today. But you will definitely see the classic MOVE syntax in legacy programs, so you need to recognize it.


Simple MOVE Examples

Example 1: Moving a String Value

REPORT z_move_basic.

DATA: lv_source TYPE string VALUE 'Hello ABAP',
      lv_target TYPE string.

MOVE lv_source TO lv_target.

WRITE: 'Source:', lv_source.
NEW-LINE.
WRITE: 'Target:', lv_target.

Output:

Source: Hello ABAP
Target: Hello ABAP

Simple enough. The value from lv_source is now also in lv_target.

Example 2: Same Thing Using the Equals Sign

REPORT z_move_modern.

DATA: lv_source TYPE string VALUE 'Hello ABAP',
      lv_target TYPE string.

lv_target = lv_source.

WRITE: 'Source:', lv_source.
NEW-LINE.
WRITE: 'Target:', lv_target.

Output:

Source: Hello ABAP
Target: Hello ABAP

Identical result. The = operator is just a shorter way to write MOVE ... TO ....


Automatic Type Conversion During MOVE

Here is something important that beginners often miss. When you move data between variables of different types, ABAP automatically converts the data. This is called implicit type conversion.

Example 3: Moving an Integer to a String

REPORT z_move_conversion.

DATA: lv_number TYPE i VALUE 42,
      lv_text   TYPE string.

lv_text = lv_number.

WRITE: 'Number:', lv_number.
NEW-LINE.
WRITE: 'As Text:', lv_text.

Output:

Number: 42
As Text: 42

ABAP converted the integer 42 into the string "42" automatically. This works for most standard type combinations.

Example 4: Moving a String to an Integer

REPORT z_move_str_to_int.

DATA: lv_text   TYPE string VALUE '100',
      lv_number TYPE i.

lv_number = lv_text.

WRITE: 'Text:', lv_text.
NEW-LINE.
WRITE: 'Number:', lv_number.

Output:

Text: 100
Number: 100

ABAP is smart enough to convert the text "100" into the integer 100. But be careful — if lv_text contained something like "ABC", this would cause a runtime error because ABAP cannot convert letters into a number.

Common Type Conversion Table

Source TypeTarget TypeWhat Happens
Integer (I)StringNumber becomes text (e.g., 42 → “42”)
StringInteger (I)Text becomes number if valid (e.g., “100” → 100)
Date (D)StringDate becomes text in YYYYMMDD format
StringDate (D)Text must be 8 chars in YYYYMMDD format
Packed (P)Integer (I)Decimal part is truncated
Character (C)StringWorks directly, trailing spaces trimmed

Moving Data Between Structures

In real projects, you rarely work with single variables. Most of the time, you are dealing with structures — groups of related fields. ABAP provides two ways to move data between structures.

Method 1: Direct Structure Assignment

If both structures have the exact same type, you can move one to the other directly:

REPORT z_move_structure.

TYPES: BEGIN OF ty_employee,
         empid   TYPE i,
         name    TYPE string,
         city    TYPE string,
       END OF ty_employee.

DATA: ls_source TYPE ty_employee,
      ls_target TYPE ty_employee.

ls_source-empid = 101.
ls_source-name  = 'Daksh'.
ls_source-city  = 'Jaipur'.

ls_target = ls_source.

WRITE: 'Target ID:', ls_target-empid.
NEW-LINE.
WRITE: 'Target Name:', ls_target-name.
NEW-LINE.
WRITE: 'Target City:', ls_target-city.

Output:

Target ID: 101
Target Name: Daksh
Target City: Jaipur

All three fields are copied in one single statement. Clean and efficient.

Method 2: MOVE-CORRESPONDING (Different Structures)

What if the two structures are not identical? What if they share some fields but not all? That is where MOVE-CORRESPONDING comes in. It copies only the fields that have the same name in both structures.

REPORT z_move_corresponding.

TYPES: BEGIN OF ty_source,
         empid   TYPE i,
         name    TYPE string,
         salary  TYPE p DECIMALS 2,
       END OF ty_source.

TYPES: BEGIN OF ty_target,
         empid   TYPE i,
         name    TYPE string,
         city    TYPE string,
       END OF ty_target.

DATA: ls_source TYPE ty_source,
      ls_target TYPE ty_target.

ls_source-empid  = 101.
ls_source-name   = 'Daksh'.
ls_source-salary = '50000.00'.

MOVE-CORRESPONDING ls_source TO ls_target.

WRITE: 'Target ID:', ls_target-empid.
NEW-LINE.
WRITE: 'Target Name:', ls_target-name.
NEW-LINE.
WRITE: 'Target City:', ls_target-city.

Output:

Target ID: 101
Target Name: Daksh
Target City:

Notice what happened here:

  • empid and name exist in both structures, so their values were copied.
  • salary exists only in the source, so it was ignored.
  • city exists only in the target, so it kept its initial empty value.

This is incredibly useful in real projects. For example, when you read data from a database table and need to fill a different output structure that has some matching fields and some extra fields. MOVE-CORRESPONDING handles the matching automatically.


MOVE-CORRESPONDING with Internal Tables

You can also use MOVE-CORRESPONDING between internal tables, not just single structures:

REPORT z_move_corr_itab.

TYPES: BEGIN OF ty_db_record,
         matnr  TYPE c LENGTH 18,
         maktx  TYPE c LENGTH 40,
         meins  TYPE c LENGTH 3,
         mtart  TYPE c LENGTH 4,
       END OF ty_db_record.

TYPES: BEGIN OF ty_display,
         matnr  TYPE c LENGTH 18,
         maktx  TYPE c LENGTH 40,
         status TYPE string,
       END OF ty_display.

DATA: lt_db      TYPE TABLE OF ty_db_record,
      lt_display TYPE TABLE OF ty_display,
      ls_db      TYPE ty_db_record.

* Simulate some database records
ls_db-matnr = 'MAT001'.
ls_db-maktx = 'Steel Plate'.
ls_db-meins = 'KG'.
ls_db-mtart = 'ROH'.
APPEND ls_db TO lt_db.

ls_db-matnr = 'MAT002'.
ls_db-maktx = 'Copper Wire'.
ls_db-meins = 'M'.
ls_db-mtart = 'ROH'.
APPEND ls_db TO lt_db.

MOVE-CORRESPONDING lt_db TO lt_display.

DATA ls_display TYPE ty_display.
LOOP AT lt_display INTO ls_display.
  WRITE: / ls_display-matnr, ls_display-maktx.
ENDLOOP.

Output:

MAT001 Steel Plate
MAT002 Copper Wire

Only the matching fields (matnr and maktx) were copied. The status field in the display table stays empty, and meins and mtart from the database table were ignored. This saves you from writing field-by-field assignment loops.


MOVE vs Direct Assignment — When to Use Which?

ScenarioUse
Simple variable to variabletarget = source. (modern style)
Legacy code maintenanceMOVE source TO target. (classic style)
Same-type structurestarget = source.
Different structures with matching field namesMOVE-CORRESPONDING source TO target.
Internal table to internal table (partial fields)MOVE-CORRESPONDING lt_source TO lt_target.

In new code, always prefer the = operator for simple assignments. Use MOVE-CORRESPONDING when you need to transfer data between structures or tables that share some but not all fields.


Common Mistakes to Avoid

MOVE copies the value. It does not create a reference. After the move, changing the source will not change the target. They are completely independent.

2. Type Mismatch Runtime Errors

Moving a text value like 'ABC' into an integer variable will cause a short dump (runtime error). Always make sure the source value is compatible with the target type.

3. Forgetting That MOVE-CORRESPONDING Only Copies Matching Names

If the field names are even slightly different (like emp_id vs empid), MOVE-CORRESPONDING will not copy that field. The names must match exactly, including case.

4. Overwriting Existing Data

When you use MOVE-CORRESPONDING to copy into a target that already has values in its unique fields, those values are preserved. Only the matching fields are overwritten. This is usually what you want, but be aware of it.


Interactive Checkpoints

Review these self-assessment cards to test your understanding:

🙋‍♂️ Checkpoint 1: What is the difference between MOVE and the equals (=) operator?
There is no functional difference. Both copy the value from the source to the target variable. The equals sign (=) is the modern, preferred syntax that is shorter and easier to read. The MOVE statement is the classic syntax that you will find in older ABAP programs. Both produce the exact same result at runtime.
🙋‍♂️ Checkpoint 2: When should you use MOVE-CORRESPONDING instead of a direct assignment?
Use MOVE-CORRESPONDING when the source and target structures have different types but share some field names. A direct assignment (=) only works when both structures are of the exact same type. MOVE-CORRESPONDING is smart enough to match fields by name and copy only the ones that exist in both the source and the target. Fields that exist only in one structure are ignored.
🙋‍♂️ Checkpoint 3: What happens if you try to move the string "Hello" into an integer variable?
You will get a runtime error (short dump) of type CONVT_NO_NUMBER. ABAP tries to convert the string to an integer but fails because "Hello" is not a valid number. You should always validate that the source string contains a valid numeric value before moving it into an integer or packed decimal variable. You can use the built-in function CONTAINS_ONLY to check if a string contains only digits before attempting the conversion.

Summary

The MOVE statement and its modern equivalent (the = operator) are fundamental to every ABAP program. You will use them hundreds of times in every project to transfer data between variables, structures, and internal tables.

For simple assignments, use the equals sign. For transferring data between different structure types that share some common field names, use MOVE-CORRESPONDING. Always be mindful of type conversions — ABAP handles many of them automatically, but incompatible types will crash your program at runtime.

If you understand these concepts well, you are ready to move on to more advanced topics like internal table operations, function modules, and modularization. These all rely heavily on data transfer between different variables and data containers.

Daksh Dedha - SAP Technical Consultant

Written by Daksh Dedha

SAP Technical Consultant

Daksh is an SAP Technical Consultant specializing in ABAP programming, SAP S/4HANA migrations, Fiori development, and BTP cloud architecture. He authors free, hands-on tutorials to make enterprise SAP education accessible to all developers.

Test Your Knowledge

SAP Challenge Question 1 of 10

Loading question...

Found this tutorial useful? Share it with your SAP development team.