ABAP Keyword Documentation → ABAP - Dictionary → Classic Objects in ABAP Dictionary → Database Tables → Semantic Attributes of Database Tables → Table-Specific Semantic Attributes of Database Tables
Flag for Initial Values in Database Tables
Table fields of database tables can be given a flag for initial values. On the database, this flag is set to NOT NULL. When a new field is inserted into an existing database table, this flag can be used (on any platform) to assign the type-dependent initial value to this field in all rows. The flag is always set automatically for key fields.
If a new table field without the property NOT NULL is inserted in an existing table, the field is given a
null value in all rows. There is no counterpart to the null value in ABAP. It can only be queried in
ABAP SQL
using the special WHERE
condition IS [NOT] NULL
.
Generally, table fields on most database platforms are created as NOT NULL, even if the flag for the initial value is not set in ABAP Dictionary. Furthermore, all fields are given the property NOT NULL:
- When a new table is created
- When a table is updated
With the exception of key fields on some database platforms, new fields are not created as NOT NULL only if they can be appended or inserted using ALTER TABLE without an update (if the flag is not set in ABAP Dictionary). The NOT NULL definition of a database field can be seen in ABAP Dictionary by displaying the database object.
If the flag is set for an entire include structure, it only applies to those structure components where the flag is also set and not to all components. If the flag is not set for an include structure, all flags set in the included structure are ignored.
Other versions:
7.31 | 7.40 | 7.54
Notes
- The flag cannot be set for the following data types:
- LCHR, LRAW, and the obsolete VARC. No initial value is assigned to these data types.
- NUMC and RAW with a length greater than or equal to 70.
- GEOM_EWKB
- This flag is only needed when inserting new fields and the initial value is always set. This is of particular importance when tables are updated.
- In tables with many rows, it can take a long time to set the type-dependent initial value and the initial value flag should only be used if absolutely necessary or if the table has a small number of entries.