web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Inventory Quantity Error

(0) ShareShare
ReportReport
Posted on by

About a week ago, we had an error in inventory where the quantity ordered multiplied upon itself and posted back to the inventory count.  To clarify, what happened, the QTYBSUOM became the same as the order quantity and therefore when GP calculated the quantity to post, it multiplied one by the other - 2,000 x 2,000 = 4,000,000 - and posted to the inventory.  Of course, it also looks like I sold 4M of this item at $1.00 ea.  Nice for sales, but not correct.

Does anyone know of a SQL query to correct the inventory number?  The simple answer would be to make an adjustment entry to correct inventory however the error adjusted the inventory quantity back to the beginning of time (or at least 2004 when we began using GP).

Any help appreciated.

Mark - mplaideau@eagleind.com

*This post is locked for comments

I have the same question (0)
  • L Vail Profile Picture
    65,271 on at

    Hi,

    Do you have the correct numbers in a spreadsheet or some other data source? Do you also need to correct the FIFO layers?

    I have a query that checks the relevant Inventory tables against one another to see if Inventory reconciles internally. I did not create this statement, I wish I could give credit to whomever did. This doesn't change inventory, it's just a check. Were any journal entries posted as a result of this error? I'm trying to assess the severity of the problem. I presume nothing was done to your receipts history.

    Kind regards,

    Leslie

  • Community Member Profile Picture
    on at

    Hey Leslie,

    Thanks for the reply.  When you say "correct numbers" I am assuming you are referring to the correct inventory numbers.  In short, no I do not.  What I can say is that I know my beginning quantity was not negative 4,000,000.

    No entries have been made yet to adjust inventory or the GL.  I am looking for a solution before I move in that direction.

  • L Vail Profile Picture
    65,271 on at

    Hi,

    Boy negative 4,000,000, sort of reminds me of my checking account :).

    First, is your General Ledger correct? The most obvious way to adjust this is to take a physical inventory and adjust the quantity. I'm concerned about the other things that may have been affected. If you look at SOP history, what does it show for quantities? Are the SOP tables messed up? If you do a 'return' transaction on the SOP document, does it back out the errant quantity. If it's an order, can you void the order? Have you backed up your system and run Reconcile on inventory or checklinks on Sales and Inventory? I'm trying to determine how many tables were impacted by this transaction. I have a query I got from somebody, I don't remember the creator, that returned information about how inventory reconciled to itself. It won't change anything, it's just a select statement. If you run this, what does it return? This same person also wrote a script to balance everything, but that one actually updates the tables. Here's the script:

    DECLARE @ITEMFROM VARCHAR(33)

    DECLARE @ITEMTO VARCHAR(33)

    SET @ITEMFROM = ''

    SET @ITEMTO = ''

    IF @ITEMFROM = ''

    SET @ITEMTO = REPLICATE('Z', 33)

    SELECT ITEMNMBR

    , Location

    , CASE

    WHEN (SUM(ONHAND) + SUM(OnHandNeg)) < 0

    THEN (SUM(ONHAND) + SUM(OnHandNeg)) * - 1

    ELSE (SUM(ONHAND) + SUM(OnHandNeg))

    END AS OnHand

    , CASE

    WHEN (SUM(InUse) + SUM(InUseNeg)) < 0

    THEN (SUM(InUse) + SUM(InUseNeg)) * - 1

    ELSE (SUM(InUse) + SUM(InUseNeg))

    END AS InUse

    , CASE

    WHEN (SUM(Damaged) + SUM(DamagedNeg)) < 0

    THEN (SUM(Damaged) + SUM(DamagedNeg)) * - 1

    ELSE (SUM(Damaged) + SUM(DamagedNeg))

    END AS Damaged

    FROM (

    SELECT ITEMNMBR

    , DOCNUMBR

    , TRXQTY

    , Location

    , QtyType

    , SiteType

    , OnHand = CASE

    WHEN SiteType = 1

    AND QtyType IN (

    0

    , 1

    )

    THEN TRXQTY

    ELSE 0

    END

    , OnHandNeg = CASE

    WHEN (

    QtyType = 1

    AND SiteType = 2

    )

    OR (

    QtyType = 0

    AND SiteType = 2

    )

    THEN CASE

    WHEN TRXQTY < 0

    THEN TRXQTY

    ELSE TRXQTY * - 1

    END

    ELSE 0

    END

    , InUse = CASE

    WHEN QtyType = 3

    AND SiteType = 1

    THEN TRXQTY

    ELSE 0

    END

    , InUseNeg = CASE

    WHEN QtyType = 3

    AND SiteType = 2

    THEN TRXQTY * - 1

    ELSE 0

    END

    , Damaged = CASE

    WHEN QtyType = 5

    AND SiteType = 2

    THEN TRXQTY

    ELSE 0

    END

    , DamagedNeg = CASE

    WHEN QtyType = 5

    AND SiteType = 1

    THEN TRXQTY * - 1

    ELSE 0

    END

    FROM (

    SELECT IV30300.ITEMNMBR

    , LNSEQNBR

    , DOCNUMBR

    , TRXQTY

    , TRXLOCTN AS location

    , TRFQTYTY AS qtytype

    , SiteType = CASE

    WHEN (IV30300.DOCTYPE = 3)

    OR (

    IV30300.DOCTYPE = 2

    AND TRXQTY < 0

    )

    OR (TRFQTYTY = 3)

    THEN 2

    ELSE 1

    END

    FROM dbo.IV30300

    INNER JOIN dbo.IV00101 ON dbo.IV30300.ITEMNMBR = dbo.IV00101.ITEMNMBR

    WHERE IV30300.ITEMNMBR BETWEEN @ITEMFROM

    AND @ITEMTO

    AND UOMSCHDL = 'NO'

    UNION

    SELECT IV30300.ITEMNMBR

    , LNSEQNBR

    , DOCNUMBR

    , TRXQTY

    , TRNSTLOC

    , TRTQTYTY

    , SiteType = 1

    FROM dbo.IV30300

    INNER JOIN dbo.IV00101 ON dbo.IV30300.ITEMNMBR = dbo.IV00101.ITEMNMBR

    WHERE IV30300.ITEMNMBR BETWEEN @ITEMFROM

    AND @ITEMTO

    AND UOMSCHDL = 'NO'

    AND IV30300.DOCTYPE = 3

    AND TRXLOCTN <> TRNSTLOC

    ) HISTORY

    ) SETQTY

    GROUP BY ITEMNMBR

    , LOCATION

  • Community Member Profile Picture
    on at

    The query returns nothing.

    It's too late to void or delete the order.  The order has been transferred to invoice.  I have run the reconcile and checklinks - neither have resolved the issue.

    The GL will be out because of the quantity posted.  It posted the 4,000,000 times my cost.

  • L Vail Profile Picture
    65,271 on at

    Ok, So the invoice posted and created this entry. I presume your Inventory, GL, and Receivables balances are all wrong. Have you tried creating a Return document? Moving on, I would run the query below and put the document number and  then the item number in the search (not at the same time). The SQL statement will return all of the tables that include the string and also the field it was in.  We can look in those tables to find the transaction. We know it's going to be in the GL20000, SOP30300, RM20101, IV00101, IV00102, RM20101 and possibly theRM20201, but I'm sure there are others. The tables returned by the invoice number will reveal the most relevant information. If you want to take this discussion off-line, please send me the results of your database search in my e-mail. leslievail@earthlink.net

    Kind regards,

    Leslie

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Dan Liebl Profile Picture

Dan Liebl 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans