Blog

Our latest posts and rants

Dynamics GP logo

Troubleshooting Sales Documents that Do Not Pass Through Dynamics GP Integration Manager

Have you ever tried to pass a sales document through Integration Manager into Microsoft Dynamics GP, only to be met with failure and an unhelpful, non-specific error message?

Me too.

We integrate many sales invoices into Dynamics GP every day. We’ve had them fail due to lack of available customer credit, because items were not defined, because account numbers were missing, because default pricing was missing, because there was no location assigned to an item, etc., etc.

Here’s a way to troubleshoot this situation that has yet to let me down (knock on wood).

A doctor using a stethoscope to listen to a patient's chest

If all else fails, enter the sales document by hand.

You should get an error message when you hit on the problem line item. And the error message that GP gives you is virtually certain to be more informative than the error message Integration Manager gives you. A better error message makes it that much easier to find and fix the problem.

Hope this tip helps!

Scholar

A Good Online Educational Resource (Coursera)

This blog is aimed at other technical people like me. Most of us understand the need for life long education.

There are a lot of choices available right now. I thought I’d give a shout out to one I’ve been using lately, Coursera.

Coursera Logo

Their website is at http://www.coursera.org

If I’m looking for a lesson on a specific tool or technique I look elsewhere. I have annual subscriptions to a couple of more specialized sites. But when I want to learn something fundamental, or get a refresher on something I vaguely remember from school, this site is great. And it is free.

Plus I see no reason why some of the courses on the signature track would not qualify as continuing education for people like me who need to be concerned about that.

Like I say, I just wanted to help get out the word about a worthwhile site. Hope this is helpful!

Dynamics GP logo

Dynamics GP Payables Batch Will Not Post

Here’s another post that isn’t rocket science but might save someone some time and effort.

We had a payables batch that gave an error message when our user tried to post it. Batch recovery did not help. Our user could not tell what transactions were contained in the batch, because we could not open the batch and look.

GPStuckPayablesBatch

This SQL query showed us the batch transactions. I’ve used XYZ for the batch name.

select * 
from pm10000
where bachnumb='XYZ'

From there, our user was able to check the status of each document and fix the problem.

Hope this saves someone a little time!

Dynamics GP logo

Dynamics GP: List Items Having Distribution History

Here’s a very simple query that lists all items having a distribution history in Dynamics GP 2013:

SELECT DISTINCT ITEMNMBR FROM IV30500 ORDER BY ITEMNMBR;

Which looks like this:

Sample showing 1 column

You can get more sophisticated and show which type(s) of distributions each item has like this:

select
  itemnmbr,
  case ivdoctyp
    when 1 then 'Inventory Adjustment'
    when 2 then 'Variance'
    when 3 then 'Inventory Transfer'
    when 4 then 'Purchase Receipt'
    when 5 then 'Sales Return'
    when 6 then 'Sales Invoice'
    when 7 then 'Assembly'
    when 8 then 'Inventory Cost Adjustment from POP Shipment (GLTRX)'
    when 11 then 'Inventory Cost Adjustment from POP Invoice (POIVC)'
    else 'Document Type ' + cast(ivdoctyp as varchar(12))
  end as InventoryDocumentType,
  count(*) as HowManyEntries
from iv30500
group by itemnmbr,ivdoctyp
order by itemnmbr,ivdoctyp
;

Which looks like this:

Sample showing 3 columns

The document types are taken from one of Victoria Yudin’s fantastic web pages, http://victoriayudin.com/gp-tables/inventory-tables/

Maybe this will save someone a few minutes of searching.

SQL Server

Searching for a String in Microsoft SQL Server

This might be useful to someone else. Here’s a stored procedure to search all columns of all tables in the current database for a string.

Find that string, Watson!

Find that string, Watson!

CREATE procedure [dbo].[SSC_FindExactStringInDatabase]
(
@target varchar(128), -- string to find
@schema varchar(128) = '%', -- percent for all schemas
@table varchar(128) = '%', -- percent for all tables
@column varchar(128) = '%', -- percent for all columns
@timelimitseconds bigint = 43200 -- the procedure should stop after this many seconds have elapsed. 43200 seconds is 12 hours.
)

as

begin

-- Database name
declare @dbname varchar(128);
-- Schema name
declare @schemaname varchar(128);
-- Table name
declare @tablename varchar(128);
-- Column name
declare @columnname varchar(128);
-- SQL statement to be executed
declare @stmt nvarchar(1024);
-- Count of hits
declare @kount bigint;
-- Loop counter, char(@loopcount) is the particular unprintable character being checked/fixed
declare @loopcount integer;
-- Table for the hits
declare @Hits table (dbname varchar(128), schemaname varchar(128), tablename varchar(128), columnname varchar(128), kount bigint);
-- Timer
declare @starttime datetime;
set @starttime = current_timestamp;

-- Loop through all columns in all tables in all schemas in the specified database
declare colcurs cursor for
select
db_name() as dbname,
h.name as schemaname,
t.name as tablename,
c.name as columnname

from sys.tables t join sys.columns c on t.object_id=c.object_id
join sys.types y on c.system_type_id=y.system_type_id
join sys.schemas h on t.schema_id=h.schema_id
where t.type='U'
and h.name like @schema
and t.name like @table
and c.name like @column
and y.name in ('char','varchar')
order by dbname, schemaname, tablename, columnname;

open colcurs;

fetch next from colcurs into @dbname, @schemaname, @tablename, @columnname;

while (@@fetch_status = 0) and (datediff(second, @starttime, current_timestamp) < @timelimitseconds)
begin

set @stmt =
'select @kountOut=count(*) from [' +
rtrim(@dbname) + '].[' + rtrim(@schemaname) + '].[' + rtrim(@tablename) +
'] where [' + rtrim(@columnname) +'] = ''' + @target + ''';';

execute sp_executesql @stmt, N'@kountOut bigint output', @kountOut=@kount output;

-- Remember the non-zero counts
insert into @Hits
select @dbname, @schemaname, @tablename, @columnname, @kount
where @kount>0;

-- end of loop through columns
fetch next from colcurs into @dbname, @schemaname, @tablename, @columnname;
end;

close colcurs;
deallocate colcurs;

-- Finish by returning the counts in the result set
select * from @Hits;

end;

The stored procedure as defined above limits the target string to ANSI characters of length 128 or shorter, but you can adapt it as necessary. It also does not search TEXT columns, just CHAR and VARCHAR.

You’d invoke the stored procedure like this:

execute SSC_FindExactStringInDatabase 'XYZ132';

The result will look something like this:

Sample output from executing the stored procedure in SSMS, showing 5 columns

You can find a copy of this stored procedure in GitHub at https://github.com/RickKohler/SQLServer