Show TOC

 Initial ValuesLocate this document in the navigation structure

Use

If the 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 with inserts on database views .

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

ALTER TABLE <table name> ADD FIELD <field name>

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

NULL values do not have any disadvantages as long as the corresponding field is not selected. If you select a field with NULL values, the system cannot find some of the entries that satisfy your selection condition. This is because NULL values only satisfy the selection condition WHERE FIELD IS NULL.

Tip

You insert field Field1 in table TAB. If this table is accessed with the SELECT... FROM TAB WHERE Field1 <> 5... statement, the system does not find records with NULL values in Field1 even though they logically correspond to the WHERE condition of the SELECT statement.

You can avoid the case described in the example by defining the inserted field as Initial. The system creates the field in the database as NOT NULL. The system scans the entire table when it is activated and the new field is filled with the initial value.

Note

This can waste a lot of time. You must use the Initial indicator only if it is really needed or if the table only has a few entries.

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

A field can also be created in the database as NOT NULL if the initial indicator is not set in the ABAP Dictionary. You can find out if a field is defined as NOT NULL in the database by choosing Utilities → Database object → Display on the maintenance screen of the corresponding table.

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 system creates the fields only as NOT NULL if new fields are added or inserted. Key fields are the exception. The Initial indicator is automatically set there.

Note

If you set the Initial indicator for an include , the structure fields with a set Initial indicator also have this attribute in the table. If the Initial indicator is not set, NULL values are permitted for all the fields of the include.

Caution

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