2014 Sep 29 6:52 PM
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?
2014 Sep 29 7:02 PM
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
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?
2014 Sep 29 7:02 PM
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
2014 Sep 29 7:22 PM
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
2014 Sep 29 7:30 PM
I hope My example above will clear your doubts with your queries. Please Get back for further queries.
regards,
satish
2014 Sep 29 7:30 PM
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?
2014 Sep 29 7:35 PM
Can You Please tell us the data element of the field Blind, is it char??
2014 Sep 29 7:47 PM
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,
regards,
Satish
2014 Sep 29 7:51 PM
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.
2014 Sep 29 11:14 PM
Find the official answer here:
Initial Values - BC - ABAP Dictionary - SAP Library
Check examples here:
Regards,
Felipe
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |