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

tracking NULL values

Former Member
0 Likes
781

Hi All,

there is a condition in a query where i have to check for a char field is NULL or not.

how do I do it ??

select count(*) into count1 from DFKKOP

WHERE blart = 'CO'

AND betrw < 0

and augbl is NULL.

the field 'augbl' is a char type field. when i write the above query, it gives me a incorrect result. actually i want to retrieve the field(augbl) where the field value in the table DFKKOP is a space.

plz tell me how to write the query in this case.

thanks..

prad

7 REPLIES 7
Read only

Former Member
0 Likes
719

use INITIAL

select count(*) into count1 from DFKKOP
WHERE blart = 'CO'
AND betrw < 0
and augbl is INITIAL.

Read only

uwe_schieferstein
Active Contributor
0 Likes
719

Hello Prad

It should look like this:

select count(*) into count1 from DFKKOP
WHERE blart = 'CO'
AND betrw < 0
and augbl = space.

Regards

Uwe

Read only

Former Member
0 Likes
719

select count(*) into count1 from DFKKOP

WHERE blart = 'CO'

AND betrw < 0

*and augbl is NULL

<b>and augbl eq space</b>

regards,

vijay

Read only

Former Member
0 Likes
719

Here we go :

select count(*) into count1 from DFKKOP

WHERE blart = 'CO'

AND betrw < 0

and augbl = ' ' .

OR

select count(*) into count1 from DFKKOP

WHERE blart = 'CO'

AND betrw < 0

and augbl IS INITIAL .

Cheers.

Read only

0 Likes
719

is INITIAL is used for NULL values ..... so that is not working ....

i have tried all the other options , such as space /' ' ......... none of the options are working ...

please let me know ur thoughts

Read only

0 Likes
719

hi pradipta,

just check the table BSIK with a valid entry of a vendor having more than 1 item ..

execute the code and cross check with the table entries this will give u a clear picture . also dfkkok is a structure cause im not able to see that in 4.6c.

data: count1 type i.

select count(*) into count1 from bsik
 WHERE lifnr eq '0000010010'
 and augbl eq space .

check sy-subrc eq 0.

write:/ count1.

regards,

vijay

Read only

Former Member
0 Likes
719

Does betrw allow negative values?

Rob