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

Problems with SELECT ... WHERE ... IS NULL

hubert_heitzer
Contributor
0 Likes
3,986

Ahoi experts,

SELECT * FROM stpo INTO TABLE lt_stpo<br>
 WHERE stlty EQ 'P'        AND
stlnr EQ '00191182' AND
posnr EQ '0020' AND
lkenz NE abap_true AND
aedat IS NULL.

should yield the last entry of STPO as shown below.

but results in an SY-SUBRC=4. If I omit

aedat IS NULL

query yields 3 hits (lines 1, 2 and 4).

Can u pls tell me, what is wrong with

aedat IS NULL

Regards, Hubert

1 ACCEPTED SOLUTION
Read only

abityildiz
Active Participant
3,879

Hi,
I think like this,your aedat field is value '00000000' in the table.

Could you try like this:

aedat = '00000000'
10 REPLIES 10
Read only

RaymondGiuseppi
Active Contributor
3,879

Do not confuse IS NULL (null value) with IS INITIAL (initial value of the dictionary type)

Read only

0 Likes
3,879

I know what you mean, but just to clarify, IS INITIAL is not valid with SELECT. Instead, we must use = followed by the corresponding initial value in the database.

Read only

3,879

sandra.rossi , since 7.53 : 4. Relational Expression IS INITIAL

Read only

0 Likes
3,879

Thanks for the information!

Read only

abo
Active Contributor
0 Likes
3,879

Have you tried simply with

aedat = ''

?

Read only

hubert_heitzer
Contributor
0 Likes
3,879

yes, I tried but did not work

Read only

abityildiz
Active Participant
3,880

Hi,
I think like this,your aedat field is value '00000000' in the table.

Could you try like this:

aedat = '00000000'
Read only

0 Likes
3,879

Yes thats it.

Raymond already led me to the solution.

Read only

matt
Active Contributor
3,879

Better is

DATA zero_date TYPE d.

...

WHERE aedat = zerodate.

Read only

Sandra_Rossi
Active Contributor
3,879

To sum up both valid answers:

  • Before 7.53, from kamil.yildiz : WHERE aedat = '00000000' (or other variants as explained by matthew.billingham
  • Since 7.53, from raymond.giuseppi : WHERE aedat IS INITIAL