Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

sop next number reset

Posted on by Microsoft Employee

We had an instance that our sopnumbe was reset back to the next available number of last years closed period.  Has anyone heard of this happening? 

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: sop next number reset

    That is exactly what I am saying.  There are only a few people that has access to this window and they would have to know what the last number was last year.

  • Verified answer
    L Vail Profile Picture
    L Vail 65,271 on at
    RE: sop next number reset

    Hi Larry,

    This behavior could manifest itself for the same reason the POP document number suddenly 'jumps' back.

    The PSTL tool has a checkbox for you to keep it from happening in POP, but not for any of the other modules.

    Below is an article copied from Mario Gomez's blog: "Why does my next document number change randomly?"

    "This is a very common question among Dynamics GP users. In fact, it is a very common situation that can puzzle even seasoned consultants. So here is the mystery debunked.

    "Every Dynamics GP next document number in every module is generally gathered from a setup table. Usually, this table column is called Next Number. For example, GL will have a Next Journal Number; POP will have a Next PO Number and so on, depending on the module and the transaction. To focus on one thing and one thing only, I will use POP and the next purchase order document number.

    "In multi-user PO entry environments, for example, if user A is working on PO 10, user B is working PO 11, and user C is working on PO 12, but user B cancels, void, or delete their PO, when user A attempts to enter another PO, they will still end up with 13. It will appear to user A that the PO numbers are being skipped randomly. But this is clearly not the case we are discussing here, and rather the normal application's behavior.

    "In principle, the next purchase order document number should be the maximum numeric portion of the next purchase order number increased by 1. Initially, GP will read the value from the POP_Setup table, then it will attempt to reserve this value, this is, making sure the next PO number has not been used.

    "In it's attempt to reserve the value, GP will first search forward, up to MAX_DOCID_RETRIES (a constant in the application's source code with a value of 1000). If at the end of this attempt to reserve a number the system is still not successful, it will move backwards up to MAX_DOCID_RETRIES again.

    "This perhaps explains why certain users will see their PO Numbers jump from say 8,120 to 7,230. If the system finds and empty position, it "grabs" (as in reserves) that PO number, incrementing the next PO number to whatever value is next from the "empty" position it found.

    "Unfortunately, this new value could have already been used, hence it will repeat the check the next time someone enters a PO. This can certainly become an issue, because Dynamics GP cannot always find a value to reserve. This is why some users will experience a blank PO number field when the system exhausts it's attempts.

    "To correct this issue, it is necessary to find the "real" next PO number (or whatever document number for whatever transaction you are interested in).

    "1) Copy and execute the two SQL Server UDF from my article "How to split Dynamics GP's alphanumeric column values in SQL Server". These functions will be the starting point and will need to be executed against the company database.

    "2) Now, they can be used in the following statement, as follows:

    DECLARE @MaxPONumber INT;

    DECLARE @AlphaPart VARCHAR(10);

    SELECT @AlphaPart = dbo.fGetAlpha(PONUMBER)FROM POP40100;

    WITH MyPOs (PONUMBER) AS (

    SELECT PONUMBER FROM POP10100

    UNION ALL

    SELECT PONUMBER FROM POP30100

    )

    SELECT @MaxPONumber = MAX(dbo.fGetNumber(PONUMBER)) + 1

    FROM MyPOs;

    UPDATE POP40100 SET PONUMBER =

     @AlphaPart + LEFT(REPLICATE('0', LEN(PONUMBER) - LEN(@AlphaPart)), LEN(PONUMBER) - LEN(@AlphaPart) - LEN(CONVERT(VARCHAR(20), @MaxPONumber))) +

     CONVERT(VARCHAR(20), @MaxPONumber);

    "If you have noticed this issue in other modules with other transactions and you would like me to post a script to correct this issue, just post back with a request to do so, otherwise, stay tuned! I will update this article with scripts for other modules and other transactions.

    "Until next post!

    "MG.-

    Mariano Gomez, MIS, PMP

    Maximum Global Business, LLC"

  • Mahmoud Saadi Profile Picture
    Mahmoud Saadi 32,738 on at
    RE: sop next number reset

    Are you saying that the SOP Number is reset from the setup level (Tools > Setup > Sales  > Sales Order Processing) without any user interference ?

    Are you sure you don't have any backbone solutions on the SQL level interfering with the next number ?  

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans