Note:385830
Instead of writing code in MB_DOCUMENT_BEFORE_UPDATE,write a check in user exit MBCF0002.This exit is having all the required parameters and also it will trigger while checking document and also posting document.
We can use '' sy-cprog'' to judge whether to use Validation Logic