Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Primary Key Violation on PKGL00201

Posted on by 28,021 Super User 2024 Season 1

Hi Everyone,

Our Finance people reported a problem yesterday when they wanted to open a new Fiscal Year (Microsoft Dynamics GP menu >> Tools >> Setup >> Company >> Fiscal Periods ).
When you type a new year, you have to push the 'Calculate' button to populate the information for all the periods. While doing this, GP stoped with an error message :
[Microsoft][SQL Native Client][SQL Server]Violation of PRIMARY KEY constraint 'PKGL00201'. Cannot insert duplicate key in object 'dbo.GL00201'

I figured that the primary key was a combination of 4 fields in the GL00201, but there is no explaination why this SP fails (UpdateDatesForBudget). I tried to run a DEX trace for the time the calculate process is runing, but no hint either on this side..  I found about 75 entries where the BUDGETID is blank, which is btw not very good, since it is part of the PK constraint.

On a test DB, I tried to remove the entries with the blank Budget ID, ran a check-links of the Budget Master and got no errors, but the problem still persist when trying to calculate the new periods...

Anyone a good suggestion where to look for ? Thanks for your help.

*This post is locked for comments

  • Suggested answer
    Beat Bucher  GP Geek  GPUG All Star Profile Picture
    Beat Bucher GP Gee... 28,021 Super User 2024 Season 1 on at
    Re: Primary Key Violation on PKGL00201

    Update on this thread.

    I found a posting somewhere else that suggested the PK violation could occur due to budget period entries that are not spanning properly over the FY.

    [...]

    •         Try running the statement below, it should tell you the exact rows which cause this issue.  On my system these seem to be caused by having a budget which spans financial years as the YEAR1 column in the GL00201 is not always correct.  Once I had updated that (directly through SQL) it was fine.

    SELECT  A.BUDGETID ,
           B.PERIODDT ,
           A.PERIODID ,
           A.ACTINDX
    FROM    GL00201 A ,
           SY40100 B
    WHERE   FORIGIN = 1
           AND A.YEAR1 = B.YEAR1
           AND A.PERIODID = B.PERIODID
    GROUP BY A.BUDGETID ,
           B.PERIODDT ,
           A.PERIODID ,
           A.ACTINDX
    HAVING COUNT (*) > 1

    [...]

    That revealed a couple of entries that  apparently where duplicates, but the real truth seems to rely on GL00201 entries were the PERIODID is not correct versus the PERIODDT (i.e. 0 instead of 1-12). I've found entries for the some month (like 2011-12-31 is associated with period 0, which doesn't look good).

    Also the GL00201 table has several entries with the BUDGETID field being blank, which I don't think is good either.

    Does anybody else had issues with such errors when importing Excel budgeting files in GP ?

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans