Skip to Content

COALESCE does not work as DB table always sets 'NOT NULL'

Jul 13, 2017 at 12:13 PM


avatar image

Hello Experts,

I have one doubt-

I am trying to use COALESCE function but it does not work

it always returns first value even in table value is blank.

When i checked the table i found "NOT NULL" is "X" in DB, so value is never NULL

to check this i created a table in SE11 , even though i am selecting "initial" flag X or not, DB automatically sets "NOT NULL"

Now i am little bit confused how to deal with this, how to use 'coalesce' function.

If anyone has any idea please clear my doubt.

Thanks in advance

Ashish T.

1.jpg (36.3 kB)
1.jpg (97.0 kB)
2.jpg (62.1 kB)
3.jpg (36.7 kB)
4.jpg (38.6 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Horst Keller
Jul 13, 2017 at 12:47 PM

The NOT_NULL flag is only relevant for inserting new fields into existing database tables.

It does not say, that there can't be null values in that field. But normally you simply don't have null values in database tables defined in the dictionary and accessed by ABAP.

Null values can arise as described here:

See also the example for COALESCE in Open SQL:

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks Horst, you cleared my doubt. I got confused with NULL/NOT NULL. Now i got to know how Coalesce works.