Hi Heidi,
You need to set the message M7 210 (Shelf life expiration date & lies in the past) as Error message.
Please refer the below documentation link for detailed explanation.
http://help.sap.com/saphelp_46c/helpdata/en/0e/6dec6eb435d1118b3f0060b03ca329/content.htm
Regards,