Determining when inventory reconcile is running in Dynamics GP

If like me you find yourself writing a lot of integrations with Dynamics GP, then you will know that you really should not be messing with data related to inventory whilst the inventory reconcile is processing. Inventory reconcile is responsible for checking that everything tallies up, on summary records. Changing data under its feet, whilst it is trying to total and reference everything is a no-no as reconcile will come to the wrong conclusions! The problem when writing an integration is, how do you know a reconcile is in progress and processing? Well, somewhere on the network there will be a client machine with this this screen showing but that doesn't really help us, so what do we do..?

IVreconcile

Answer is to run the following, if a row is returned, then inventory reconcile is running.

SELECT * FROM DYNAMICS..SY00800WHERE BCHSOURC = 'Utility'    AND TRXSOURC = 'Reconcile'    AND CMPNYNAM = @CompanyName

Note: The company name parameter is found from from the company master table.

    SELECT *FROM DYNAMICS..SY01500

Using eConnect
if for the integration you are using eConnect (as you mostly should), directly or indirectly (many of the integration products for GP use eConnect under the covers), then the following error will occur. This is just the same thing, where eConnect has performed the same check and concluded it can't make any changes due to a reconcile in progress.

Error Number = 2246 Stored Procedure= taCreateUpdateBatchHeaderRcd Error Description = Inventory Reconcile is currently running, you can not enter IV Transactions or Transfers until it is completed