Entering content frameBackground documentation Initial Values Locate the document in its SAP Library structure

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 Structure link inserts on database views.

If a new field is inserted 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 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 that 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.

Example

Field Field1 is inserted in table TAB. If this table is accessed with the SELECT... FROM TAB WHERE Field1 <> 5... statement, records with NULL values are not found in Field1 even though they logically correspond to 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 in the database as NOT NULL. The entire 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 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 flag is not set in the ABAP Dictionary! You can find out if a field is defined as NOT NULL in the database with Utilities ® Database object ® Display in 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 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.

Note

If the Initial flag for an include is set, the structure fields whose initial flag is set also have this attribute in the table. If the Initial flag is not set, NULL values are permitted for all the fields of the include.

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

Leaving content frame