declare
-- 426 is ABC HO CONSUMABLE warehouse, want to transfer XYZ, item 426 from org 0 to ABC HO Consumable
v_org_id_to number := 0; ---1265
v_org_id_from number := 0;
cursor c_item is
select
inventory_item_id, segment1, organization_id,
item_type, revision_qty_control_code,
must_use_approved_vendor_flag, inventory_planning_code,
planner_code, planning_make_buy_code, fixed_days_supply,
mrp_planning_code, planning_exception_set, shrinkage_rate,
preprocessing_lead_time, fixed_lead_time, attribute2,
attribute4, attribute1, postprocessing_lead_time, buyer_id,
attribute15, description, 1 process_flag, 'UPDATE' transaction_type
from mtl_system_items_b
--where inventory_item_id = 275
where organization_id = v_org_id_from and segment1 in (select item_code from mtl_items_sample);
v_item c_item%ROWTYPE;
begin
open c_item;
loop
fetch c_item into v_item;
exit when c_item%NOTFOUND;
-- insert into mtl_system_items_interface table
insert into mtl_system_items_interface
(
inventory_item_id, segment1,
item_type, revision_qty_control_code,
must_use_approved_vendor_flag, inventory_planning_code,
planner_code, planning_make_buy_code, fixed_days_supply,
mrp_planning_code, planning_exception_set, shrinkage_rate,
preprocessing_lead_time, fixed_lead_time, attribute2,
attribute4, attribute1, postprocessing_lead_time, buyer_id,
attribute15, description, process_flag,transaction_type, organization_id
)
values
(
v_item.inventory_item_id, v_item.segment1,
v_item.item_type, v_item.revision_qty_control_code,
v_item.must_use_approved_vendor_flag, v_item.inventory_planning_code,
v_item.planner_code, v_item.planning_make_buy_code, v_item.fixed_days_supply,
v_item.mrp_planning_code, v_item.planning_exception_set, v_item.shrinkage_rate,
v_item.preprocessing_lead_time, v_item.fixed_lead_time, v_item.attribute2,
v_item.attribute4, v_item.attribute1, v_item.postprocessing_lead_time, v_item.buyer_id,
v_item.attribute15, v_item.description,v_item.process_flag,v_item.transaction_type,v_org_id_to
);
end loop;
close c_item;
exception
when others then
dbms_output.put_line(sqlerrm);
end;
----------------------------------------------------------------------------------
select * from mtl_system_items_b where segment1 in
(select segment1 from mtl_system_items_interface)
and organization_id = 0
select * from mtl_system_items_interface --where segment1 = '002000100006'
--delete from mtl_system_items_interface
update mtl_system_items_interface
set set_process_id = 1
update mtl_system_items_interface
set process_flag = 1
------------------------------------
CREATE TABLE MTL_ITEMS_SAMPLE
(
DESCRIPTION VARCHAR2(200 BYTE),
ITEM_CODE VARCHAR2(100 BYTE)
)
-----------------------------------
CREATE UNIQUE INDEX MTL_ITEMS_SAMPLE_U01 ON APPS.MTL_ITEMS_SAMPLE
(ITEM_CODE)
-----------------------------------
-- 426 is ABC HO CONSUMABLE warehouse, want to transfer XYZ, item 426 from org 0 to ABC HO Consumable
v_org_id_to number := 0; ---1265
v_org_id_from number := 0;
cursor c_item is
select
inventory_item_id, segment1, organization_id,
item_type, revision_qty_control_code,
must_use_approved_vendor_flag, inventory_planning_code,
planner_code, planning_make_buy_code, fixed_days_supply,
mrp_planning_code, planning_exception_set, shrinkage_rate,
preprocessing_lead_time, fixed_lead_time, attribute2,
attribute4, attribute1, postprocessing_lead_time, buyer_id,
attribute15, description, 1 process_flag, 'UPDATE' transaction_type
from mtl_system_items_b
--where inventory_item_id = 275
where organization_id = v_org_id_from and segment1 in (select item_code from mtl_items_sample);
v_item c_item%ROWTYPE;
begin
open c_item;
loop
fetch c_item into v_item;
exit when c_item%NOTFOUND;
-- insert into mtl_system_items_interface table
insert into mtl_system_items_interface
(
inventory_item_id, segment1,
item_type, revision_qty_control_code,
must_use_approved_vendor_flag, inventory_planning_code,
planner_code, planning_make_buy_code, fixed_days_supply,
mrp_planning_code, planning_exception_set, shrinkage_rate,
preprocessing_lead_time, fixed_lead_time, attribute2,
attribute4, attribute1, postprocessing_lead_time, buyer_id,
attribute15, description, process_flag,transaction_type, organization_id
)
values
(
v_item.inventory_item_id, v_item.segment1,
v_item.item_type, v_item.revision_qty_control_code,
v_item.must_use_approved_vendor_flag, v_item.inventory_planning_code,
v_item.planner_code, v_item.planning_make_buy_code, v_item.fixed_days_supply,
v_item.mrp_planning_code, v_item.planning_exception_set, v_item.shrinkage_rate,
v_item.preprocessing_lead_time, v_item.fixed_lead_time, v_item.attribute2,
v_item.attribute4, v_item.attribute1, v_item.postprocessing_lead_time, v_item.buyer_id,
v_item.attribute15, v_item.description,v_item.process_flag,v_item.transaction_type,v_org_id_to
);
end loop;
close c_item;
exception
when others then
dbms_output.put_line(sqlerrm);
end;
----------------------------------------------------------------------------------
select * from mtl_system_items_b where segment1 in
(select segment1 from mtl_system_items_interface)
and organization_id = 0
select * from mtl_system_items_interface --where segment1 = '002000100006'
--delete from mtl_system_items_interface
update mtl_system_items_interface
set set_process_id = 1
update mtl_system_items_interface
set process_flag = 1
------------------------------------
CREATE TABLE MTL_ITEMS_SAMPLE
(
DESCRIPTION VARCHAR2(200 BYTE),
ITEM_CODE VARCHAR2(100 BYTE)
)
-----------------------------------
CREATE UNIQUE INDEX MTL_ITEMS_SAMPLE_U01 ON APPS.MTL_ITEMS_SAMPLE
(ITEM_CODE)
-----------------------------------
No comments:
Post a Comment