SAP DDIC DATABASE TABLES INIT



Get Example source ABAP code based on a different SAP table
  



ABAP_DDIC - Flag for Initial Values in Database Tables
Table fields of DDIC database tables can be flagged for initial values. On the database, this flag is set to NOT NULL. When a new field is inserted into an existing DDIC database table, this flag can be used to force an assignment of the type-dependent initial value to this field in all rows and on all platforms. The flag is always set automatically for key fields.
If a new table field without the property NOT NULL is inserted into an existing table, the field is given a null value in all rows. There is no equivalent to the null value in ABAP. The null value can be queried in AB_SQL using the WHERE condition with the addition 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 the ABAP Dictionary. Furthermore, in the following scenarios, all fields are given the property NOT NULL:
When a new table is created.
When a table is adjusted.
Only if new fields can be appended or inserted using ALTER TABLE without an adjustment, they are created without the flag NOT NULL on some database platforms, given they are not flagged for initial values in ABAP Dictionary. This does not apply to key fields, which are always flagged as NOT NULL . Whether a field is defined as NOT NULL on the database can be seen by displaying the database object in the ABAP Dictionary tool.
If the flag is set for an entire include structure, it is applied only to those structure components that were originally flagged. The other structure components are skipped. If the flag is not set for an include structure, all structure components do not have the flag, regardless of the original definition.



Latest 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 It is possible to set the flag for the data type RAW with a length less than 70 even though this data type does not have any initial value.
Except when inserting new fields, the indicator is not needed and the initial value is always set, which is especially true for adjusting tables.
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.
BEGIN_SECTION SAP_INTERNAL_HINT
There is also a hidden feature in SE11 that allows you to allow null values for columns of DDIC database tables. This feature is not documented and must not be used generally.
END_SECTION SAP_INTERNAL_HINT
NON_V5_HINTS
ABAP_HINT_END