Date conversion error in SQL Server stored procedure

I have a stored procedure that is throwing the following error when I run it "Msg 241, Level 16, State 1, Procedure sp_Matl_OpenPO_Amt_Adhoc, Line 54
Conversion failed when converting date and/or time from character string." I am using '2012001' for @begdate value and '20120131' for @enddate value when running the stored procedure.

I can't figure out why it is giving me this error. If I pull out the section of the stored procedure that includes the date reference and run it as a query it runs fine. Can someone take a look at my procedure and see if anything stands out to you?