Initial Values

If a value of a field in a data record is undefined or unknown, it is called a NULL value. NULL values occur when new fields are inserted in existing tables or in INSERT operations on database views.

If a new field is inserted in a table which already exists on the database, this operation is performed on the database with the DDL statement

ALTER TABLE tablename ADD FIELD fieldname...

The new field of records which already exist have a NULL value. If there is an INSERT on a table using a database view, NULL values are inserted in all the fields of the table which are not contained in the view.

Null values do not have any disadvantages as long as the corresponding field is not selected. If a field with NULL values is selected, some of the entries satisfying the selection condition might not be found. This is because NULL values only satisfy the selection condition WHERE FIELD IS NULL.

Field Field1 is inserted in table TAB. If this table is accessed with the statement SELECT... FROM TAB WHERE Field1 <> 5..., records with NULL values are not found in Field1 although they logically satisfy the WHERE condition of the SELECT statement.

The case described in the example can be avoided by defining the inserted field as Initial. The field is thus created on the database as NOT NULL. The whole table is scanned when it is activated and the new field is filled with the initial value. This can be very time-consuming! You should therefore only use the Initial flag if it is really needed or if the table does not have too many entries.

A field can also be created on the database as NOT NULL if the initial flag is not set in the ABAP Dictionary!

When a table is created, all the fields of the table are defined as NOT NULL and filled with the default value. The same is true when the table is converted! The fields are only created as NOT NULL if new fields are added or inserted. An exception is key fields, as the initial flag is automatically set here.

If the Initial flag is set for a substructure, exactly those structure fields whose Initial flag is set have this attribute in the table. If the Initial flag is not set, NULL values are permitted for all the fields of the substructure.

Fields with data types LCHR, LRAW, RAW and NUMC fields with a field length greater than 32 cannot be defined as Initial.

The initial values depend on the data type of the field.

Data type

Initial value

ACCP, CHAR, CUKY, LANG,
UNIT

" " space

CURR, DEC, FLTP, INT1,
INT2, INT4, QUAN

0

CLNT

000

TIMS

000000

DATS

00000000

NUMC

00000... for field length <= 32
No initial value for field length > 32

LRAW, LCHR, RAW, VARC

No initial value