After Removing Fixed Asset Management Tables Add Entry To DB_Upgrade

Microsoft Dynamics GPIn the previous post, I posted a SQL script which can be used to delete all tables from a MIcrosoft Dynamics GP implementation for a specified product. That script will generate you the drop and delete commands required to remove a product, but may, for some products, still cause an error if you try to add the product again. I don’t have a screenshot of the error, but it is one where GP Utilities complains the module is too old to upgrade.

This is the case for Fixed Asset Management (FAM); I’ve also had the same problem when adding FAM for the first time. The below script can be used to add an entry to the DB_Upgrade table which will resolve the error.

The highlighted parameters, at the top of the script, will need to be defined; the versions should be the same as the products installed in Dynamics GP; I would avoid setting them to the same as the Dynamics GP product id as this is often different to the other features.

For fixed assets on Microsoft Dynamics GP 2016 R1, the major version and build number are set to 16 and 389 respectively.

If you have already tried to run GP Utilities, a row will have been inserted into DB_Upgrade table which will need to be upgraded.

But worry not, the script will update an existing row or insert a new one as appropriate.

Before running the script make sure that the update statement will not overwrite existing data with an invaoid value.

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (https://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
USE D16R1
GO

DECLARE @PRODID INT = 309
DECLARE @db_verMajor INT = 16
DECLARE @db_verBuild INT = 389

UPDATE DB_Upgrade SET db_verMajor = @db_verMajor, db_verBuild = @db_verBuild,db_verOldMajor = @db_verMajor, db_verOldBuild = @db_verBuild WHERE db_name = DB_NAME() AND PRODID = @PRODID

IF (SELECT COUNT(*) FROM DB_Upgrade WHERE db_name = DB_NAME() AND PRODID = @PRODID) = 0
	INSERT INTO DB_Upgrade (db_name,PRODID,db_verMajor,db_verMinor,db_verBuild,db_verOldMajor,db_verOldMinor,db_verOldBuild,db_status) VALUES (DB_NAME(),@PRODID,@db_verMajor,0,@db_verBuild,@db_verMajor,0,@db_verBuild,0)
GO

SQL Script To Remove Fixed Asset Management Tables

Microsoft Dynamics GPEvery so often when doing an upgrade, or implementing a module, for a client, we encounter errors when doing the GP Utilities database upgrade. This time round we encountered the error when implementing Fixed Asset Management (FAM) in Microsoft Dynamics GP 2015 R2.

We had previously upgraded the client from Dynamics GP 2010 R2 where they had not been using Fixed Asset Management and never had. However, despite the feature not being installed in Dynamics GP 2010 R2 and the client never knowing having used it, there were tables for Fixed Asset Management in their of the 20+ company databases; this looks like one of their previous partners had done something odd when creating these companies.

The solution in this case was to remove all of the Fixed Asset Management tables from the database. When I have done this type of thing before I have manually written scripts to do this, but have tired of doing so (the previous time I had to do this it was the HR modules.

So I wrote a simple script using a cursor which is run against the system database and which loops through all of the company databases and generates delete scripts for all of the tables for the designated module.

It also generates scripts to delete the rows from the DU tables in the system database.

There are three parameters at the top which need to be set:

  1. The database at the top which should be a system database
  2. @PRODID which is the numeric product id; for FAM this 309
  3. @TablePrefix which is the alpha prefix to the table names, which for FAM is FA

The parameters are not authenticated or verified in any so oyu need to make sure the product id and table prefix are correct before proceeding.

When the script is run, output it to Text which will give you a series of DROP TABLE commands you can then verify you are happy with the scripts before running them. I would strongly recommend checking the scripts and running them on a test system containing a copy of live first to ensure the result is what you require.

These fields have been highlighted in the, below, script:

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (https://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
USE D16R1
GO

DECLARE @PRODID INT = 309
DECLARE @TablePrefix VARCHAR(5) = 'FA'

DECLARE @SQL_Statement VARCHAR(1000)

CREATE TABLE #Scripts(
	COMMAND VARCHAR(200)
)

DECLARE
	cursor_InterID CURSOR 
FOR 
	SELECT
		RTRIM(INTERID)
	FROM
		SY01500
	UNION
		SELECT DB_NAME()
	
	OPEN cursor_InterID

	DECLARE @INTERID VARCHAR(100)

	FETCH NEXT FROM
		cursor_InterID
	INTO
		@INTERID
	WHILE (@@FETCH_STATUS <> -1)
		BEGIN
			IF (@@FETCH_STATUS <> -2)
				BEGIN
					SET @SQL_Statement = 'INSERT INTO #Scripts (COMMAND) (SELECT ''DROP TABLE ' + @INTERID + '..'' + name FROM ' + RTRIM(@INTERID) + '.sys.tables WHERE name LIKE ''' + @TablePrefix + '%'')'
					EXEC (@SQL_Statement)
				END
			FETCH NEXT FROM
				cursor_InterID
			INTO
				@INTERID
		END
	CLOSE cursor_InterID
DEALLOCATE cursor_InterID

INSERT INTO #Scripts (COMMAND) (SELECT 'DELETE FROM DB_Upgrade WHERE PRODID = ' + CAST(@PRODID AS VARCHAR(5)))
INSERT INTO #Scripts (COMMAND) (SELECT 'DELETE FROM DU000010 WHERE PRODID = ' + CAST(@PRODID AS VARCHAR(5)))
INSERT INTO #Scripts (COMMAND) (SELECT 'DELETE FROM DU000020 WHERE PRODID = ' + CAST(@PRODID AS VARCHAR(5)))
INSERT INTO #Scripts (COMMAND) (SELECT 'DELETE FROM DU000030 WHERE PRODID = ' + CAST(@PRODID AS VARCHAR(5)))
GO

SELECT COMMAND + CHAR(10) + 'GO' FROM #Scripts
GO

DROP TABLE #Scripts
GO

MDGP 2016 R2 Feature of the Day: Track Termination/Rehire Dates

Microsoft Dynamics GPThe Inside Microsoft Dynamics GP blog has started a series Feature of the Day posts for Microsoft Dynamics GP 2016 R2; as the most recent versions have been, these posts are in the form of PowerPoint slides; I am reposting them here so they can be read more easily.

The series index for this series of posts is here.

The sixteenth Feature of the Day is Track history on Termination and Rehire Dates in Human Resources.

A new option called Employment History has been introduced which is accessed from Employee Maintenance:

Employment History Inquiry

Click to show/hide the MDGP 2016 R2 Feature of the Day Series Index

MDGP 2016 R2 Feature of the Day: Save Fixed Asset ID With Suffix

Microsoft Dynamics GPThe Inside Microsoft Dynamics GP blog has started a series Feature of the Day posts for Microsoft Dynamics GP 2016 R2; as the most recent versions have been, these posts are in the form of PowerPoint slides; I am reposting them here so they can be read more easily.

The series index for this series of posts is here.

The fifteenth Feature of the Day is Save Fixed Asset ID with Suffix.

Asset General Information

This feature puzzled me a little, as I thought you could already do this, so I gave it a quick try in 2016 R1. You can do it, but GP doesn’t really want you to.

Click to show/hide the MDGP 2016 R2 Feature of the Day Series Index

MDGP 2016 R2 Feature of the Day: Payroll Admin Can Print W2 Using Self Service Report

Microsoft Dynamics GPThe Inside Microsoft Dynamics GP blog has started a series Feature of the Day posts for Microsoft Dynamics GP 2016 R2; as the most recent versions have been, these posts are in the form of PowerPoint slides; I am reposting them here so they can be read more easily.

The series index for this series of posts is here.

The fourteenth Feature of the Day is Payroll Admin can print W2 using Self Service report.

With this feature of the day, the W2 can be printed without using the pre-printed forms.

Print W-2 Forms

Click to show/hide the MDGP 2016 R2 Feature of the Day Series Index

MDGP 2016 R2 Feature of the Day: POP to FA Link to Include Taxes

Microsoft Dynamics GPThe Inside Microsoft Dynamics GP blog has started a series Feature of the Day posts for Microsoft Dynamics GP 2016 R2; as the most recent versions have been, these posts are in the form of PowerPoint slides; I am reposting them here so they can be read more easily.

The series index for this series of posts is here.

The thirteenth Feature of the Day is POP to FA link to include taxes.

An option to include tax as part of the acquisition cost when adding a capital item in Fixed Assets from a purchase receipt.

The first change is to the Fixed Assets Company Setup window which sets the default value:

Fixed Assets Company Setup

Continue reading “MDGP 2016 R2 Feature of the Day: POP to FA Link to Include Taxes”

MDGP 2016 R2 Feature of the Day: Safe Pay File Displays Check Name From Check

Microsoft Dynamics GPThe Inside Microsoft Dynamics GP blog has started a series Feature of the Day posts for Microsoft Dynamics GP 2016 R2; as the most recent versions have been, these posts are in the form of PowerPoint slides; I am reposting them here so they can be read more easily.

The series index for this series of posts is here.

The twelvth Feature of the Day is Safe Pay file displays Check Name from Check.

This feature of the day, sets the Check Name from the check on the Safe Pay file, rather than the default from the vendor card:

Vendor Maintenance
Safepay file

Click to show/hide the MDGP 2016 R2 Feature of the Day Series Index

MDGP 2016 R2 Feature of the Day: Credit Limit Warning Calc for Unposted Credit Docs

Microsoft Dynamics GPThe Inside Microsoft Dynamics GP blog has started a series Feature of the Day posts for Microsoft Dynamics GP 2016 R2; as the most recent versions have been, these posts are in the form of PowerPoint slides; I am reposting them here so they can be read more easily.

The series index for this series of posts is here.

The eleventh Feature of the Day is Credit Limit Warning Calc for unposted Credit Docs.

This feature of the day will adjust the credit limit warning calculation when a cash receipt is entered and is applied against an outstanding invoice, but has not been posted:

Credit limit exceeded warning message

I have somewhat mixed feelings on this one and kind of hope that there is a switch to toggle this on and off based on the clients requirements.

Click to show/hide the MDGP 2016 R2 Feature of the Day Series Index

MDGP 2016 R2 Feature of the Day: Bank Rec Tracks History

Microsoft Dynamics GPThe Inside Microsoft Dynamics GP blog has started a series Feature of the Day posts for Microsoft Dynamics GP 2016 R2; as the most recent versions have been, these posts are in the form of PowerPoint slides; I am reposting them here so they can be read more easily.

The series index for this series of posts is here.

The tenth Feature of the Day is Bank Rec Tracks History.

Thre is a new process for Reconciled Transaction on the Routines menu in Financials which moves reconciled transactions to history.

Reconciled Transaction Maintenance

With data moved to history, the performance of the Bank Reconciliation processes will improve and anything which improves performance is to be welcomed.

Click to show/hide the MDGP 2016 R2 Feature of the Day Series Index

MDGP 2016 R2 Feature of the Day: Receivables/Payables Dist Line Display Expanded

Microsoft Dynamics GPThe Inside Microsoft Dynamics GP blog has started a series Feature of the Day posts for Microsoft Dynamics GP 2016 R2; as the most recent versions have been, these posts are in the form of PowerPoint slides; I am reposting them here so they can be read more easily.

The series index for this series of posts is here.

The ninth Feature of the Day is Receivables/Payables Dist Line Display Expanded.

As with the GL Distribution Line UI Change this feature of the day will default the scrolling window expanded or collapsed based on the previous display date on the Receivables Transaction Entry and Payables Transaction Entry distribution windows:

Sales Transaction Distribution Entry

Continue reading “MDGP 2016 R2 Feature of the Day: Receivables/Payables Dist Line Display Expanded”