In yesterday’s post about calculating a standard cost for new assemblies based on component costs, I didn’t finish the story by showing what we did to apply those calculations in GP.

A worried person

Oh no!

But not to worry, I’ll remedy that oversight today.

In our case we wanted to put the calculated costs onto the GP item card as a standard cost. So I used this expression involving the SSC_BOMCost function from yesterday’s article:

with recursiveCosts as (
select c.*
from dbo.bm00101 b
cross apply dbo.SSC_BomCost(b.itemnmbr) c
where b.ITEMNMBR like '6-%'
and b.ITEMNMBR in (
  select ITEMNMBR
  from dbo.iv00101
  where ITEMTYPE=1
  and CURRCOST=0
  and STNDCOST=0)

update x
set stndcost=z.Cost
from iv00101 x
join recursiveCosts z
on x.itemnmbr=z.OriginalItemNmbr
where itemnmbr in (
select OriginalItemNmbr
from recursiveCosts)
and z.Cost is not null

Hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *

 characters available