Monday, July 15, 2013

Dynamics GP 2013 - Cannot insert the value NULL into column 'UseQtyOverageTolerance', table 'tempdb.dbo.#PODetailed

Other errors
popSelectPOItemsLoadDexTables returned the following results: DBMS:515, Microsoft Dynamics GP: 0.

This error occurs when you try to use the Auto Receive feature against an existing PO

This error occurs because you have a non-inventory item on some PO that is incorrectly flagged as an inventoried item.
This may occur if the company has old PO's with old items that were not imported, or that were removed at some point.

Run this script to identify any PO Line items that are incorrectly flagged.
----------------------------------------------------------------------------------------
select * from pop10110 where NONINVEN = 0 and ITEMNMBR not in (select ITEMNMBR from IV00101)
----------------------------------------------------------------------------------------



Run this script to update all noninventory items to the correct status. This will resolve the error.
-----------------------------------------------------------------------------------------
update pop10110 set noninven = 1 where NONINVEN = 0 and ITEMNMBR not in (select ITEMNMBR from IV00101)
----------------------------------------------------------------------------------------

Friday, July 12, 2013

Dynamics GP - Yes to include new code - Privilege Error

This error occurs when you are trying to install a cnk file.
When you run Dynamics GP it prompts to include code, when you click yes, it pops a message saying "Privilege error"

This is because Dynamics is already running, and the files are locked.
Check your task manager for any sessions of Dynamics.exe that are running. Make sure to close any open sessions before attempting to run GP again to install the cnk file.

Dynamics GP 2013 - Restore copy of live as test - update company id

Original article http://support.microsoft.com/kb/871973


When restoring a company from a live database to a test database:

Check all of the company id's by running

select * from dynamics.dbo.sy01500

Go to the new company you restored
Edit the sy00100 table, and change the companyid to the correct companyid identified above
update TEST.dbo.sy00100 set cmpanyid = 2

Run this script
--------------------------
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
----------------------------
sp_changedbowner 'DYNSA'
-----------------------------

The final script should look something like this
-----------------------------------------
BACKUP DATABASE [TWO] TO  DISK = N'D:\Backups\TWO_temp.bak' WITH NOFORMAT, INIT,  NAME = N'TWO-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO

BACKUP DATABASE [TEST] TO  DISK = N'D:\Backups\TEST_temp.bak' WITH NOFORMAT, INIT,  NAME = N'TEST-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO

Use Master
 Alter Database TEST
  SET SINGLE_USER With ROLLBACK IMMEDIATE
RESTORE DATABASE [TEST] FROM  DISK = N'D:\Backups\TWO_temp.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10
GO

update TEST.dbo.sy00100 set cmpanyid = 2

USE TEST
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

exec sp_changedbowner 'DYNSA'

Wednesday, July 10, 2013

Dynamics GP - Decimal Place Change - You cannot complete this process while invoices are being posted

Clear all locks and try again

Run

delete from DYNAMICS..ACTIVITY
delete from tempdb..DEX_SESSION
delete from tempdb..DEX_LOCK
delete from DYNAMICS..SY00800
delete from DYNAMICS..SY00801

Thursday, July 4, 2013

Dynamics GP - Daily Snapshots of Inventory Quantities

--Run this against the company first to create the table

/****** Object:  Table [dbo].[IV00102_snapshots]    Script Date: 07/04/2013 09:28:43 ******/ 
IF EXISTS (SELECT * 
           FROM   sys.objects 
           WHERE  object_id = Object_id(N'[dbo].[IV00102_snapshots]') 
                  AND type IN ( N'U' )) 
  DROP TABLE [dbo].[iv00102_snapshots] 

go 

/****** Object:  Table [dbo].[IV00102_snapshots]    Script Date: 07/04/2013 09:28:43 ******/ 
SET ansi_nulls ON 

go 

SET quoted_identifier ON 

go 

SET ansi_padding OFF 

go 

CREATE TABLE [dbo].[iv00102_snapshots] 
  ( 
     [itemnmbr]         [CHAR](31) NOT NULL, 
     [locncode]         [CHAR](11) NOT NULL, 
     [binnmbr]          [CHAR](21) NOT NULL, 
     [rcrdtype]         [SMALLINT] NOT NULL, 
     [primvndr]         [CHAR](15) NOT NULL, 
     [lsordqty]         [NUMERIC](19, 5) NOT NULL, 
     [lrcptqty]         [NUMERIC](19, 5) NOT NULL, 
     [lstorddt]         [DATETIME] NOT NULL, 
     [lsordvnd]         [CHAR](15) NOT NULL, 
     [lsrcptdt]         [DATETIME] NOT NULL, 
     [qtyrqstn]         [NUMERIC](19, 5) NOT NULL, 
     [qtyonord]         [NUMERIC](19, 5) NOT NULL, 
     [qtybkord]         [NUMERIC](19, 5) NOT NULL, 
     [qty_drop_shipped] [NUMERIC](19, 5) NOT NULL, 
     [qtyinuse]         [NUMERIC](19, 5) NOT NULL, 
     [qtyinsvc]         [NUMERIC](19, 5) NOT NULL, 
     [qtyrtrnd]         [NUMERIC](19, 5) NOT NULL, 
     [qtydmged]         [NUMERIC](19, 5) NOT NULL, 
     [qtyonhnd]         [NUMERIC](19, 5) NOT NULL, 
     [atyalloc]         [NUMERIC](19, 5) NOT NULL, 
     [inactive]         [TINYINT] NOT NULL, 
     [snapdate]         [DATETIME] NOT NULL 
  ) 
ON [PRIMARY] 

go 

SET ansi_padding OFF 

go 


--Setup a daily job to run this script

INSERT INTO iv00102_snapshots 
SELECT [itemnmbr], 
       [locncode], 
       [binnmbr], 
       [rcrdtype], 
       [primvndr], 
       [lsordqty], 
       [lrcptqty], 
       [lstorddt], 
       [lsordvnd], 
       [lsrcptdt], 
       [qtyrqstn], 
       [qtyonord], 
       [qtybkord], 
       [qty_drop_shipped], 
       [qtyinuse], 
       [qtyinsvc], 
       [qtyrtrnd], 
       [qtydmged], 
       [qtyonhnd], 
       [atyalloc], 
       inactive, 
       Getdate() AS SnapDate 
FROM   iv00102 

-- Change this number to increase the amount of history kept. Default is 3 years. 
DELETE FROM iv00102_snapshots 
WHERE  Getdate() - snapdate > 1095 

Wednesday, July 3, 2013

SSRS - Cannot click on Drop Down menus in Internet Explorer 10

You have to click on the Compatibility View Icon to enable the drop down menus.

The compatibility toggle is the broken page icon on the right of the address.