Start of Content Area

Checking for the Initial Value  Locate the document in its SAP Library structure

Use the following logical expression to check whether the value of a field is initial:

.... <f> IS INITIAL .....

This expression is true if the field <f> contains the initial value for its type. To set the initial value of an elementary or aggregate field, use the statement CLEAR <f>.

Example

DATA FLAG VALUE 'X'.

IF FLAG IS INITIAL.
  WRITE / 'Flag is initial'.
ELSE.
  WRITE / 'Flag is not initial'.
ENDIF.

CLEAR FLAG.

IF FLAG IS INITIAL.
  WRITE / 'Flag is initial'.
ELSE.
  WRITE / 'Flag is not initial'.
ENDIF.

The output is as follows:

Flag is not initial

Flag is initial.

Here, the character string FLAG does not contain its initial value after the DATA statement because it is set to the start value 'X' using the VALUE parameter. When the CLEAR statement is executed, it is reset to its initial value.