Assigning values to ABAP variables
Use ‘=’ or MOVE keyword to assign a value to a variable.
DATA: a TYPE i, b TYPE i, c TYPE i, d TYPE i. a = 10. b = a. MOVE 20 TO c. MOVE c TO d. WRITE:/ a, b, c, d.
Basic Arithmetic Operations
DATA: a TYPE i, b TYPE i, c TYPE i, d TYPE i. *Using Mathematical Expressions a = 10 + 20. b = 20 - 10. c = 10 * 2. d = 100 / 2. WRITE:/ 'Using Expressions'. WRITE:/ a, b, c, d. *Using Keywords add 10 to a. subtract 5 from b. multiply c by 2. divide d by 2. WRITE:/ 'Using Keywords'. WRITE:/ a, b, c, d.
Clear ABAP variables
Use keyword CLEAR to set the variables to default values.
DATA: a TYPE i, b TYPE i. a = 10 + 20. b = 20 - 10. WRITE:/ 'Before Clear'. WRITE:/ a, b. clear: a, b. WRITE:/ 'After Clear'. WRITE:/ a, b.
Output