Creating a person entry in HZ_Parties table

Hello,

I am developing a form for one of our clients. As a part of this developement I need to insert a record into HZ_PARTIES table using the API
HZ_PARTY_V2PUB.CREATE_PERSON.

I am totally new to these APIs and hence finding it a bit tough to go forward even though I have some pdf documentation from Oracle. Kindly provide me the details on how to use the "create_person"  to create an entry in HZ_PARTIES with party_type as PERSON.


Regards
sreejithmAsked:
Who is Participating?
 
Dr_BillyConnect With a Mentor Commented:
Here is the full document
 TIP:  Click help for a detailed explanation of this page. 
 Bookmark Go to End 
 
Subject:  Oracle Trading Community Architecture API User Notes, June 2003 
  Doc ID:  Note:241320.1 Type:  REFERENCE 
  Last Revision Date:  29-OCT-2004 Status:  PUBLISHED 
 
Oracle Trading Community Architecture API User Notes
June 2003, Release 11i
Last Update Date: August 1, 2003
 
Abstract
 
The Oracle Trading Community Architecture API User Notes contains the following topics: 
Chapter 1 provides a brief overview of the features and benefits of the TCA application programming interfaces (APIs). 
Chapter 2 describes the features, parameters, attributes and messages that are part of the TCA APIs. 
Chapters 3 through 13 describe how to create and update records with each of the TCA APIs. Some of the information provided for an API includes a description, the PL/SQL procedure, the Java method, parameter descriptions, and information about any defaults and validations for a parameter. The included APIs are: 
Party APIs 
Party Information APIs 
Party Contact APIs 
Person Information APIs 
Organization Information APIs 
Location APIs 
Party Site APIs 
Contact Point APIs 
Relationship Type APIs 
Relationship APIs 
Classification APIs 
Contact Preference APIs 
Customer Account APIs 
Customer Account Site APIs 
Customer Profile APIs 
Customer Account Role APIs 
Source System Management APIs 
Tax Assignment APIs 
Phone Parsing and Formatting APIs 
Name and Address Formatting APIs 
General Data Formatting APIs 
Hierarchy Retrieval APIs 
Appendix A provides sample code that uses TCA APIs. 
Appendix B provides the number, code, and text of the TCA API messages. 
Appendix C provides information about mapping the first, internal-only version of the APIs to the second, public version of the APIs. 
 
Full Document
 
Oracle Trading Community Architecture API User Notes, June 2003
 
PDF Version (PDF, 5.9 Mb) 
HTML Version (ZIP, 395 kb) 
Instructions for the HTML version: 
 
Create or identify a target folder for the document location in your local file system. 
Click the link above to start the download. 
Choose to save the file to your disk. 
Continue the download into the target folder. 
When the download has completed, open the target folder. 
Open the ZIP file and click Extract. Make sure the extract target folder is correct. 
Close the ZIP file. 
In the local file system, open the extracted folder. 
Open the subfolder named Output. 
Open the file named toc.htm.
 
 
 
 

Open in new window

api.pdf
0
 
Dr_BillyCommented:
First of all what is the type of the person you need to create , is it a customer or an employee or a group ?

I don't if you have seen the attached file or not but it may be useful to have a look at the documentation of this API in that attached document.

https://metalink.oracle.com/cgi-bin/cr/getfile.cgi?p_attid=241320.1:1


Here is a similar example but for a customer hope it's helpful



Subject: 	How to create a PERSON customer via TCA API ?
  	Doc ID: 	NOTE:204170.1 	Type: 	PROBLEM
  	Last Revision Date: 	09-NOV-2008 	Status: 	PUBLISHED
 
 
Checked for relevance on 10-Nov-2008 
 
Goal: How to create a PERSON customer via TCA API ?
Fact: Oracle Trading Community 11.5.7
Fix: Example to create a PERSON customer via API in TCA.
 
------------------------------------
-- 1a. Setup the Org_id
------------------------------------
exec dbms_application_info.set_client_info('204');
 
------------------------------------
-- 1b. Show the output variables
------------------------------------
set serveroutput on
 
