During the load, you could build a mapping table for the cost values for the components and then use ApplyMap to assign the costs to the products.
Another option would be to load the components with their costs in a separate table and associate the components to the products via the component ID. Then in a table using the products (and optionally the components) as dimensions, you could simply sum the costs.
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein