Application Development 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: 

Working of SELECT SINGLE when field is blank

Former Member
0 Kudos
1,714

Hi,

In MARA table I have a custom field for Production End Date, which is blank for the two materials that I want to retrieve. Lets call the materials A and B.

In my code I do a select single from MARA table based on Material number and use it to populate a structure T_MARA of type MARA.

For material A, after the select statement the production end date field in the T_MARA structure is blank. However for material B, the Production end Date field is 00000000 which is the default value for Date fields.

I want to know why the select statement acts different for different materials. There is no conversion routine maintained for that field.

Anyone has a clue ?

Thanks,

Urmila

7 REPLIES 7

former_member181962
Active Contributor
0 Kudos
341

Hi Urmila,

Did you make a Sy-subrc check after the select single?

There is a possiblity that for one of the materials, the select may have failed.

Regards,

ravi

Former Member
0 Kudos
341

If the custom date field has been populated explicitly with '', you can get this result.

e.g. Production_End_Date = ''.

write production_end_date will give you bb/bb/bb (b = blank)

If production_end_date is CLEARed, you will get 00/00/0000.

abdul_hakim
Active Contributor
0 Kudos
341

Hi Urmila

Check sy-subrc EQ 0 after the select statement.

Regards,

Abdul

Former Member
0 Kudos
341

Hi Urmila,

if you are saying

' where prd_end_dt is initial. ' in your select, you will get the record with date as '00000000'.

Where as if you say

' where prd_end_dt = '' ' in you select, you will ge with date as blank..

Select statement in SQL never behaves differently. And, NULL is NOT EQUAL to blank.

Regards,

Raj

Former Member
0 Kudos
341

Hi Urmila,

I understand your confusion when select statement itself behaves weird . I faced similar kind of problem earlier & finally we found the oracle path we applied sometime back in SAP was the culprit , So please check with your security guys about that.

I would also suggest you to run a SQL trace (St05) on these two select & it would give you some idea about your result sets in each scenario.

Cheers

Raghava

Former Member
0 Kudos
341

Hi Urmila,

Are you clearing the structure after the select single statement on material A?

Try doing that and then see.

Warm Regards,

Vinod.

Former Member
0 Kudos
341

I don't think it's a problem with the select statement. More likely a data issue. What does it look like in the data browser?

Rob