‎2011 Jul 12 9:02 AM
Dear All,
Is there any method to differentiate between INITIAL value and NULL value at abap level. I have one internal table in which there are some Initial values as well as some Null values and also others are present. so i want to recognize these values at abap level .please suggest me some method.
REgards,
Anuj jain
‎2011 Jul 12 9:19 AM
Since IS NULL is only available for SQL-conditions, and I assume that NULL means hex '00' values, you can maybe use the BYTE-CO operator in conjunction with a type X field with value '00'.
Thomas
‎2011 Jul 12 9:24 AM
‎2011 Jul 12 10:53 AM
hi Anuj Jain ,
Initial value means '0' (zero)
null value means 'garbage value'
garbage value ( it could be anything which is not useful)
Hope this will work.
‎2011 Jul 12 12:53 PM
I tried thomas method but it's not giving required result
Any other suggestions?
Regards,
Anuj
‎2011 Jul 12 2:53 PM
Please precisely explain what you consider a NULL value in this specific case. The more details you disclose, the more likely you will receive helpful replies.
Thomas
‎2011 Jul 12 6:40 PM
Hi Anuj,
you can not detect NULL values in ABAP. In the database, if you append new fields to a table, the database will not automaticalls create values for all records (except you crossed INITIAL flag in DDIC). Those values are NULL values because they simply do not exist. You can check for them in the WHERE clause of a select statement. You will not find a record with NULL value if you specify WHERE ... = space.
If you select records into a structure or table, all NULL values will be converted automatically to INITIAL value. When updating a database table from structure or table, all previously NULL values get overwritten with initial (or existing) value.
This is about NULL in context of field values.
In context of references, we can talk of NULL as a missing reference. A class or data object is NULL (in ABAP; IS BOUND) as long as no instance or data refernced by this object has been created.
Hope this sheds lights on any doubts.
Regards,
Clemens
‎2011 Jul 13 6:24 AM
Dear Thomas ,
As per your suggestion i tried like this
" table zmara field zaennr has NULL values
SELECT * FROM zmara INTO table it_zmara.
DATA: hex1 TYPE xstring ,
hex2 TYPE xstring value IS INITIAL.
loop at it_zmara.
hex1 = it_zmara-zaennr." This contain NULL values
IF hex1 BYTE-CO hex2.
write: 'Found Initial values'.
ENDIF.
endloop.and in this case for all null values showing sy-subrc = 0 for if conditions and write: 'Found Initial values'.
Regards,
Anuj jain
<Added code tags>
Edited by: Suhas Saha on Jul 13, 2011 10:58 AM
‎2011 Aug 19 9:56 AM
Hi All,
Can we found out that any table is having Any NULL values or not?
Like Any table maintain all tables entries for null values or Any FM.
NOTE: Not usefull (sql with where field is null)
‎2011 Aug 19 5:34 PM
the only way to find records with NULL values is WHERE ... IS NULL. There is no other solution. Even WHERE ... = hex 00 won't work, neither WHERE ... NE any value.
Sandra
‎2011 Aug 19 11:14 AM
‎2011 Aug 19 1:45 PM
Hi,
if sql with where field is null is not applicable, then please close the thread, change the subject and describe what you really want (Not: field is null)
And plese explain where your own definition of initial is different to common IT definition. Thank you.
Regards
Clemens
‎2011 Sep 13 8:56 AM