CLEAR statement in ABAP

CLEAR statement in ABAP programming is used for resetting the variables values to their initial values depending on the data types.

For an example CLEAR statement with an integer variable will reset its value as 0.

For an Internal table it will clear all the contents of that internal table. With structures it will CLEAR each components of the structure.

Its Syntax is:

CLEAR number.

 

You will get clearer picture by seeing the following sample programs.

REPORT demo_clear.

DATA number TYPE i VALUE ’20’.

WRITE number.

CLEAR number.

WRITE / number.

 

Its output will be

20

0

 

You can watch that it not resettled to the specified default value 20; it resettled to the integer’s initial value 0.

Also Read : View Other ABAP Keywords & Syntax -> ABAP Transaction codes