If you want to limit selection of raw material on batches to those that have stock on-hand then you can do this by setting a system parameter as follows:
Go to Setup --> Account Settings and switch on the 'Batch raw material must have stock available' parameter.
