Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

MRP in a test company

Posted on by

Hello,

Has anyone used MRP in a test company?  Our live works (mostly but no errors)  I am trying to get it to work in test so I can play around with tweaking some settings but it just causes an error and then I cant do any manufacturing/inventory transactions.  It is the same error each time.  It is Violation of primary key PKmrp0101 (shows a item # and location) but there is nothing in this table..

If I restore any timeframe of the database it does the same.  Anybody have any ideas?  Thanks

Rick

*This post is locked for comments

  • RE: MRP in a test company

    It appears I may have used a wrong version of this script :)  MRP working in R2 no issues in test.  Sorry for the delayed response but finally getting back to this

  • RE: MRP in a test company

    Hey Redbeard :)

    Thanks for your responses and we have a full test environment on Hyper-V but the purpose of that is for testing upgrades so it is currently on 2013 R2 which works but I don't want to do my testing on there and then realize the function I find is not available in 2013.  I could also virtualize our live and put it over but again this is a lot of effort for something I thought should just function.  

    Rick

  • Suggested answer
    Redbeard Profile Picture
    Redbeard 12,931 on at
    RE: MRP in a test company

    Rick,

    You are correct, the moment you update the SY00100 value in the TEST company database, MRP throws the error you reported above.   I too have tried to make MRP work after doing this, to now avail.

    While, it is really convenient to have Test company a user can access in their Live environment, if they want to test a process or setting, this approach is not the best approach to testing in several instances:

    1. Deploying custom code, especially if the code relies on table modifications.

    2. Testing new features, which require updates to the Product Keys.

    3. Applications like Fixed Assets, Human Resources, Manufacturing and some 3rd Party Products come to mind (like WennSoft) which maintain some settings at the system database level.

    One alternative, which would be similar to what you are doing is to configure a new company and use PSTL tools to copy over data from your Live database to your test database, and then configure MRP from independently to test the various settings.  This seems like a lot of work.  So, I would not recommend this.

    My strong suggestion is to create a virtual copy of your Live environment so you have a completely separate test environment, which makes thorough testing of new code, new features and registration keys as well as applications which maintain settings at the system database level possible.  

    I have been using this approach for many years.  VMWare Workstation for Windows costs roughly $150 dollars, and comes with a tool to copy Live Machines to Virtual Machines.

    www.vmware.com/.../workstation

  • RE: MRP in a test company

    You cant login to the test company without changing the SY00100.  My test companies (all 6) and test system work fine except for this one and it is only MRP that doesn't work in this test company.  Thanks though

  • Verified answer
    Redbeard Profile Picture
    Redbeard 12,931 on at
    RE: MRP in a test company

    Rick,

    I have managed to get MRP to work in test companies fine - just did this again in 2013 for the express purpose of validating this wasn't a newly introduced problem - my build is 12.00.1570 (GP2013 SP2).  I don't know how much experience you have creating test companies, but it is imperative to follow the instructions laid out in the following KB871973:

    support.microsoft.com/.../871973

    Most importantly run the following SQL Script against the company database after you copy it from your Live DB to your Test DB:

    if exists (select 1 from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'SY00100') begin

     declare @Statement varchar(850)

     select @Statement = 'declare @cStatement varchar(255)

    declare G_cursor CURSOR for

    select case when UPPER(a.COLUMN_NAME) in (''COMPANYID'',''CMPANYID'')

     then ''update ''+a.TABLE_NAME+'' set ''+a.COLUMN_NAME+'' = ''+ cast(b.CMPANYID as char(3))

     else ''update ''+a.TABLE_NAME+'' set ''+a.COLUMN_NAME+'' = ''''''+ db_name()+'''''''' end

    from INFORMATION_SCHEMA.COLUMNS a, '+rtrim(DBNAME)+'.dbo.SY01500 b

     where UPPER(a.COLUMN_NAME) in (''COMPANYID'',''CMPANYID'',''INTERID'',''DB_NAME'',''DBNAME'')

       and b.INTERID = db_name() and COLUMN_DEFAULT is not null

    and rtrim(a.TABLE_NAME)+''-''+rtrim(a.COLUMN_NAME) <> ''SY00100-DBNAME''

     order by a.TABLE_NAME

    set nocount on

    OPEN G_cursor

    FETCH NEXT FROM G_cursor INTO @cStatement

    WHILE (@@FETCH_STATUS <> -1)

    begin

     exec (@cStatement)

     FETCH NEXT FROM G_cursor INTO @cStatement

    end

    close G_cursor

    DEALLOCATE G_cursor

    set nocount off'

     from SY00100

     exec (@Statement)

    end

    else begin

     declare @cStatement varchar(255)

     declare G_cursor CURSOR for

     select case when UPPER(a.COLUMN_NAME) in ('COMPANYID','CMPANYID')

       then 'update '+a.TABLE_NAME+' set '+a.COLUMN_NAME+' = '+ cast(b.CMPANYID as char(3))

       else 'update '+a.TABLE_NAME+' set '+a.COLUMN_NAME+' = '''+ db_name()+'''' end

     from INFORMATION_SCHEMA.COLUMNS a, DYNAMICS.dbo.SY01500 b

       where UPPER(a.COLUMN_NAME) in ('COMPANYID','CMPANYID','INTERID','DB_NAME','DBNAME')

         and b.INTERID = db_name() and COLUMN_DEFAULT is not null

       order by a.TABLE_NAME

     set nocount on

     OPEN G_cursor

     FETCH NEXT FROM G_cursor INTO @cStatement

     WHILE (@@FETCH_STATUS <> -1)

     begin

       exec (@cStatement)

       FETCH NEXT FROM G_cursor INTO @cStatement

     end

     close G_cursor

     DEALLOCATE G_cursor

     set nocount off

    end

  • soma Profile Picture
    soma 24,406 on at
    RE: MRP in a test company

    I think something is missing in your company setup for MRP or Manufacturing (don't know the real cause for this issue). Better create a new company and the try the same or contact your partner to resolve the same.

    Hope this helps!!!

  • RE: MRP in a test company

    Fabrikam works (so do my live companies).  They should be the same version because they are a copy of live within the last week and we haven't upgraded since January...

  • soma Profile Picture
    soma 24,406 on at
    RE: MRP in a test company

    Have you tried this on Fabrikam company? Also check both the live and test GP are same version.

    Hope this helps!!!

  • RE: MRP in a test company

    I restored a backup from April with the same results "Violation of PRIMARY KEY constraint PKMRP0101" cannot insert duplicate key in object MRP0101...

  • soma Profile Picture
    soma 24,406 on at
    RE: MRP in a test company

    Any update?

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