Hi Sudhir,
I am guessing that you may have missed on checking the possibility of doing this via standard process of creating validations through Tcodes GGB0 and OB28. I would like to suggest you to go by this route and try if results match your requirement. I am not sure whether adding logic to circumvent CLEAR will turn out to be a good solution.
Regards,
Rohan