Hi Borja,
Rather than restricting the WBS element for company code.
Try to change the field validation for company code in ME21N, once the vendor is selected you can make the field greyed out. This will ultimately restrict users editing it.
On the other side, you can try in substitution / validation (not sure how this will work)
Regards
Terence