Hi,
There are two option
Option 1-->use your own query
1. Please test the above code in Test DB. If it works as per your requirement, then you can implement in Live DB.
2. Change error message "'zero price after discount not allowed" to Not allowed zero invoice document"
Option 2---> Follow below thread
http://scn.sap.com/thread/3444729
Thanks & Regards,
Nagarajan