Business Object invoicing module's set key to an invoice number reports bogus error "Unable to select this batch. This batch was created in Invoice Data Entry." workaround?

I have automated code that populates an invoice through the Sage Business Objects.  In the module S/O and SO_Shipping_ui  I am sometimes getting the error back "Unable to select this batch. This batch was created in Invoice Data Entry.".

I know this error is bogus, because I have already invoiced several similar orders through the batch.

I have found that if someone opens "Packing List Printing" or other printing, they have selected the same batch number that is used by the automated invoicing and have clicked "Proceed" to make it to the Form Code selection dialog, that will cause the automated invoice code to product that error.

It looks like the real error is that someone has "locked" the batch by using it in a dialog in SAGE.

Is there any way to tell if someone is using the batch in a SAGE window?

I would really like it if SAGE produced a correct error message like "Cannot use the batch because it is in use by ..."

For now I would be happy if I could detect that the batch is in use so I can report back the correct error when Sage gives me this wrong error message.