Oracle EBS API to create a Phone Number (contacts) in R12 HZ_CONTACT_POINT_V2PUB.CREATE_PHONE_CONTACT_POINT
This API is relatively easy to work with. It is a public API wrapper on HZ_CONTACT_POINT_V2PUB.CREATE_CONTACT_POINT, which allows you to load phones, emails, websites, edi info, etc. The API we are looking at here, HZ_CONTACT_POINT_V2PUB.CREATE_PHONE_CONTACT_POINT, only creates contact phones.
I'll start with a sample script here and then explain the tricky part of working with this API down below:
Sample script for: HZ_CONTACT_POINT_V2PUB.CREATE_PHONE_CONTACT_POINT
DECLARE
p_contact_point_rec HZ_CONTACT_POINT_V2PUB.CONTACT_POINT_REC_TYPE;
p_phone_rec HZ_CONTACT_POINT_V2PUB.PHONE_REC_TYPE;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
x_contact_point_id NUMBER;
BEGIN
-- Initialize the environment
/*
You probably don't need these for this API (my testing didn't require
them and there is no org_id field in the hz_contact_points table) but
here they are just in case:
mo_global.init('AR');
fnd_global.apps_initialize ( user_id => 1234
,resp_id => 50559
,resp_appl_id => 222);
mo_global.set_policy_context('S',204);
*/
-- Mandatory parameters
p_contact_point_rec.contact_point_type := 'PHONE';
p_contact_point_rec.owner_table_name := 'HZ_PARTIES';
p_contact_point_rec.owner_table_id := 1148;
p_contact_point_rec.primary_flag := 'Y';
p_contact_point_rec.contact_point_purpose := 'BUSINESS';
p_contact_point_rec.created_by_module := 'BO_API';
-- Non Mandatory Parameters
p_phone_rec.phone_area_code := NULL;
p_phone_rec.phone_country_code := '1';
p_phone_rec.phone_number := '212-555-1212';
p_phone_rec.phone_line_type := 'GEN';
p_phone_rec.phone_extension := '';
/*
Notes:
1) The 'owner_table_name' can be other tables like hz_party_sites
2) The 'owner_table_id' is the primary key for the record in the table
you want to assign this contact to. In this example, this would be
the party_id of a party in HZ_Parties
*/
DBMS_OUTPUT.PUT_LINE('-----------');
DBMS_OUTPUT.PUT_LINE('Calling API');
HZ_CONTACT_POINT_V2PUB.CREATE_PHONE_CONTACT_POINT(
p_init_msg_list => FND_API.G_TRUE,
p_contact_point_rec => p_contact_point_rec,
p_phone_rec => p_phone_rec,
x_contact_point_id => x_contact_point_id,
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('Success!');
DBMS_OUTPUT.PUT_LINE('x_contact_point_id: '||x_contact_point_id);
ELSE
DBMS_OUTPUT.put_line('Failure... Msgs: ');
IF x_msg_count = 1
THEN
DBMS_OUTPUT.put_line('1) ' || x_msg_data);
ELSE
FOR i IN 1 .. x_msg_count
LOOP
x_msg_data := fnd_msg_pub.get( p_msg_index => i, p_encoded => 'F');
dbms_output.put_line( i|| ') '|| x_msg_data);
END LOOP;
END IF;
END IF;
END;
Now the trick to this is that you have to understand the parameters owner_table_name and owner_table_id. The owner_table_name is the table which has the data you want to associate with this contact phone. Typical choices are HZ_Parties or HZ_Party_Sites. The party_id parameter is the primary ID in that table, so if the owner_table_name = 'HZ_Parties then the owner_table_id is the party_id field in HZ_Parties. If the owner_table_name = 'HZ_Party_Sites' then the owner_table_id is the party_site_id field in HZ_Party_Sites. It's not super-intuitive but that's the way the table that stores contact info (hz_contact_points) works.
Knowing this, hopefully you will be able to use this API easily.
Working with Oracle APIs, Open Interfaces, Reports, Excel, BI to get stuff done! API Wizard (www.api-wizard.com) is a productivity tool for Oracle EBS data entry, data updates, and reporting for Oracle and Oracle EBS using a Microsoft Excel user interface and a powerful Oracle backend. The purpose of this blog is to share our knowledge working with Oracle APIs and interfaces - so that whether you're using API Wizard or building custom integrations, you can leverage what we've been working on.
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Oracle Projects API (PA_PROJECT_PUB) and Function Security A customer wanted to work with project module APIs to perform standard project ...
-
Working with Purchase Order Import (Import Standard Purchase Orders - POXPOPDOI) A prospective customer wants to use API Wizard to load pu...
-
Where do I find info about Oracle EBS Public APIs? This is a question that I get multiple times each week in my role at API Wizard (a soft...
-
Oracle EBS API to create a Phone Number (contacts) in R12 HZ_CONTACT_POINT_V2PUB.CREATE_PHONE_CONTACT_POINT This API is relatively easy to...
-
WIP Discrete Jobs and wip_job_schedule_interface / Allow Explosion and Scheduling One of our customers was working with a process to creat...
-
Vendor Site trx failed: Inconsistent data entered as compared to TCA records. Working with supplier site API ap_vendors_pub_pkg.create_ven...
-
At long last, EBS customers can enter physical inventory counts and adjustment approvals through a new public API. Phyiscal Inventory count...
-
NLS_LANGUAGE what a pain... Oracle EBS issue I have a customer who has a report that works great in the U.S. but when they rolled the repo...
-
Creating Project Tasks with pa_project_pub - Issue when parent task created in form vs. create with API The Oracle Projects public APIs pa...
-
Controlling Accounting when Creating Receipt via AR_RECEIPT_API_PUB.CREATE_CASH A prospect asked this question during an API Wizard Demo: ...
No comments:
Post a Comment
Please add your feedback, experience, or questions!