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..?
Answer is to run the following, if a row is returned, then inventory reconcile is running.
SELECT *
FROM DYNAMICS..SY00800
WHERE 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
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