csi_item_instance_pub.update_item_instance
SET SERVEROUTPUT ON SIZE 1000000;
DECLARE
CURSOR cur_ib IS
SELECT
instance_id,
inventory_item_id item_id,
system_id,
object_version_number,
external_reference,
serial_number,
last_oe_order_line_id,
attribute10
FROM
csi_item_instances csi
WHERE 1=1
and csi.instance_id = 9710652--9710653
;
--
l_external_reference VARCHAR2(50);
l_instance_id NUMBER;
l_object_version_number NUMBER;
l_end_user VARCHAR2(100);
v_instance_rec csi_datastructures_pub.instance_rec;
v_ext_attrib_values_tbl csi_datastructures_pub.extend_attrib_values_tbl;
v_party_tbl csi_datastructures_pub.party_tbl;
v_account_tbl csi_datastructures_pub.party_account_tbl;
v_pricing_attrib_tbl csi_datastructures_pub.pricing_attribs_tbl;
v_org_assignments_tbl csi_datastructures_pub.organization_units_tbl;
v_asset_assignment_tbl csi_datastructures_pub.instance_asset_tbl;
v_txn_rec csi_datastructures_pub.transaction_rec;
v_instance_id_lst csi_datastructures_pub.id_tbl;
v_status_code VARCHAR2(100);
t_output VARCHAR2(1000);
v_return_status VARCHAR2(1000);
v_msg_dummy VARCHAR2(1000);
v_msg_count NUMBER;
v_msg_data VARCHAR2(1000);
l_system_id csi_item_instances.system_id%TYPE;
BEGIN
--
FOR rec_ib IN cur_ib LOOP
dbms_output.put_line('instance_id = ' || rec_ib.instance_id);
BEGIN
v_instance_rec.instance_id := rec_ib.instance_id;
v_instance_rec.active_end_date := '01-JUN-2023';
v_instance_rec.object_version_number := rec_ib.object_version_number;
v_txn_rec.transaction_id := NULL;
v_txn_rec.transaction_date := sysdate;
v_txn_rec.source_transaction_date := sysdate;
v_txn_rec.transaction_type_id := 1;
--v_txn_rec.txn_sub_type_id := NULL;
csi_item_instance_pub.update_item_instance(1,
fnd_api.g_false,
fnd_api.g_false,
fnd_api.g_valid_level_full,
v_instance_rec,
v_ext_attrib_values_tbl,
v_party_tbl,
v_account_tbl,
v_pricing_attrib_tbl,
v_org_assignments_tbl,
v_asset_assignment_tbl,
v_txn_rec,
v_instance_id_lst,
v_return_status,
v_msg_count,
v_msg_data);
DBMS_OUTPUT.put_line ('v_return_status = ' || v_return_status);
IF v_return_status != 'S' THEN
--
IF v_msg_count > 0 THEN
FOR j IN 1..v_msg_count LOOP
fnd_msg_pub.get(j, fnd_api.g_false,
v_msg_data,
v_msg_dummy);
t_output := ( 'Msg'
|| to_char(j)
|| ': '
|| v_msg_data );
dbms_output.put_line(substr(t_output, 1,
255));
END LOOP;
END IF;
-- DBMS_OUTPUT.put_line ('v_return_status = ' || v_return_status);
END IF;
--
IF v_return_status = 'S' THEN
COMMIT;
ELSE
ROLLBACK;
END IF;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('exception v_return_status = ' || v_return_status);
END;
END LOOP;
END;
/