We will update Items using Interface table MTL_SYSTEM_ITEMS_INTERFACE.
Here is a simple example of update Item using Interface table.
Example:
DECLARE
CURSOR lcur_item_update
IS
SELECT msi.segment1
,msi.inventory_item_id
,msi.organization_id
FROM mtl_system_items_b msi
WHERE organization_id = (SELECT organization_id FROM org_organization_definitions
WHERE organization_code = 'WEB')
AND UPPER(msi.inventory_item_status_code) = 'ACTIVE';
--
ln_rec_cnt NUMBER := 0;
--
BEGIN
FOR lreq_item IN lcur_item_update
LOOP
--
ln_rec_cnt := ln_rec_cnt + 1;
--
BEGIN
INSERT INTO mtl_system_items_interface
(inventory_item_id
,organization_id
,attribute7 -- Template name
--
,set_process_id
,transaction_type
,process_flag
)
VALUES( lreq_item.inventory_item_id -- inventory_item_id
,lreq_item.organization_id -- organization_id
,'ServiceGoods' -- attribute7
,1234 -- set_process_id
,'UPDATE' -- transaction_type
,1 -- process_flag
);
EXCEPTION
WHEN others THEN
dbms_output.put_line('Error in insert data for ItemID: '||lreq_item.inventory_item_id||'--'||SQLERRM);
ROLLBACK;
END;
COMMIT;
END LOOP;
--
dbms_output.put_line('Total Records inserted in Interface: '||ln_rec_cnt);
EXCEPTION
WHEN others THEN
dbms_output.put_line('Error in block: '||sqlerrm);
END;
/
--------------------------------------------------------------
Once record inserted in interface table then Run "Import Items" program.
After program completed normally then check updated data in Base table.
SELECT * FROM mtl_system_items_b
WHERE inventory_item_id = 2324
AND organization_id = 123
AND last_update_date LIKE sysdate;
If Import program completed with error then check error message in Interface error table using transaction ID:
SELECT * FROM mtl_interface_errors
WHERE transaction_id = 4533567;
* Transaction ID get from MTL_SYSTEM_ITEMS_INTERFACE table using Inventory_item_id and set_process_id.
SELECT transaction_id FROM MTL_SYSTEM_ITEMS_INTERFACE
WHERE set_process_id = 1234
AND inventory_item_id = 2324
AND organization_id = 123;
Thanks..
No comments:
Post a Comment