Dear Ansh:
The standard behavior is block the delivery creation if you block the sold to and ship to in XD05/VD05.
So is not necessary to use a user exit.
If you enter delivery block correctly for sold to and ship to it will works correctly.
After I blocked the customer if i try to create the outbound delivery in VL01N this is the error message:
If is not working right, check with the help of an ABAP the process, maybe you have a custom change that affect on this.
Regards Antonio Martinez.