------------------------------------
-- 2. Create a party and an account
------------------------------------
DECLARE
 p_cust_account_rec HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
 p_person_rec HZ_PARTY_V2PUB.PERSON_REC_TYPE;
 p_customer_profile_rec HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE;
 x_cust_account_id NUMBER;
 x_account_number VARCHAR2(2000);
 x_party_id NUMBER;
 x_party_number VARCHAR2(2000);
 x_profile_id NUMBER;
 x_return_status VARCHAR2(2000);
 x_msg_count NUMBER;
 x_msg_data VARCHAR2(2000);
 
BEGIN
 p_cust_account_rec.account_name := 'TPERSON01';
 p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE';
 
 p_person_rec.person_first_name := 'FennerT1';
 p_person_rec.person_last_name := 'GiraldoT1';
 p_person_rec.created_by_module := 'TCAPI_EXAMPLE';
 
 
 hz_cust_account_v2pub.create_cust_account(
 'T',
 p_cust_account_rec,
 p_person_rec,
 p_customer_profile_rec,
 'F',
 x_cust_account_id,
 x_account_number,
 x_party_id,
 x_party_number,
 x_profile_id,
 x_return_status,
 x_msg_count,
 x_msg_data);
 
 dbms_output.put_line('***************************');
 dbms_output.put_line('Output information ....');
 dbms_output.put_line('x_cust_account_id: '||x_cust_account_id);
 dbms_output.put_line('x_account_number: '||x_account_number);
 dbms_output.put_line('x_party_id: '||x_party_id);
 dbms_output.put_line('x_party_number: '||x_party_number);
 dbms_output.put_line('x_profile_id: '||x_profile_id);
 dbms_output.put_line('x_return_status: '||x_return_status);
 dbms_output.put_line('x_msg_count: '||x_msg_count);
 dbms_output.put_line('x_msg_data: '||x_msg_data);
 dbms_output.put_line('***************************');
 
END;
 
 
***************************
Output information ....
x_cust_account_id: 7645
x_account_number: 3951
x_party_id: 7989
x_party_number: 6333
x_profile_id: 4742
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
 
 
/* BEGIN address  */
------------------------------------
-- 3. Create a physical location
------------------------------------
DECLARE
 p_location_rec HZ_LOCATION_V2PUB.LOCATION_REC_TYPE;
 x_location_id NUMBER;
 x_return_status VARCHAR2(2000);
 x_msg_count NUMBER;
 x_msg_data VARCHAR2(2000);
BEGIN
 p_location_rec.country := 'US';
 p_location_rec.address1 := 'Address1';
 p_location_rec.city := 'San Mateo';
 p_location_rec.postal_code := '94401';
 p_location_rec.state := 'CA';
 p_location_rec.created_by_module := 'TCAPI_EXAMPLE';
 hz_location_v2pub.create_location(
 'T',
 p_location_rec,
 x_location_id,
 x_return_status,
 x_msg_count,
 x_msg_data);
 
 dbms_output.put_line('***************************');
 dbms_output.put_line('Output information ....');
 dbms_output.put_line('x_location_id: '||x_location_id);
 dbms_output.put_line('x_return_status: '||x_return_status);
 dbms_output.put_line('x_msg_count: '||x_msg_count);
 dbms_output.put_line('x_msg_data: '||x_msg_data);
 dbms_output.put_line('***************************');
 
END;
 
***************************
Output information ....
x_location_id: 5126
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
 
 
------------------------------------
-- 4. Create a party site using party_id  from step 2 and location_id from step 3
------------------------------------
DECLARE
 p_party_site_rec HZ_PARTY_SITE_V2PUB.PARTY_SITE_REC_TYPE;
 x_party_site_id NUMBER;
 x_party_site_number VARCHAR2(2000);
 x_return_status VARCHAR2(2000);
 x_msg_count NUMBER;
 x_msg_data VARCHAR2(2000);
BEGIN
 p_party_site_rec.party_id := 7989; --<<value for party_id from step 2>
 p_party_site_rec.location_id := 5126; --<<value for location_id from step 3>
 p_party_site_rec.identifying_address_flag := 'Y';
 p_party_site_rec.created_by_module := 'TCAPI_EXAMPLE';
 hz_party_site_v2pub.create_party_site(
 'T',
 p_party_site_rec,
 x_party_site_id,
 x_party_site_number,
 x_return_status,
 x_msg_count,
 x_msg_data);
 
 dbms_output.put_line('***************************');
 dbms_output.put_line('Output information ....');
 dbms_output.put_line('x_party_site_id: '||x_party_site_id);
 dbms_output.put_line('x_party_site_number: '||x_party_site_number);
 dbms_output.put_line('x_return_status: '||x_return_status);
 dbms_output.put_line('x_msg_count: '||x_msg_count);
 dbms_output.put_line('x_msg_data: '||x_msg_data);
 dbms_output.put_line('***************************');
 
