2005 Nov 16 2:05 PM
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
2005 Nov 16 2:08 PM
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
2005 Nov 16 2:12 PM
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.
2005 Nov 16 2:12 PM
Hi Urmila
Check sy-subrc EQ 0 after the select statement.
Regards,
Abdul
2005 Nov 16 2:17 PM
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
2005 Nov 16 2:55 PM
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
2005 Nov 16 3:09 PM
Hi Urmila,
Are you clearing the structure after the select single statement on material A?
Try doing that and then see.
Warm Regards,
Vinod.
2005 Nov 16 3:22 PM
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