Wednesday, February 14, 2018

Dynamics GP - PSTL Item Site Combiner - Delete existing transfers between sites

--PSTL Item Site combiner cannot run if there are transfers between the two sites you are trying to combine.
--Delete all transfer transactions in the IV30200 that move stock between the two locations you're trying to combine

IV30200 Trx Hist Header
IV30300 Trx Amount History
IV30301 Trx Amount Detail History
IV30500 Distribution History

--------------------------------------------------------------------------------------
declare @LOC1 as varchar(20) = 'WIP'
,@LOC2 as varchar(20) = 'MACOYA'

Select * from IV30200
--DELETE * from IV30200
WHERE IVDOCTYP = 3 and DOCNUMBR IN (
--Find all Transaction lines between the two locations
select DOCNUMBR from IV30300 where ((TRXLOCTN = @LOC1 and TRNSTLOC = @LOC2 and DOCTYPE = 3) OR
(TRXLOCTN = @LOC2 and TRNSTLOC = @LOC1 and DOCTYPE = 3))
)

Select * from IV30301
--DELETE * from IV30301
WHERE DOCTYP = 3 and DOCNUMBR IN (
--Find all Transaction lines between the two locations
select DOCNUMBR from IV30300 where ((TRXLOCTN = @LOC1 and TRNSTLOC = @LOC2 and DOCTYPE = 3) OR
(TRXLOCTN = @LOC2 and TRNSTLOC = @LOC1 and DOCTYPE = 3))
)

Select * from IV30500
--DELETE * from IV30500
WHERE IVDOCTYP = 3 and DOCNUMBR IN (
--Find all Transaction lines between the two locations
select DOCNUMBR from IV30300 where ((TRXLOCTN = @LOC1 and TRNSTLOC = @LOC2 and DOCTYPE = 3) OR
(TRXLOCTN = @LOC2 and TRNSTLOC = @LOC1 and DOCTYPE = 3))
)

Select * from IV30300
--DELETE * from IV30300
WHERE DOCTYP = 3 and DOCNUMBR IN (
--Find all Transaction lines between the two locations
select DOCNUMBR from IV30300 where ((TRXLOCTN = @LOC1 and TRNSTLOC = @LOC2 and DOCTYPE = 3) OR
(TRXLOCTN = @LOC2 and TRNSTLOC = @LOC1 and DOCTYPE = 3))
)

No comments:

Post a Comment