How do I remove an unposted invoice for error handling using BOI.

I want to improve error handling in a script I have.  How do I remove a unposted invoice using BOI.  I couldn't seem to get the Delete function to work.