‎2009 Aug 06 11:12 AM
Hi all,
I am trying to fetch the records where sczuo values are NULL .
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE makz.
DATA : END OF itab.
SELECT * FROM makz INTO TABLE itab WHERE sczuo IS NULL.
IF sy-subrc EQ 0.
LOOP AT itab.
WRITE : /3 itab-matnr , 20 itab-sczuo.
ENDLOOP.
ENDIF.
I did not getting data any data .But if i write select statement like this
SELECT * FROM makz INTO TABLE itab WHERE sczuo = ' '.
This select statement returns the correct data.
why my first select statement is not working ? how can i use IS NULL?
Thanks in Advance,
Madhu
‎2009 Aug 06 12:59 PM
Hi,
When we insert a new field to an existing table, NULL values are automatically inserted into the new field by the system for all existing records. However NULL and SPACE are not the same.
The logical expression SQL condition is either "true, false, or unknown". The expression is UNKNOWN if one of the columns involved in the database contains a NULL value and such records could be retrieved by using u201CIS NULLu201D instead of SPACE.
Please note that the NULL value is inserted only for the existing records, by the time the new field is being inserted. For all new records, SPACE or the initial (default) value is inserted.
If the new field is inserted by checking the checkbox u201Cinitial valuesu201D, then the initial values (SPACE in case of characters) are automatically inserted and not the NULL values.
ihope u get the solution...
Thanks
Ashu
‎2009 Aug 06 11:53 AM
Hi..
I did a Trace on your report and found that the first Select sends "Is Null" to database
Whereas the second query sends " ",As shown below in Open SQL
SELECT WHERE "MANDT" = '800' AND "SCZUO" IS NULL
FETCH 0 1403
SELECT WHERE "MANDT" = '800' AND "SCZUO" = ' '
FETCH 2 1403
The field also has a conversion routine ALPHA attached to it.
So I Think the DB interpreataion of IS NULL value is different from SPACE.
i.e. The initial value of this field in Database is other than " ".
Thanks,
AJR
‎2009 Aug 06 11:56 AM
data:v_sczuo type CO_SCZUO value is INITIAL.
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE makz.
DATA : END OF itab.
SELECT * FROM makz INTO TABLE itab WHERE sczuo = v_sczuo.
‎2009 Aug 06 12:59 PM
Hi,
When we insert a new field to an existing table, NULL values are automatically inserted into the new field by the system for all existing records. However NULL and SPACE are not the same.
The logical expression SQL condition is either "true, false, or unknown". The expression is UNKNOWN if one of the columns involved in the database contains a NULL value and such records could be retrieved by using u201CIS NULLu201D instead of SPACE.
Please note that the NULL value is inserted only for the existing records, by the time the new field is being inserted. For all new records, SPACE or the initial (default) value is inserted.
If the new field is inserted by checking the checkbox u201Cinitial valuesu201D, then the initial values (SPACE in case of characters) are automatically inserted and not the NULL values.
ihope u get the solution...
Thanks
Ashu
‎2009 Aug 07 7:52 PM
Hello,
I tried "IS NULL" type of query on a number of tables in SAP (IDES system). However, none of these tables returned any records. Is there any standard table at all in SAP that may contain "NULL" value?
If you have any query on any SAP table that returned you the data with "IS NULL" in it, I would appreciate it if you could share the table name with me.
At this point, I am led to believe that SAP tables never contain NULL values even though ABAP SQL query supports "IS NULL" and "NOT IS NULL."
Thank you in advance for your help.
Regards.
Peter