-- Make Sure you initialize apps and set mo_global.set_policy_context
set serveroutput on;
DECLARE
v_xref_rec hz_orig_system_ref_pub.orig_sys_reference_rec_type;
v_object_version_number NUMBER :=1 ;
v_return_status VARCHAR2 (240);
v_msg_count NUMBER;
v_msg_data VARCHAR2 (4000);
v_error_message VARCHAR2 (4000) := NULL;
BEGIN
v_error_message := NULL;
v_return_status := NULL;
v_msg_count := NULL;
v_msg_data := NULL;
v_xref_rec.orig_system := 'Legacy System';
v_xref_rec.orig_system_reference := '00138888'; --New OSR
v_xref_rec.owner_table_name := 'HZ_PARTY_SITES';
v_xref_rec.owner_table_id := '3578'; --Party Site ID
v_xref_rec.old_orig_system_reference := '00138AA2'; --Old OSR
v_xref_rec.created_by_module := 'HZ_IMPORT';
hz_orig_system_ref_pub.update_orig_system_reference (
p_init_msg_list => fnd_api.g_true,
p_orig_sys_reference_rec => v_xref_rec,
p_object_version_number => v_object_version_number,
x_return_status => v_return_status,
x_msg_count => v_msg_count,
x_msg_data => v_msg_data
);
commit;
IF v_return_status <> fnd_api.g_ret_sts_success
THEN
IF v_msg_count > 1
THEN
FOR i IN 1 .. v_msg_count
LOOP
v_error_message := (v_error_message ||fnd_msg_pub.get (p_encoded => fnd_api.g_true));
END LOOP;
ELSE
v_error_message := v_msg_data;
END IF;
END IF;
dbms_output.put_line(v_return_status||' '||'OSR Process failed with error: ' || v_error_message);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(sqlerrm);
END;
set serveroutput on;
DECLARE
v_xref_rec hz_orig_system_ref_pub.orig_sys_reference_rec_type;
v_object_version_number NUMBER :=1 ;
v_return_status VARCHAR2 (240);
v_msg_count NUMBER;
v_msg_data VARCHAR2 (4000);
v_error_message VARCHAR2 (4000) := NULL;
BEGIN
v_error_message := NULL;
v_return_status := NULL;
v_msg_count := NULL;
v_msg_data := NULL;
v_xref_rec.orig_system := 'Legacy System';
v_xref_rec.orig_system_reference := '00138888'; --New OSR
v_xref_rec.owner_table_name := 'HZ_PARTY_SITES';
v_xref_rec.owner_table_id := '3578'; --Party Site ID
v_xref_rec.old_orig_system_reference := '00138AA2'; --Old OSR
v_xref_rec.created_by_module := 'HZ_IMPORT';
hz_orig_system_ref_pub.update_orig_system_reference (
p_init_msg_list => fnd_api.g_true,
p_orig_sys_reference_rec => v_xref_rec,
p_object_version_number => v_object_version_number,
x_return_status => v_return_status,
x_msg_count => v_msg_count,
x_msg_data => v_msg_data
);
commit;
IF v_return_status <> fnd_api.g_ret_sts_success
THEN
IF v_msg_count > 1
THEN
FOR i IN 1 .. v_msg_count
LOOP
v_error_message := (v_error_message ||fnd_msg_pub.get (p_encoded => fnd_api.g_true));
END LOOP;
ELSE
v_error_message := v_msg_data;
END IF;
END IF;
dbms_output.put_line(v_return_status||' '||'OSR Process failed with error: ' || v_error_message);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(sqlerrm);
END;
0 comments:
Post a Comment