Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Primary Key Null values issue

Former Member
4,472

Hi All,

I searched on SCN for this issue but couldn't get any solution,

I have created a custom table in ECC. I want Null values for some primary keys and for others I don't want any NULL values.

I tried removing check box for 'initial Values' column for which I don't want to allows user to save Null values.

It didn't show any error/warning during syntax check.

However, when I activated the Table, all fields are marked in 'initial Values' column.

I am not sure why SAP is overwriting my choice while activating the table that too without any message.

Can anybody help me with this.

Thanks.

3 REPLIES 3
Read only

former_member192467
Active Participant
0 Likes
2,092

Hi,

SAP Help document says that:

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.


URL for the same: Initial Values -  ABAP Dictionary - SAP Library


Hope this answers your query.


Regards,

Renjith Michael

Read only

0 Likes
2,092

Thanks Renjith .. I am setting the flag for 'initial values'.. still the blank values are getting saved.

How can I avoid this..

Read only

0 Likes
2,092

Hi Jitendra Nayak,

your definition of NULL values seems to be a new one. A DB table NULL value means that nothing is saved in a particular column of a particular row. And NOTHING means nothing, psysically the space is saved. Thus, by definition, a key field can never have a NULL value.

INITIAL values are some kind of default value, i.e. for CHAR it is space (probably your understanding of blank), for numeric type ist will be zero.

The flag 'initial values' is set for key fields by default. Only if you append fields to an existing database table, the 'initial values' flag has a meaning: If it is flagged, the field in alle existing rows will be set to their initial value, otherwise it is NULL. This means the table append is done be very fast, as the contents remain unchanged. And, most confusing, in a WHERE clause, you will find the NULL values only by WHERE .. IS INITIAL.

You are never prohibited to store initial values in key or other fields by table definition.

Regards Clemens