END;
 
***************************
Output information ....
x_party_site_id: 6670
x_party_site_number: 5303
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
 
 
 
------------------------------------
-- 5. Create an account site using cust_account_id from step 2 and party_site_id from step 4.
------------------------------------
DECLARE
 p_cust_acct_site_rec hz_cust_account_site_v2pub.cust_acct_site_rec_type;
 x_return_status VARCHAR2(2000);
 x_msg_count NUMBER;
 x_msg_data VARCHAR2(2000);
 x_cust_acct_site_id NUMBER;
BEGIN
 p_cust_acct_site_rec.cust_account_id := 7645; --<<value for cust_account_id you get from step 2>
 p_cust_acct_site_rec.party_site_id := 6670; --<<value for party_site_id from step 4>
 p_cust_acct_site_rec.language := 'US';
 p_cust_acct_site_rec.created_by_module := 'TCAPI_EXAMPLE';
 hz_cust_account_site_v2pub.create_cust_acct_site(
 'T',
 p_cust_acct_site_rec,
 x_cust_acct_site_id,
 x_return_status,
 x_msg_count,
 x_msg_data);
 
 dbms_output.put_line('***************************');
 dbms_output.put_line('Output information ....');
 dbms_output.put_line('x_cust_acct_site_id: '||x_cust_acct_site_id);
 dbms_output.put_line('x_return_status: '||x_return_status);
 dbms_output.put_line('x_msg_count: '||x_msg_count);
 dbms_output.put_line('x_msg_data: '||x_msg_data);
 dbms_output.put_line('***************************');
 
END;
 
***************************
Output information ....
x_cust_acct_site_id: 6583
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
 
 
------------------------------------
-- 6. Create an account site use using cust_acct_site_id from step 5 and site_use_code='BILL_TO'
------------------------------------
DECLARE
 p_cust_site_use_rec HZ_CUST_ACCOUNT_SITE_V2PUB.CUST_SITE_USE_REC_TYPE;
 p_customer_profile_rec HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE;
 x_site_use_id NUMBER;
 x_return_status VARCHAR2(2000);
 x_msg_count NUMBER;
 x_msg_data VARCHAR2(2000);
BEGIN
 p_cust_site_use_rec.cust_acct_site_id := 6583; --<<value for cust_acct_site_id from step 5>
 p_cust_site_use_rec.site_use_code := 'BILL_TO';
 p_cust_site_use_rec.created_by_module := 'TCAPI_EXAMPLE';
 hz_cust_account_site_v2pub.create_cust_site_use(
 'T',
 p_cust_site_use_rec,
 p_customer_profile_rec,
 '',
 '',
 x_site_use_id,
 x_return_status,
 x_msg_count,
 x_msg_data);
 
 dbms_output.put_line('***************************');
 dbms_output.put_line('Output information ....');
 dbms_output.put_line('x_site_use_id: '||x_site_use_id);
 dbms_output.put_line('x_return_status: '||x_return_status);
 dbms_output.put_line('x_msg_count: '||x_msg_count);
 dbms_output.put_line('x_msg_data: '||x_msg_count);
 dbms_output.put_line('***************************');
 
END;
 
 
***************************
Output information ....
x_site_use_id: 6637
x_return_status: S
x_msg_count: 0
x_msg_data: 0
***************************
 
/* END address  */
 
commit;
 
 
. 

Open in new window

0
 
sreejithmAuthor Commented:
Dr Billy,

We have the customers (organizations) already created. Now I need to create the employees. I understand that I need to follow this sequence

1. create person using the HZ_PARTY_V2PUB.CREATE_PERSON API
2. create relations using Hz_Party_Contact_V2pub.create_org_contact

and for any changed (eg terminated employee) use Hz_Party_Contact_V2pub.update_org_contact

Kindly give me some guidelines on the usage of these APIs. I am unable to access the link that you have provided from metalink.

Regards,
0
 
Dr_BillyCommented:
Hope that helps
0
 
sreejithmAuthor Commented:
Thanks Dr billy. It really helped.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.