634:
635:
636: /* **************************************************************** */
637: /* */
638: /* The logic for the cst_item_costs and cst_item_costs_detail */
639: /* is different from the other table loads. These tables will load */
640: /* whatever data is found in their interface tables exactly as they */
641: /* are. The logic is this way because there is no unique key on */
642: /* on the cst_item_costs_detail table for us to match to a model's */
638: /* The logic for the cst_item_costs and cst_item_costs_detail */
639: /* is different from the other table loads. These tables will load */
640: /* whatever data is found in their interface tables exactly as they */
641: /* are. The logic is this way because there is no unique key on */
642: /* on the cst_item_costs_detail table for us to match to a model's */
643: /* row. */
644: /* Above logic has been changed to copy the data from the model */
645: /* in the respective org rather than keeping the same data in all */
646: /* three Orgs. It is important because these Orgs may have different*/
648: /* */
649: /* **************************************************************** */
650:
651: /* Copy the item cost attributes into the regular product table */
652: table_name := 'CST_ITEM_COSTS';
653: insert into CST_ITEM_COSTS
654: (
655: INVENTORY_ITEM_ID,
656: ORGANIZATION_ID,
649: /* **************************************************************** */
650:
651: /* Copy the item cost attributes into the regular product table */
652: table_name := 'CST_ITEM_COSTS';
653: insert into CST_ITEM_COSTS
654: (
655: INVENTORY_ITEM_ID,
656: ORGANIZATION_ID,
657: COST_TYPE_ID,
762: prg_appid, /* program_application_id */
763: prg_id, /* program_id */
764: SYSDATE
765: from
766: CST_ITEM_COSTS C,
767: MTL_PARAMETERS MP1,
768: MTL_PARAMETERS MP2,
769: MTL_SYSTEM_ITEMS_INTERFACE SI
770: where C.ORGANIZATION_ID = MP1.ORGANIZATION_ID
984: from
985: MTL_SYSTEM_ITEMS_INTERFACE SI,
986: MTL_PARAMETERS MP1,
987: MTL_PARAMETERS MP2,
988: CST_ITEM_COSTS C
989: where
990: C.ORGANIZATION_ID = MP1.ORGANIZATION_ID
991: and C.INVENTORY_ITEM_ID = SI.COPY_ITEM_ID
992: and C.COST_TYPE_ID = MP1.primary_cost_method /*Average FIFO/LIFO Costing */
1658: and (si.organization_id = ri2.organization_id or
1659: ri2.organization_id is NULL)
1660: and si.set_id = TO_CHAR(to_number(USERENV('SESSIONID'))));
1661:
1662: table_name := 'CST_ITEM_COSTS_INTERFACE';
1663: delete from CST_ITEM_COSTS_INTERFACE ci
1664: where ci.rowid in ( select ci2.rowid
1665: from CST_ITEM_COSTS_INTERFACE ci2,
1666: MTL_SYSTEM_ITEMS_INTERFACE si
1659: ri2.organization_id is NULL)
1660: and si.set_id = TO_CHAR(to_number(USERENV('SESSIONID'))));
1661:
1662: table_name := 'CST_ITEM_COSTS_INTERFACE';
1663: delete from CST_ITEM_COSTS_INTERFACE ci
1664: where ci.rowid in ( select ci2.rowid
1665: from CST_ITEM_COSTS_INTERFACE ci2,
1666: MTL_SYSTEM_ITEMS_INTERFACE si
1667: where si.inventory_item_id = ci2.inventory_item_id
1661:
1662: table_name := 'CST_ITEM_COSTS_INTERFACE';
1663: delete from CST_ITEM_COSTS_INTERFACE ci
1664: where ci.rowid in ( select ci2.rowid
1665: from CST_ITEM_COSTS_INTERFACE ci2,
1666: MTL_SYSTEM_ITEMS_INTERFACE si
1667: where si.inventory_item_id = ci2.inventory_item_id
1668: and si.organization_id = ci2.organization_id
1669: and si.set_id = TO_CHAR(to_number(USERENV('SESSIONID'))));