PROCEDURE csi_expire_relationship( p_object_id IN NUMBER)
IS
l_relationship_rec csi_datastructures_pub.ii_relationship_rec;
l_txn_rec csi_datastructures_pub.transaction_rec;
x_instance_id_lst csi_datastructures_pub.id_tbl;
l_msg_index_out NUMBER;
l_return_msg VARCHAR2(4000);
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(500);
CURSOR rel_cur
IS
SELECT relationship_id
, object_version_number
FROM csi_ii_relationships
WHERE object_id = p_object_id
AND relationship_type_code = 'COMPONENT-OF'
AND NVL(active_end_date, SYSDATE + 1) > SYSDATE;
BEGIN
FOR rel_rec IN rel_cur
LOOP
l_relationship_rec.relationship_id := rel_rec.relationship_id;
l_relationship_rec.object_version_number:= rel_rec.object_version_number;
l_txn_rec.transaction_id := NULL;
l_txn_rec.transaction_date := SYSDATE;
l_txn_rec.source_transaction_date := SYSDATE;
l_txn_rec.transaction_type_id := 1;
fnd_msg_pub.initialize;
csi_ii_relationships_pub.expire_relationship(
p_api_version => 1.0
, p_commit => fnd_api.g_false
, p_init_msg_list => fnd_api.g_true
, p_validation_level => fnd_api.g_valid_level_full
, p_relationship_rec => l_relationship_rec
, p_txn_rec => l_txn_rec
, x_instance_id_lst => x_instance_id_lst
, x_return_status => x_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data);
IF x_return_status = fnd_api.g_ret_sts_success
THEN
DBMS_OUTPUT.put_line( 'Expired relationship Successfully ');
COMMIT;
ELSE
IF x_msg_count > 0
THEN
FOR i IN 1 .. x_msg_count
LOOP
fnd_msg_pub.get(
p_msg_index => i
, p_encoded => fnd_api.g_false
, p_data => x_msg_data
, p_msg_index_out => l_msg_index_out);
IF l_return_msg IS NULL
THEN
l_return_msg :=
l_msg_index_out
|| ':'
|| x_msg_data;
ELSE
l_return_msg :=
l_return_msg
|| '/'
|| l_msg_index_out
|| ':'
|| x_msg_data;
END IF;
END LOOP;
END IF;
DBMS_OUTPUT.put_line('Expire instance relationship API failure : ' || NVL(l_return_msg, x_msg_data));
END IF;
END LOOP;
END;
IS
l_relationship_rec csi_datastructures_pub.ii_relationship_rec;
l_txn_rec csi_datastructures_pub.transaction_rec;
x_instance_id_lst csi_datastructures_pub.id_tbl;
l_msg_index_out NUMBER;
l_return_msg VARCHAR2(4000);
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(500);
CURSOR rel_cur
IS
SELECT relationship_id
, object_version_number
FROM csi_ii_relationships
WHERE object_id = p_object_id
AND relationship_type_code = 'COMPONENT-OF'
AND NVL(active_end_date, SYSDATE + 1) > SYSDATE;
BEGIN
FOR rel_rec IN rel_cur
LOOP
l_relationship_rec.relationship_id := rel_rec.relationship_id;
l_relationship_rec.object_version_number:= rel_rec.object_version_number;
l_txn_rec.transaction_id := NULL;
l_txn_rec.transaction_date := SYSDATE;
l_txn_rec.source_transaction_date := SYSDATE;
l_txn_rec.transaction_type_id := 1;
fnd_msg_pub.initialize;
csi_ii_relationships_pub.expire_relationship(
p_api_version => 1.0
, p_commit => fnd_api.g_false
, p_init_msg_list => fnd_api.g_true
, p_validation_level => fnd_api.g_valid_level_full
, p_relationship_rec => l_relationship_rec
, p_txn_rec => l_txn_rec
, x_instance_id_lst => x_instance_id_lst
, x_return_status => x_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data);
IF x_return_status = fnd_api.g_ret_sts_success
THEN
DBMS_OUTPUT.put_line( 'Expired relationship Successfully ');
COMMIT;
ELSE
IF x_msg_count > 0
THEN
FOR i IN 1 .. x_msg_count
LOOP
fnd_msg_pub.get(
p_msg_index => i
, p_encoded => fnd_api.g_false
, p_data => x_msg_data
, p_msg_index_out => l_msg_index_out);
IF l_return_msg IS NULL
THEN
l_return_msg :=
l_msg_index_out
|| ':'
|| x_msg_data;
ELSE
l_return_msg :=
l_return_msg
|| '/'
|| l_msg_index_out
|| ':'
|| x_msg_data;
END IF;
END LOOP;
END IF;
DBMS_OUTPUT.put_line('Expire instance relationship API failure : ' || NVL(l_return_msg, x_msg_data));
END IF;
END LOOP;
END;
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.