A quick way to duplicate or copy of PRICELEVEL SET in Microsoft Dynamics GP


Use this command to easily duplicate a pricelevel in GP DYNAMICS. You just need to specify the pricelevel code you want to copy, and the new pricelevelcode and its description. In the example below, 'RETAIL' is the code of the existing pricelevel. The script will copy that into a new pricelevel whose pricelevel code is 'WHOLESALE', and description as 'WHOLESALE CUSTOME PRICING'. Note: in the code, any text preceeded with a "--" is a comment.

SQL Command:

declare
  @source_pricelevelcode varchar(250),
  @new_pricelevelcode varchar(250),
  @new_priceleveldesc varchar(250)

SET @source_pricelevel = 'RETAIL'  -- SET YOUR SOURCE PRICELEVEL CODE
SET @new_pricelevel = 'WHOLESALE'  -- SET YOUR NEW PRICELEVEL CODE
SET @new_priceleveldesc = 'WHOLESALE CUSTOME PRICING' -- SET YOUR NEW PRICELEVEL DESCRIPTION


-- PROCEED TO COPY PRICELEVEL SET INTO ANOTHER, THERE ARE 3 TABLES INVOLVED

INSERT INTO iv00108(ITEMNMBR, CURNCYID, PRCLEVEL, UOFM, TOQTY, FROMQTY, UOMPRICE, QTYBSUOM)
SELECT ITEMNMBR, CURNCYID, @new_pricelevelcode, UOFM, TOQTY, FROMQTY, UOMPRICE, QTYBSUOM
FROM iv00108
where prclevel = @source_pricelevelcode

INSERT INTO iv00107 (ITEMNMBR, CURNCYID, PRCLEVEL, UOFM, RNDGAMNT, ROUNDHOW, ROUNDTO, UMSLSOPT, QTYBSUOM)
select ITEMNMBR, CURNCYID, @new_pricelevelcode, UOFM, RNDGAMNT, ROUNDHOW, ROUNDTO, UMSLSOPT, QTYBSUOM
from iv00107
where prclevel = @source_pricelevelcode

INSERT iv40800 (PRCLEVEL, DSCRIPTN)
VALUES (@new_pricelevelcode, @new_priceleveldesc)

No comments:

Post a Comment