DECLARE
p_contact_point_rec hz_contact_point_v2pub.contact_point_rec_type;
p_email_rec hz_contact_point_v2pub.email_rec_type;
p_phone_rec hz_contact_point_v2pub.phone_rec_type;
p_edi_rec hz_contact_point_v2pub.edi_rec_type;
p_telex_rec hz_contact_point_v2pub.telex_rec_type;
p_web_rec hz_contact_point_v2pub.web_rec_type;
x_return_status varchar2(200);
x_msg_count number;
x_msg_data varchar2(200);
x_contact_point_id number;
l_msg_index_out number;
l_error_message varchar2(100);
x_owner_table_name varchar2(50);
x_email_address varchar2(200);
x_phone_area_code varchar2(20);
x_phone_number varchar2(50);
x_phone_line_type varchar2(50);
p_init_msg_list varchar2(30);
BEGIN
p_contact_point_rec.contact_point_type:='&contact_point_type';
p_contact_point_rec.owner_table_id :='&owner_table_id';
p_contact_point_rec.created_by_module :='TCA_V2_API';
hz_contact_point_v2pub.create_contact_point(p_init_msg_list=> 'T',
p_contact_point_rec => p_contact_point_rec,
p_email_rec => p_email_rec ,
p_phone_rec => p_phone_rec,
p_edi_rec => p_edi_rec,
p_telex_rec => p_telex_rec,
p_web_rec => p_web_rec,
x_return_status => x_return_status ,
x_msg_count => x_msg_count ,
x_msg_data => x_msg_data,
x_contact_point_id => x_contact_point_id);
IF x_return_status = fnd_api.g_ret_sts_success THEN
dbms_output.put_line('output information');
dbms_output.put_line('x_contact_point_id:' || x_contact_point_id);
dbms_output.put_line ('x_owner_table_name:' || x_owner_table_name);
dbms_output.put_line ('x_email_address:' || x_email_address);
dbms_output.put_line ('x_phone_area_code:' || x_phone_area_code);
dbms_output.put_line ('x_phone_number:' || x_phone_number);
dbms_output.put_line ('x_phone_line_type:' || x_phone_line_type);
IF x_msg_count > 0
THEN
FOR i IN 1 .. x_msg_count
LOOP
apps.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
);
END LOOP;
IF l_error_message IS NULL
THEN
l_error_message := SUBSTR (x_msg_data, 1, 250);
ELSE
l_error_message :=
l_error_message || ' /' || SUBSTR (x_msg_data, 1, 250);
END IF;
DBMS_OUTPUT.put_line ('*****************************************');
DBMS_OUTPUT.put_line ('API Error: ' || l_error_message);
DBMS_OUTPUT.put_line ('*****************************************');
END IF;
END IF;
END;
p_contact_point_rec hz_contact_point_v2pub.contact_point_rec_type;
p_email_rec hz_contact_point_v2pub.email_rec_type;
p_phone_rec hz_contact_point_v2pub.phone_rec_type;
p_edi_rec hz_contact_point_v2pub.edi_rec_type;
p_telex_rec hz_contact_point_v2pub.telex_rec_type;
p_web_rec hz_contact_point_v2pub.web_rec_type;
x_return_status varchar2(200);
x_msg_count number;
x_msg_data varchar2(200);
x_contact_point_id number;
l_msg_index_out number;
l_error_message varchar2(100);
x_owner_table_name varchar2(50);
x_email_address varchar2(200);
x_phone_area_code varchar2(20);
x_phone_number varchar2(50);
x_phone_line_type varchar2(50);
p_init_msg_list varchar2(30);
BEGIN
p_contact_point_rec.contact_point_type:='&contact_point_type';
p_contact_point_rec.owner_table_id :='&owner_table_id';
p_contact_point_rec.created_by_module :='TCA_V2_API';
hz_contact_point_v2pub.create_contact_point(p_init_msg_list=> 'T',
p_contact_point_rec => p_contact_point_rec,
p_email_rec => p_email_rec ,
p_phone_rec => p_phone_rec,
p_edi_rec => p_edi_rec,
p_telex_rec => p_telex_rec,
p_web_rec => p_web_rec,
x_return_status => x_return_status ,
x_msg_count => x_msg_count ,
x_msg_data => x_msg_data,
x_contact_point_id => x_contact_point_id);
IF x_return_status = fnd_api.g_ret_sts_success THEN
dbms_output.put_line('output information');
dbms_output.put_line('x_contact_point_id:' || x_contact_point_id);
dbms_output.put_line ('x_owner_table_name:' || x_owner_table_name);
dbms_output.put_line ('x_email_address:' || x_email_address);
dbms_output.put_line ('x_phone_area_code:' || x_phone_area_code);
dbms_output.put_line ('x_phone_number:' || x_phone_number);
dbms_output.put_line ('x_phone_line_type:' || x_phone_line_type);
IF x_msg_count > 0
THEN
FOR i IN 1 .. x_msg_count
LOOP
apps.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
);
END LOOP;
IF l_error_message IS NULL
THEN
l_error_message := SUBSTR (x_msg_data, 1, 250);
ELSE
l_error_message :=
l_error_message || ' /' || SUBSTR (x_msg_data, 1, 250);
END IF;
DBMS_OUTPUT.put_line ('*****************************************');
DBMS_OUTPUT.put_line ('API Error: ' || l_error_message);
DBMS_OUTPUT.put_line ('*****************************************');
END IF;
END IF;
END;
No comments:
Post a Comment