I was doing some work for a client recently where we were loading lists of new creditors into Microsoft Dynamics GP from CSV files via Integration Manager. There is, however, a bug in IM 10 where it adds extra zeros to the phone and fax number fields of both creditors and debtors. These extra characters are, rather bizarrely, not always at the end but can be interspersed in the phone number.
The easiest work around was to put together a SQL script for loading the phone and fax numbers from CSV file which I did while on site which updated only a single address on the PM Creditor Master (PM00200) and PM Address Master (PM00300) tables.
While the script I wrote on site satisfied the clients immediate import needs, the script was very basic. To make things easier in future I have created a new script which can update multiple addresses as the same time while making sure both PM00200 and PM00300 are correctly in sync;
CREATE TABLE #NewCreditorAddressMaster
(
VENDORID VARCHAR(100)
,ADRSCODE VARCHAR(100)
,PHNUMBR1 VARCHAR(100)
,PHNUMBR2 VARCHAR(100)
,PHONE3 VARCHAR(100)
,FAXNUMBR VARCHAR(100)
)
GO
BULK INSERT
#NewCreditorAddressMaster
FROM
'c:\temp\Creditors.csv'
WITH
(
FIELDTERMINATOR = ','
,ROWTERMINATOR = '\n'
)
GO
UPDATE
['PM Address Master']
SET
PHNUMBR1 = Left(#NewCreditorAddressMaster.PHNUMBR1, 14)
,PHNUMBR2 = Left(#NewCreditorAddressMaster.PHNUMBR2, 14)
,PHONE3 = Left(#NewCreditorAddressMaster.PHONE3, 14)
,FAXNUMBR = Left(#NewCreditorAddressMaster.FAXNUMBR, 14)
FROM
PM00300 AS ['PM Address Master']
INNER JOIN
#NewCreditorAddressMaster
ON #NewCreditorAddressMaster.VENDORID = ['PM Address Master'].VENDORID
AND #NewCreditorAddressMaster.ADRSCODE = ['PM Address Master'].ADRSCODE
UPDATE
['PM Creditor Master']
SET
PHNUMBR1 = LEFT(['PM Address Master'].PHNUMBR1, 14)
,PHNUMBR2 = LEFT(['PM Address Master'].PHNUMBR2, 14)
,PHONE3 = LEFT(['PM Address Master'].PHONE3, 14)
,FAXNUMBR = LEFT(['PM Address Master'].FAXNUMBR, 14)
FROM
PM00200 AS ['PM Creditor Master']
INNER JOIN
PM00300 AS ['PM Address Master']
ON ['PM Address Master'].VENDORID = ['PM Creditor Master'].VENDORID
AND ['PM Address Master'].ADRSCODE = ['PM Creditor Master'].VADDCDPR
DROP TABLE #NewCreditorAddressMaster
What should we write about next?
If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.
2 thoughts on “Update Creditor Addresses From CSV To Work Around An Integration Manager Bug”