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

Difference between 'NULL' and blank value in BKPF

ramesh_mohan3
Explorer
0 Likes
4,258

When I select with a blank value from BKPF for the field BLIND, I don't get any values but if I use null, it returns, it returns values. When I checked the hexadecimal values for the 2 fields, they are both 20. Want to know the difference. DATA: tbl_bkpf TYPE TABLE OF bkpf,       l_blind TYPE bkpf-blind. data:l_blind1 TYPE bkpf-blind. SELECT *   FROM bkpf   INTO TABLE tbl_bkpf WHERE awtyp = 'BKPF'   AND awkey = '0100004893TERS2009'   AND blind = l_blind.. *--- test if blind is not space but NULL IF sy-subrc <> 0.   SELECT *     FROM bkpf     INTO TABLE tbl_bkpf   WHERE awtyp = 'BKPF'     AND awkey = '0100004893TERS2009'     AND blind IS NULL. ENDIF. Only the second select statement returns values. Any clues?

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
2,189

Hi Ramesh

SAP ABAP has provided and variable called space.

for character format field you can check blind = space.
http://scn.sap.com/thread/100083

8 REPLIES 8
Read only

former_member156446
Active Contributor
0 Likes
2,190

Hi Ramesh

SAP ABAP has provided and variable called space.

for character format field you can check blind = space.
http://scn.sap.com/thread/100083

Read only

former_member1716
Active Contributor
0 Likes
2,189

Hi Ramesh,

Let me explain this doubt of your with an example.

Consider a table which has 5 fields with five records. Now you are adding a new field named FIELD6 without checking the key and initial value. Now for all the five rows which exists these field named FIELD6 will hold the value as NULL.

So now when you execute the queries as below it wont give any result,

select * from table into int_table where FIELD6 EQ SPACE.

or

select * from table into int_table where FIELD6 NE SPACE.

This is because there is difference between NULL and SPACE. Now get into the below scenario.

Now consider that am adding a sixth row to the table, in this scenario my field named FIELD6 will hold SPACE if i dont enter any value to that field.

And if you now execute the above query it will give this sixth row as the output.

Hope you are now clear with the NULL and SPACE.

Please get back in case of any issues.

Regards,

Satish

Read only

former_member1716
Active Contributor
0 Likes
2,189

I hope My example above will clear your doubts with your queries. Please Get back for further queries.

regards,

satish

Read only

ramesh_mohan3
Explorer
0 Likes
2,189

Thanks Satish and Raj. But my issue is with SAP standard program LFMRIF2Y

Here SAP's standard code short dumps on the below select statement

    SELECT * FROM bkpf

      INTO CORRESPONDING FIELDS OF TABLE lt_bkpf

     WHERE bukrs = c_f_accit-bukrs

       AND belnr = c_f_accit-stblg

       AND awkey = l_awkey

       AND blind = l_blind.

  ENDIF.

  ASSERT sy-subrc = 0.

Our basis found out that these values are stored as 'NULL' rather than blank. But in the select statement the value passed is blank. So it fails and short dumps with the Assert statement. I think I have to check with SAP why this is save as 'NULL' instead of blank.

Any other suggestions?

Read only

0 Likes
2,189

Can You Please tell us the data element of the field Blind, is it char??

Read only

0 Likes
2,189

Did have a check on the Dump analysis on the Tcode ST22. have a depth analysis on the dumps generated and try to understand the problem.

Also i would recommend you to go through the below thread ,

For Assert Documentation check the below link,

ABAP Keyword Documentation

regards,

Satish

Read only

ramesh_mohan3
Explorer
0 Likes
2,189

The data element is FM_BLIND  (Char 1). I know about Assert statement and using it in my custom programs. Here the issue is with SAP standard program. I'm still not sure why SAP is storing as 'NULL' instead of blank.

Read only

0 Likes
2,189

Find the official answer here:

Initial Values - BC - ABAP Dictionary - SAP Library

Check examples here:

Regards,

Felipe