SlideShare a Scribd company logo
Goal: How to create customer in TCA via API
------------------------------------
-- 1. Setup the Org_id
------------------------------------
exec dbms_application_info.set_client_info('&Your_Org_Id');
------------------------------------
-- 2. Show the output variables
------------------------------------
set serveroutput on
------------------------------------
-- 3. Create a party and an account
------------------------------------
DECLARE
p_cust_account_rec HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
p_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'Acc_test1';
p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE';
p_organization_rec.organization_name := 'Fenner Test';
p_organization_rec.created_by_module := 'TCAPI_EXAMPLE';
hz_cust_account_v2pub.create_cust_account(
'T',
p_cust_account_rec,
p_organization_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;
------------------------------------
-- 4. 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 := 'Test';
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;
------------------------------------
-- 5. Create a party site
-- party_id (from step 3)
-- location_id (from step 4)
------------------------------------
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 := 15184;
p_party_site_rec.location_id := 3270;
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;
------------------------------------
-- 6. Create an account site
-- cust_account_id (from step 2)
-- party_site_id (from step 5).
------------------------------------
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 := 12722;
p_cust_acct_site_rec.party_site_id := 12164;
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;
-------------------------------------------
-- 7. Create an account site use 'BILL_TO'
-- cust_acct_site_id (from step 6)
-------------------------------------------
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 := 9369;
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;
commit;
**********************************************************************
*****************************************************
**********************************************************************
*****************************************************
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;
**********************************************************************
*****************************************************
**********************************************************************
*****************************************************
Goal: How to create a cust_account via TCA API to an existing PARTY
(PERSON Customer)?
Fact: Oracle Trading Community 11.5.4
Fix: Example of how to create a cust_account via TCA API to an
existing PARTY (PERSON Customer)?
How to create a cust_account via TCA API to an existing PARTY (PERSON
Customer)?
------------------------------------
-- 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 := 'TPERSONFENNER02';
p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE';
p_person_rec.party_rec.party_id := 7989; --<< party_id that already
exist
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: 7649
x_account_number: 3954
x_party_id: 7989
x_party_number:
x_profile_id:
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 := 'Address2';
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: 5128
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 := 5128; --<<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: 6672
x_party_site_number: 5305
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 := 7649; --<<value for
cust_account_id you get from step 2>
p_cust_acct_site_rec.party_site_id := 6672; --<<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: 6585
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 := 6585; --<<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: 6639
x_return_status: S
x_msg_count: 0
x_msg_data: 0
***************************
/* END address */
commit;
**********************************************************************
*****************************************************
**********************************************************************
*****************************************************
How to create two BILL_TO sites for the same customer via TCA API
------------------------------------------------------------------
Example:
------------------------------------
-- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'ACC01_01_02';
p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE';
-- p_cust_account_rec.orig_system_reference := '001_001'; -- is not
mandatory
p_organization_rec.organization_name := 'CUSTAPI2';
p_organization_rec.created_by_module := 'TCAPI_EXAMPLE';
hz_cust_account_v2pub.create_cust_account(
'T',
p_cust_account_rec,
p_organization_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;
/* 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 := 'Address2a';
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;
------------------------------------
-- 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 := XX; --<<value for party_id from step 2>
p_party_site_rec.location_id := XX; --<<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;
------------------------------------
-- 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 := XX; --<<value for
cust_account_id you get from step 2>
p_cust_acct_site_rec.party_site_id := XX; --<<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;
------------------------------------
-- 6. Create an account site use using cust_acct_site_id from step 5
and site_use_code='BILL_TO' (first 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 := XX; --<<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;
/* END address */
commit;
------------------------------------
-- 7. 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 := 'Address2b';
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;
------------------------------------
-- 8. Create a party site using party_id from step 2 and location_id
from step 7
------------------------------------
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 := XX; --<<value for party_id from step 2>
p_party_site_rec.location_id := XX; --<<value for location_id from
step 7>
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;
------------------------------------
-- 9. Create an account site using cust_account_id from step 2 and
party_site_id from step 8.
------------------------------------
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 := XX; --<<value for
cust_account_id you get from step 2>
p_cust_acct_site_rec.party_site_id := XX; --<<value for party_site_id
from step 8>
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;
------------------------------------
-- 10. Create an account site use using cust_acct_site_id from step 9
and site_use_code='BILL_TO' (Second 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 := XX; --<<value for
cust_acct_site_id from step 9>
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;
commit;
**********************************************************************
*****************************************************
**********************************************************************
*****************************************************
How to create BILL_TO and SHIP_TO sites via TCA API
---------------------------------------------------
Example:
------------------------------------
-- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'ACC01_01_03';
p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE';
-- p_cust_account_rec.orig_system_reference := '001_001'; -- is not
mandatory
p_organization_rec.organization_name := 'CUSTAPI3';
p_organization_rec.created_by_module := 'TCAPI_EXAMPLE';
hz_cust_account_v2pub.create_cust_account(
'T',
p_cust_account_rec,
p_organization_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;
/* 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 := 'Address3a';
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;
------------------------------------
-- 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 := XX; --<<value for party_id from step 2>
p_party_site_rec.location_id := XX; --<<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;
------------------------------------
-- 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 := XX; --<<value for
cust_account_id you get from step 2>
p_cust_acct_site_rec.party_site_id := XX; --<<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;
------------------------------------
-- 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 := XX; --<<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;
/* END address */
commit;
------------------------------------
-- 7. 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 := 'Address3b';
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;
------------------------------------
-- 8. Create a party site using party_idfrom step 2 and location_id
from step 7
------------------------------------
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 := XX; --<<value for party_id from step 2>
p_party_site_rec.location_id := XX; --<<value for location_id from
step 7>
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;
------------------------------------
-- 9. Create an account site using cust_account_id from step 2 and
party_site_id from step 8.
------------------------------------
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 := XX; --<<value for
cust_account_id you get from step 2>
p_cust_acct_site_rec.party_site_id := XX; --<<value for party_site_id
from step 8>
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;
------------------------------------
-- 10. Create an account site use using cust_acct_site_id from step 9
and site_use_code='SHIP_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 := XX; --<<value for
cust_acct_site_id from step 9>
p_cust_site_use_rec.site_use_code := 'SHIP_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;
commit;
**********************************************************************
*****************************************************
**********************************************************************
*****************************************************
How to create a customer (ORGANIZATION) via TCA API with
account_number off and party_number on?
Suppose:
-. Automatic customer numbering is not checked on System Options.
-. HZ: Generate Party Number in Yes on Profile Options Form.
------------------------------------
-- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'FennerAccN';
p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE';
p_cust_account_rec.account_number := 'FennerAccN';
p_organization_rec.organization_name := 'FennerAccN';
p_organization_rec.created_by_module := 'TCAPI_EXAMPLE';
hz_cust_account_v2pub.create_cust_account(
'T',
p_cust_account_rec,
p_organization_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: 12189
x_account_number: FennerAccN
x_party_id: 17602
x_party_number: 16047
x_profile_id: 8081
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: 1000002012555
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 := 17602; --<<value for party_id from step
2>
p_party_site_rec.location_id := 1000002012555; --<<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: 12419
x_party_site_number: 10872
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 := 12189; --<<value for
cust_account_id you get from step 2>
p_cust_acct_site_rec.party_site_id := 12419; --<<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: 10061
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 := 10061; --<<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: 10359
x_return_status: S
x_msg_count: 0
x_msg_data: 0
***************************
/* END address */
commit;
**********************************************************************
*****************************************************
**********************************************************************
*****************************************************
How To Create A Contact At Customer Level Without Phone Via TCA API
----------------------------------------------------------------
Example:
------------------------------------
-- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'ACC01_01_04';
p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE';
-- p_cust_account_rec.orig_system_reference := '001_001'; -- is not
mandatory
p_organization_rec.organization_name := 'CUSTAPI4';
p_organization_rec.created_by_module := 'TCAPI_EXAMPLE';
hz_cust_account_v2pub.create_cust_account(
'T',
p_cust_account_rec,
p_organization_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;
/* 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 := 'Address4';
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;
------------------------------------
-- 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 := XX; --<<value for party_id from step 2>
p_party_site_rec.location_id := XX; --<<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;
------------------------------------
-- 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 := XX; --<<value for
cust_account_id you get from step 2>
p_cust_acct_site_rec.party_site_id := XX; --<<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;
------------------------------------
-- 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 := XX; --<<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;
/* END address */
commit;
/* BEGIN contact to an organization */
------------------------------------
-- 7. Create a definition contact
------------------------------------
DECLARE
p_create_person_rec HZ_PARTY_V2PUB.person_rec_type;
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_create_person_rec.person_pre_name_adjunct := 'MR.';
p_create_person_rec.person_first_name := 'Fennerc4';
p_create_person_rec.person_last_name := 'Giraldoc4';
p_create_person_rec.created_by_module := 'TCAPI_EXAMPLE';
HZ_PARTY_V2PUB.create_person(
'T',
p_create_person_rec,
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_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;
------------------------------------
-- 8. Create a relation cont-org using party_id from step 7 and
party_id from step 2
------------------------------------
DECLARE
p_org_contact_rec HZ_PARTY_CONTACT_V2PUB.ORG_CONTACT_REC_TYPE;
x_org_contact_id NUMBER;
x_party_rel_id NUMBER;
x_party_id NUMBER;
x_party_number VARCHAR2(2000);
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
p_org_contact_rec.department_code := 'ACCOUNTING';
p_org_contact_rec.job_title := 'ACCOUNTS OFFICER';
p_org_contact_rec.decision_maker_flag := 'Y';
p_org_contact_rec.job_title_code := 'APC';
p_org_contact_rec.created_by_module := 'TCAPI_EXAMPLE';
p_org_contact_rec.party_rel_rec.subject_id := XX; --<<value for
party_id from step 7>
p_org_contact_rec.party_rel_rec.subject_type := 'PERSON';
p_org_contact_rec.party_rel_rec.subject_table_name := 'HZ_PARTIES';
p_org_contact_rec.party_rel_rec.object_id := XX; --<<value for
party_id from step 2>
p_org_contact_rec.party_rel_rec.object_type := 'ORGANIZATION';
p_org_contact_rec.party_rel_rec.object_table_name := 'HZ_PARTIES';
p_org_contact_rec.party_rel_rec.relationship_code := 'CONTACT_OF';
p_org_contact_rec.party_rel_rec.relationship_type := 'CONTACT';
p_org_contact_rec.party_rel_rec.start_date := SYSDATE;
hz_party_contact_v2pub.create_org_contact(
'T',
p_org_contact_rec,
x_org_contact_id,
x_party_rel_id,
x_party_id,
x_party_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_org_contact_id: '||x_org_contact_id);
dbms_output.put_line('x_party_rel_id: '||x_party_rel_id);
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_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;
------------------------------------
-- 9. Create a contact using party_id you get 8 and cust_account_id
from step 2
------------------------------------
DECLARE
p_cr_cust_acc_role_rec
HZ_CUST_ACCOUNT_ROLE_V2PUB.cust_account_role_rec_type;
x_cust_account_role_id NUMBER;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
-- NOTE:
-- must be unique CUST_ACCOUNT_ID, PARTY_ID,ROLE_TYPE
-- must be unique CUST_ACCT_SITE_ID, PARTY_ID,ROLE_TYPE
p_cr_cust_acc_role_rec.party_id := XX; --<<value for party_id from
step 8>
p_cr_cust_acc_role_rec.cust_account_id := XX; --<<value for
cust_account_id from step 2>
p_cr_cust_acc_role_rec.primary_flag := 'Y';
p_cr_cust_acc_role_rec.role_type := 'CONTACT';
p_cr_cust_acc_role_rec.created_by_module := 'TCAPI_EXAMPLE';
HZ_CUST_ACCOUNT_ROLE_V2PUB.create_cust_account_role(
'T',
p_cr_cust_acc_role_rec,
x_cust_account_role_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_role_id: '||
x_cust_account_role_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;
/* END contact */
commit;
**********************************************************************
*****************************************************
**********************************************************************
*****************************************************
How To Create A Contact At Address Level Without Phone Via TCA API
Example:
------------------------------------
-- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'ACC01_01_06';
p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE';
-- p_cust_account_rec.orig_system_reference := '001_001'; -- is not
mandatory
p_organization_rec.organization_name := 'CUSTAPI6';
p_organization_rec.created_by_module := 'TCAPI_EXAMPLE';
hz_cust_account_v2pub.create_cust_account(
'T',
p_cust_account_rec,
p_organization_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;
/* 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 := 'Address6';
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;
------------------------------------
-- 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 := XX; --<<value for party_id from step 2>
p_party_site_rec.location_id := XX; --<<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;
------------------------------------
-- 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 := XX; --<<value for
cust_account_id you get from step 2>
p_cust_acct_site_rec.party_site_id := XX; --<<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;
------------------------------------
-- 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 := XX; --<<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;
/* END address */
commit;
/* BEGIN contact to an address */
------------------------------------
-- 7. Create a contact definition
------------------------------------
DECLARE
p_create_person_rec HZ_PARTY_V2PUB.person_rec_type;
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_create_person_rec.person_pre_name_adjunct := 'MR.';
p_create_person_rec.person_first_name := 'Fennerc6';
p_create_person_rec.person_last_name := 'Giraldoc6';
p_create_person_rec.created_by_module := 'TCAPI_EXAMPLE';
HZ_PARTY_V2PUB.create_person(
'T',
p_create_person_rec,
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_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;
------------------------------------
-- 8. Create a relation cont-org using party_id from step 7 and
party_id from step 2
------------------------------------
DECLARE
p_org_contact_rec HZ_PARTY_CONTACT_V2PUB.ORG_CONTACT_REC_TYPE;
x_org_contact_id NUMBER;
x_party_rel_id NUMBER;
x_party_id NUMBER;
x_party_number VARCHAR2(2000);
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
p_org_contact_rec.department_code := 'ACCOUNTING';
p_org_contact_rec.job_title := 'ACCOUNTS OFFICER';
p_org_contact_rec.decision_maker_flag := 'Y';
p_org_contact_rec.job_title_code := 'APC';
p_org_contact_rec.created_by_module := 'TCAPI_EXAMPLE';
p_org_contact_rec.party_rel_rec.subject_id := XX; --<<value for
party_id from step 7>
p_org_contact_rec.party_rel_rec.subject_type := 'PERSON';
p_org_contact_rec.party_rel_rec.subject_table_name := 'HZ_PARTIES';
p_org_contact_rec.party_rel_rec.object_id := XX; --<<value for
party_id from step 2>
p_org_contact_rec.party_rel_rec.object_type := 'ORGANIZATION';
p_org_contact_rec.party_rel_rec.object_table_name := 'HZ_PARTIES';
p_org_contact_rec.party_rel_rec.relationship_code := 'CONTACT_OF';
p_org_contact_rec.party_rel_rec.relationship_type := 'CONTACT';
p_org_contact_rec.party_rel_rec.start_date := SYSDATE;
hz_party_contact_v2pub.create_org_contact(
'T',
p_org_contact_rec,
x_org_contact_id,
x_party_rel_id,
x_party_id,
x_party_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_org_contact_id: '||x_org_contact_id);
dbms_output.put_line('x_party_rel_id: '||x_party_rel_id);
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_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;
------------------------------------
-- 9. Create a contact using party_id you get 8, cust_account_id from
step 2 and cust_acct_site_id from step 5
------------------------------------
DECLARE
p_cr_cust_acc_role_rec
HZ_CUST_ACCOUNT_ROLE_V2PUB.cust_account_role_rec_type;
x_cust_account_role_id NUMBER;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
-- NOTE:
-- must be unique CUST_ACCOUNT_ID, PARTY_ID,ROLE_TYPE
-- must be unique CUST_ACCT_SITE_ID, PARTY_ID,ROLE_TYPE
p_cr_cust_acc_role_rec.party_id := XX; --<<value for party_id from
step 8>
p_cr_cust_acc_role_rec.cust_account_id := XX; --<<value for
cust_account_id from step 2>
p_cr_cust_acc_role_rec.cust_acct_site_id := XX; --<<value for
cust_acct_site_id from step 5>
p_cr_cust_acc_role_rec.primary_flag := 'Y';
p_cr_cust_acc_role_rec.role_type := 'CONTACT';
p_cr_cust_acc_role_rec.created_by_module := 'TCAPI_EXAMPLE';
HZ_CUST_ACCOUNT_ROLE_V2PUB.create_cust_account_role(
'T',
p_cr_cust_acc_role_rec,
x_cust_account_role_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_role_id: '||
x_cust_account_role_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;
/* END contact */
commit;
**********************************************************************
*****************************************************
**********************************************************************
*****************************************************
How To Create A Contact At Address Level Without Phone Via TCA API
using conditions like:
HZ: Generate Contact Number : No
Fix
How To Create A Contact At Address Level Without Phone Via TCA API
using conditions like:
Profiles Options:
HZ: Generate Contact Number : No
HZ: Generate Party Number : No
HZ: Generate Party Site Number : No
system Options Form has values:
Automatic Site Numbering : NULL
Automatic Customer Numbering : NULL
Example:
------------------------------------
-- 1a. Setup the Org_id
------------------------------------
exec dbms_application_info.set_client_info('290');
------------------------------------
-- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'CHEXAM001';
p_cust_account_rec.account_number := 'CHEXAM001';
p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE';
-- p_cust_account_rec.orig_system_reference := '001_001'; -- is not
mandatory
p_organization_rec.organization_name := 'CHEXAM001';
p_organization_rec.created_by_module := 'TCAPI_EXAMPLE';
p_organization_rec.party_rec.party_number := '0001122';
hz_cust_account_v2pub.create_cust_account(
'T',
p_cust_account_rec,
p_organization_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: 2571
x_account_number: CHEXAM001
x_party_id: 27093
x_party_number: 0001122
x_profile_id: 2123
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 := 'Address0001aa';
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: 2474
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 := 27093; --<<value for party_id from step
2>
p_party_site_rec.location_id := 2474; --<<value for location_id from
step 3>
p_party_site_rec.identifying_address_flag := 'Y';
p_party_site_rec.created_by_module := 'TCAPI_EXAMPLE';
p_party_site_rec.party_site_number := '0003344';
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: 2944
x_party_site_number: 0003344
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 := 2571; --<<value for
cust_account_id you get from step 2>
p_cust_acct_site_rec.party_site_id := 2944; --<<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: 2943
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 := 2943; --<<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';
p_cust_site_use_rec.location := 'LOC_XXXSS';
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;
/* END address */
***************************
Output information ....
x_site_use_id: 2963
x_return_status: S
x_msg_count: 0
x_msg_data: 0
***************************
commit;
/* BEGIN contact to an address */
------------------------------------
-- 7. Create a contact definition
------------------------------------
DECLARE
p_create_person_rec HZ_PARTY_V2PUB.person_rec_type;
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_create_person_rec.person_pre_name_adjunct := 'MR.';
p_create_person_rec.person_first_name := 'FennerDDD';
p_create_person_rec.person_last_name := 'GiraldoDDD';
p_create_person_rec.created_by_module := 'TCAPI_EXAMPLE';
p_create_person_rec.party_rec.party_number := '0001255';
HZ_PARTY_V2PUB.create_person(
'T',
p_create_person_rec,
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_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_party_id: 27094
x_party_number: 0001255
x_profile_id: 25186
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
------------------------------------
-- 8. Create a relation cont-org using party_id from step 7 and
party_id from step 2
------------------------------------
DECLARE
p_org_contact_rec HZ_PARTY_CONTACT_V2PUB.ORG_CONTACT_REC_TYPE;
x_org_contact_id NUMBER;
x_party_rel_id NUMBER;
x_party_id NUMBER;
x_party_number VARCHAR2(2000);
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
p_org_contact_rec.department_code := 'ACCOUNTING';
p_org_contact_rec.job_title := 'APC';
p_org_contact_rec.decision_maker_flag := 'Y';
p_org_contact_rec.job_title_code := 'APC';
p_org_contact_rec.created_by_module := 'TCAPI_EXAMPLE';
p_org_contact_rec.party_rel_rec.subject_id := 27094; --<<value for
party_id from step 7>
p_org_contact_rec.party_rel_rec.subject_type := 'PERSON';
p_org_contact_rec.party_rel_rec.subject_table_name := 'HZ_PARTIES';
p_org_contact_rec.party_rel_rec.object_id := 27093; --<<value for
party_id from step 2>
p_org_contact_rec.party_rel_rec.object_type := 'ORGANIZATION';
p_org_contact_rec.party_rel_rec.object_table_name := 'HZ_PARTIES';
p_org_contact_rec.party_rel_rec.relationship_code := 'CONTACT_OF';
p_org_contact_rec.party_rel_rec.relationship_type := 'CONTACT';
p_org_contact_rec.party_rel_rec.start_date := SYSDATE;
p_org_contact_rec.party_rel_rec.party_rec.party_number := '0012277';
p_org_contact_rec.contact_NUMber := '0012266';
hz_party_contact_v2pub.create_org_contact(
'T',
p_org_contact_rec,
x_org_contact_id,
x_party_rel_id,
x_party_id,
x_party_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_org_contact_id: '||x_org_contact_id);
dbms_output.put_line('x_party_rel_id: '||x_party_rel_id);
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_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_org_contact_id: 1906
x_party_rel_id: 1908
x_party_id: 27095
x_party_number: 0012277
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
------------------------------------
-- 9. Create a contact using party_id you get 8, cust_account_id from
step 2 and cust_acct_site_id from step 5
------------------------------------
DECLARE
p_cr_cust_acc_role_rec
HZ_CUST_ACCOUNT_ROLE_V2PUB.cust_account_role_rec_type;
x_cust_account_role_id NUMBER;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
BEGIN
-- NOTE:
-- must be unique CUST_ACCOUNT_ID, PARTY_ID,ROLE_TYPE
-- must be unique CUST_ACCT_SITE_ID, PARTY_ID,ROLE_TYPE
p_cr_cust_acc_role_rec.party_id := 27095; --<<value for party_id from
step 8>
p_cr_cust_acc_role_rec.cust_account_id := 2571; --<<value for
cust_account_id from step 2>
p_cr_cust_acc_role_rec.cust_acct_site_id := 2943; --<<value for
cust_acct_site_id from step 5>
p_cr_cust_acc_role_rec.primary_flag := 'Y';
p_cr_cust_acc_role_rec.role_type := 'CONTACT';
p_cr_cust_acc_role_rec.created_by_module := 'TCAPI_EXAMPLE';
HZ_CUST_ACCOUNT_ROLE_V2PUB.create_cust_account_role(
'T',
p_cr_cust_acc_role_rec,
x_cust_account_role_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_role_id: '||
x_cust_account_role_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_role_id: 1906
x_return_status: S
x_msg_count: 0
x_msg_data:
***************************
/* END contact */
commit;
**********************************************************************
*****************************************************
**********************************************************************
*****************************************************
How To Create A Contact At Customer Level With Phone Via TCA API
----------------------------------------------------------------
Example of How To Add A Contact At Customer Level With Phone Via TCA
API
------------------------------------
-- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'Fenner_01';
p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE';
p_organization_rec.organization_name := 'Fenner_01';
p_organization_rec.created_by_module := 'TCAPI_EXAMPLE';
hz_cust_account_v2pub.create_cust_account(
'T',
p_cust_account_rec,
p_organization_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: 10033
x_account_number: 2441
x_party_id: 11337
x_party_number: 20413
x_profile_id: 3231
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 := 'Address4';
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: 21581
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 := 11337; --<<value for party_id from step
2>
p_party_site_rec.location_id := 21581; --<<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: 5967
x_party_site_number: 4476
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 := 10033; --<<value for
cust_account_id you get from step 2>
p_cust_acct_site_rec.party_site_id := 5967; --<<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: 4672
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 := 4672; --<<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;
/
/* END address */
commit;
/* BEGIN contact to an organization */
------------------------------------
-- 7. Create a definition contact
------------------------------------
DECLARE
p_create_person_rec HZ_PARTY_V2PUB.person_rec_type;
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_create_person_rec.person_pre_name_adjunct := 'MR.';
p_create_person_rec.person_first_name := 'FENNERCTFN_01';
p_create_person_rec.person_last_name := 'FENNERCTLN_01';
p_create_person_rec.created_by_module := 'TCAPI_EXAMPLE';
HZ_PARTY_V2PUB.create_person(
'T',
p_create_person_rec,
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_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('***************************');
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis
Examples of-tca-apis

More Related Content

Similar to Examples of-tca-apis

Input output
Input outputInput output
java and javascript api dev guide
java and javascript api dev guidejava and javascript api dev guide
java and javascript api dev guideZenita Smythe
 
Cómo integrar un método de pago en nuestros desarrollos.
Cómo integrar un método de pago en nuestros desarrollos.Cómo integrar un método de pago en nuestros desarrollos.
Cómo integrar un método de pago en nuestros desarrollos.
Alberto López Martín
 
12121212
1212121212121212
12121212
Etietop Demas
 
( 16 ) Office 2007 Create An Extranet Site With Forms Authentication
( 16 ) Office 2007   Create An Extranet Site With Forms Authentication( 16 ) Office 2007   Create An Extranet Site With Forms Authentication
( 16 ) Office 2007 Create An Extranet Site With Forms AuthenticationLiquidHub
 
Sap co profit center accounting
Sap co   profit center accountingSap co   profit center accounting
Sap co profit center accounting
Capgemini
 
Co cca config ecc6
Co cca config ecc6Co cca config ecc6
Co cca config ecc6
royaltiger
 
SAP ERP Structure
SAP ERP StructureSAP ERP Structure
SAP ERP Structure
karthikayyagari
 
Writing efficient sql
Writing efficient sqlWriting efficient sql
Writing efficient sqlj9soto
 
https://uii.io/ref/hmaadi
https://uii.io/ref/hmaadihttps://uii.io/ref/hmaadi
https://uii.io/ref/hmaadi
hmaadi96
 
Sybase to oracle_conversion
Sybase to oracle_conversionSybase to oracle_conversion
Sybase to oracle_conversionSam Varadarajan
 
Learn how to use API with 2 API examples.pdf
Learn how to use API with 2 API examples.pdfLearn how to use API with 2 API examples.pdf
Learn how to use API with 2 API examples.pdf
Be Problem Solver
 
Socket.IO - Alternative Ways for Real-time Application
Socket.IO - Alternative Ways for Real-time ApplicationSocket.IO - Alternative Ways for Real-time Application
Socket.IO - Alternative Ways for Real-time Application
Vorakamol Choonhasakulchok
 
What's new from 5.5 to 6.3 linked
What's new from 5.5 to 6.3 linkedWhat's new from 5.5 to 6.3 linked
What's new from 5.5 to 6.3 linked
Aces, Inc.,
 
Customer bank account assignment detail report
Customer bank account assignment detail reportCustomer bank account assignment detail report
Customer bank account assignment detail reportlingaswamy vallapu
 
Payments On Rails
Payments On RailsPayments On Rails
Payments On Rails
E-xact Transactions
 
How to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR RestHow to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR Rest
shravan kumar chelika
 
SAP Financial Accounting - Configuration Document
SAP Financial Accounting - Configuration DocumentSAP Financial Accounting - Configuration Document
SAP Financial Accounting - Configuration Document
Mahmoud Mohamed
 

Similar to Examples of-tca-apis (20)

Input output
Input outputInput output
Input output
 
Banking Database
Banking DatabaseBanking Database
Banking Database
 
java and javascript api dev guide
java and javascript api dev guidejava and javascript api dev guide
java and javascript api dev guide
 
Cómo integrar un método de pago en nuestros desarrollos.
Cómo integrar un método de pago en nuestros desarrollos.Cómo integrar un método de pago en nuestros desarrollos.
Cómo integrar un método de pago en nuestros desarrollos.
 
12121212
1212121212121212
12121212
 
( 16 ) Office 2007 Create An Extranet Site With Forms Authentication
( 16 ) Office 2007   Create An Extranet Site With Forms Authentication( 16 ) Office 2007   Create An Extranet Site With Forms Authentication
( 16 ) Office 2007 Create An Extranet Site With Forms Authentication
 
Sap co profit center accounting
Sap co   profit center accountingSap co   profit center accounting
Sap co profit center accounting
 
my_project
my_projectmy_project
my_project
 
Co cca config ecc6
Co cca config ecc6Co cca config ecc6
Co cca config ecc6
 
SAP ERP Structure
SAP ERP StructureSAP ERP Structure
SAP ERP Structure
 
Writing efficient sql
Writing efficient sqlWriting efficient sql
Writing efficient sql
 
https://uii.io/ref/hmaadi
https://uii.io/ref/hmaadihttps://uii.io/ref/hmaadi
https://uii.io/ref/hmaadi
 
Sybase to oracle_conversion
Sybase to oracle_conversionSybase to oracle_conversion
Sybase to oracle_conversion
 
Learn how to use API with 2 API examples.pdf
Learn how to use API with 2 API examples.pdfLearn how to use API with 2 API examples.pdf
Learn how to use API with 2 API examples.pdf
 
Socket.IO - Alternative Ways for Real-time Application
Socket.IO - Alternative Ways for Real-time ApplicationSocket.IO - Alternative Ways for Real-time Application
Socket.IO - Alternative Ways for Real-time Application
 
What's new from 5.5 to 6.3 linked
What's new from 5.5 to 6.3 linkedWhat's new from 5.5 to 6.3 linked
What's new from 5.5 to 6.3 linked
 
Customer bank account assignment detail report
Customer bank account assignment detail reportCustomer bank account assignment detail report
Customer bank account assignment detail report
 
Payments On Rails
Payments On RailsPayments On Rails
Payments On Rails
 
How to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR RestHow to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR Rest
 
SAP Financial Accounting - Configuration Document
SAP Financial Accounting - Configuration DocumentSAP Financial Accounting - Configuration Document
SAP Financial Accounting - Configuration Document
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 

Examples of-tca-apis

  • 1. Goal: How to create customer in TCA via API ------------------------------------ -- 1. Setup the Org_id ------------------------------------ exec dbms_application_info.set_client_info('&Your_Org_Id'); ------------------------------------ -- 2. Show the output variables ------------------------------------ set serveroutput on ------------------------------------ -- 3. Create a party and an account ------------------------------------ DECLARE p_cust_account_rec HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE; p_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'Acc_test1'; p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE'; p_organization_rec.organization_name := 'Fenner Test'; p_organization_rec.created_by_module := 'TCAPI_EXAMPLE'; hz_cust_account_v2pub.create_cust_account( 'T', p_cust_account_rec, p_organization_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('***************************');
  • 2. 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; ------------------------------------ -- 4. 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 := 'Test'; 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; ------------------------------------ -- 5. Create a party site -- party_id (from step 3)
  • 3. -- location_id (from step 4) ------------------------------------ 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 := 15184; p_party_site_rec.location_id := 3270; 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; ------------------------------------ -- 6. Create an account site -- cust_account_id (from step 2) -- party_site_id (from step 5). ------------------------------------ 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 := 12722; p_cust_acct_site_rec.party_site_id := 12164; p_cust_acct_site_rec.language := 'US';
  • 4. 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; ------------------------------------------- -- 7. Create an account site use 'BILL_TO' -- cust_acct_site_id (from step 6) ------------------------------------------- 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 := 9369; 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);
  • 5. 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; commit; ********************************************************************** ***************************************************** ********************************************************************** ***************************************************** 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';
  • 6. 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
  • 7. 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
  • 8. 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>
  • 9. 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',
  • 10. 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; ********************************************************************** ***************************************************** ********************************************************************** ***************************************************** Goal: How to create a cust_account via TCA API to an existing PARTY (PERSON Customer)? Fact: Oracle Trading Community 11.5.4 Fix: Example of how to create a cust_account via TCA API to an existing PARTY (PERSON Customer)? How to create a cust_account via TCA API to an existing PARTY (PERSON Customer)? ------------------------------------ -- 1a. Setup the Org_id ------------------------------------ exec dbms_application_info.set_client_info('204');
  • 11. ------------------------------------ -- 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 := 'TPERSONFENNER02'; p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE'; p_person_rec.party_rec.party_id := 7989; --<< party_id that already exist 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);
  • 12. 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: 7649 x_account_number: 3954 x_party_id: 7989 x_party_number: x_profile_id: 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 := 'Address2'; 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);
  • 13. 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: 5128 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 := 5128; --<<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('***************************');
  • 14. END; *************************** Output information .... x_party_site_id: 6672 x_party_site_number: 5305 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 := 7649; --<<value for cust_account_id you get from step 2> p_cust_acct_site_rec.party_site_id := 6672; --<<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; ***************************
  • 15. Output information .... x_cust_acct_site_id: 6585 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 := 6585; --<<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: 6639
  • 16. x_return_status: S x_msg_count: 0 x_msg_data: 0 *************************** /* END address */ commit; ********************************************************************** ***************************************************** ********************************************************************** ***************************************************** How to create two BILL_TO sites for the same customer via TCA API ------------------------------------------------------------------ Example: ------------------------------------ -- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'ACC01_01_02'; p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE'; -- p_cust_account_rec.orig_system_reference := '001_001'; -- is not mandatory
  • 17. p_organization_rec.organization_name := 'CUSTAPI2'; p_organization_rec.created_by_module := 'TCAPI_EXAMPLE'; hz_cust_account_v2pub.create_cust_account( 'T', p_cust_account_rec, p_organization_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; /* 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 := 'Address2a'; 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';
  • 18. 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; ------------------------------------ -- 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 := XX; --<<value for party_id from step 2> p_party_site_rec.location_id := XX; --<<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);
  • 19. dbms_output.put_line('x_msg_data: '||x_msg_data); dbms_output.put_line('***************************'); END; ------------------------------------ -- 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 := XX; --<<value for cust_account_id you get from step 2> p_cust_acct_site_rec.party_site_id := XX; --<<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; ------------------------------------ -- 6. Create an account site use using cust_acct_site_id from step 5 and site_use_code='BILL_TO' (first BILL_TO) ------------------------------------ DECLARE p_cust_site_use_rec HZ_CUST_ACCOUNT_SITE_V2PUB.CUST_SITE_USE_REC_TYPE; p_customer_profile_rec
  • 20. 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 := XX; --<<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; /* END address */ commit; ------------------------------------ -- 7. 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 := 'Address2b'; p_location_rec.city := 'San Mateo'; p_location_rec.postal_code := '94401';
  • 21. 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; ------------------------------------ -- 8. Create a party site using party_id from step 2 and location_id from step 7 ------------------------------------ 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 := XX; --<<value for party_id from step 2> p_party_site_rec.location_id := XX; --<<value for location_id from step 7> 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);
  • 22. 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; ------------------------------------ -- 9. Create an account site using cust_account_id from step 2 and party_site_id from step 8. ------------------------------------ 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 := XX; --<<value for cust_account_id you get from step 2> p_cust_acct_site_rec.party_site_id := XX; --<<value for party_site_id from step 8> 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; ------------------------------------ -- 10. Create an account site use using cust_acct_site_id from step 9 and site_use_code='BILL_TO' (Second BILL_TO) ------------------------------------ DECLARE p_cust_site_use_rec
  • 23. 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 := XX; --<<value for cust_acct_site_id from step 9> 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; commit; ********************************************************************** ***************************************************** ********************************************************************** ***************************************************** How to create BILL_TO and SHIP_TO sites via TCA API --------------------------------------------------- Example: ------------------------------------ -- 1a. Setup the Org_id ------------------------------------ exec dbms_application_info.set_client_info('204'); ------------------------------------
  • 24. -- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'ACC01_01_03'; p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE'; -- p_cust_account_rec.orig_system_reference := '001_001'; -- is not mandatory p_organization_rec.organization_name := 'CUSTAPI3'; p_organization_rec.created_by_module := 'TCAPI_EXAMPLE'; hz_cust_account_v2pub.create_cust_account( 'T', p_cust_account_rec, p_organization_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);
  • 25. 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; /* 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 := 'Address3a'; 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; ------------------------------------ -- 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;
  • 26. 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 := XX; --<<value for party_id from step 2> p_party_site_rec.location_id := XX; --<<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; ------------------------------------ -- 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 := XX; --<<value for cust_account_id you get from step 2> p_cust_acct_site_rec.party_site_id := XX; --<<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',
  • 27. 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; ------------------------------------ -- 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 := XX; --<<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);
  • 28. dbms_output.put_line('x_msg_data: '||x_msg_count); dbms_output.put_line('***************************'); END; /* END address */ commit; ------------------------------------ -- 7. 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 := 'Address3b'; 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; ------------------------------------ -- 8. Create a party site using party_idfrom step 2 and location_id from step 7 ------------------------------------ DECLARE
  • 29. 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 := XX; --<<value for party_id from step 2> p_party_site_rec.location_id := XX; --<<value for location_id from step 7> 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; ------------------------------------ -- 9. Create an account site using cust_account_id from step 2 and party_site_id from step 8. ------------------------------------ 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 := XX; --<<value for cust_account_id you get from step 2> p_cust_acct_site_rec.party_site_id := XX; --<<value for party_site_id from step 8> p_cust_acct_site_rec.language := 'US'; p_cust_acct_site_rec.created_by_module := 'TCAPI_EXAMPLE';
  • 30. 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; ------------------------------------ -- 10. Create an account site use using cust_acct_site_id from step 9 and site_use_code='SHIP_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 := XX; --<<value for cust_acct_site_id from step 9> p_cust_site_use_rec.site_use_code := 'SHIP_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);
  • 31. 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; commit; ********************************************************************** ***************************************************** ********************************************************************** ***************************************************** How to create a customer (ORGANIZATION) via TCA API with account_number off and party_number on? Suppose: -. Automatic customer numbering is not checked on System Options. -. HZ: Generate Party Number in Yes on Profile Options Form. ------------------------------------ -- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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
  • 32. p_cust_account_rec.account_name := 'FennerAccN'; p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE'; p_cust_account_rec.account_number := 'FennerAccN'; p_organization_rec.organization_name := 'FennerAccN'; p_organization_rec.created_by_module := 'TCAPI_EXAMPLE'; hz_cust_account_v2pub.create_cust_account( 'T', p_cust_account_rec, p_organization_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: 12189 x_account_number: FennerAccN x_party_id: 17602 x_party_number: 16047 x_profile_id: 8081 x_return_status: S x_msg_count: 0 x_msg_data: ***************************
  • 33. /* 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: 1000002012555 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;
  • 34. 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 := 17602; --<<value for party_id from step 2> p_party_site_rec.location_id := 1000002012555; --<<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: 12419 x_party_site_number: 10872 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;
  • 35. x_msg_data VARCHAR2(2000); x_cust_acct_site_id NUMBER; BEGIN p_cust_acct_site_rec.cust_account_id := 12189; --<<value for cust_account_id you get from step 2> p_cust_acct_site_rec.party_site_id := 12419; --<<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: 10061 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 := 10061; --<<value for
  • 36. 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: 10359 x_return_status: S x_msg_count: 0 x_msg_data: 0 *************************** /* END address */ commit; ********************************************************************** ***************************************************** ********************************************************************** ***************************************************** How To Create A Contact At Customer Level Without Phone Via TCA API ---------------------------------------------------------------- Example: ------------------------------------ -- 1a. Setup the Org_id ------------------------------------ exec dbms_application_info.set_client_info('204');
  • 37. ------------------------------------ -- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'ACC01_01_04'; p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE'; -- p_cust_account_rec.orig_system_reference := '001_001'; -- is not mandatory p_organization_rec.organization_name := 'CUSTAPI4'; p_organization_rec.created_by_module := 'TCAPI_EXAMPLE'; hz_cust_account_v2pub.create_cust_account( 'T', p_cust_account_rec, p_organization_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);
  • 38. 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; /* 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 := 'Address4'; 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; ------------------------------------ -- 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;
  • 39. 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 := XX; --<<value for party_id from step 2> p_party_site_rec.location_id := XX; --<<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; ------------------------------------ -- 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 := XX; --<<value for cust_account_id you get from step 2> p_cust_acct_site_rec.party_site_id := XX; --<<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(
  • 40. '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; ------------------------------------ -- 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 := XX; --<<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);
  • 41. 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; /* END address */ commit; /* BEGIN contact to an organization */ ------------------------------------ -- 7. Create a definition contact ------------------------------------ DECLARE p_create_person_rec HZ_PARTY_V2PUB.person_rec_type; 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_create_person_rec.person_pre_name_adjunct := 'MR.'; p_create_person_rec.person_first_name := 'Fennerc4'; p_create_person_rec.person_last_name := 'Giraldoc4'; p_create_person_rec.created_by_module := 'TCAPI_EXAMPLE'; HZ_PARTY_V2PUB.create_person( 'T', p_create_person_rec, 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_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;
  • 42. ------------------------------------ -- 8. Create a relation cont-org using party_id from step 7 and party_id from step 2 ------------------------------------ DECLARE p_org_contact_rec HZ_PARTY_CONTACT_V2PUB.ORG_CONTACT_REC_TYPE; x_org_contact_id NUMBER; x_party_rel_id NUMBER; x_party_id NUMBER; x_party_number VARCHAR2(2000); x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000); BEGIN p_org_contact_rec.department_code := 'ACCOUNTING'; p_org_contact_rec.job_title := 'ACCOUNTS OFFICER'; p_org_contact_rec.decision_maker_flag := 'Y'; p_org_contact_rec.job_title_code := 'APC'; p_org_contact_rec.created_by_module := 'TCAPI_EXAMPLE'; p_org_contact_rec.party_rel_rec.subject_id := XX; --<<value for party_id from step 7> p_org_contact_rec.party_rel_rec.subject_type := 'PERSON'; p_org_contact_rec.party_rel_rec.subject_table_name := 'HZ_PARTIES'; p_org_contact_rec.party_rel_rec.object_id := XX; --<<value for party_id from step 2> p_org_contact_rec.party_rel_rec.object_type := 'ORGANIZATION'; p_org_contact_rec.party_rel_rec.object_table_name := 'HZ_PARTIES'; p_org_contact_rec.party_rel_rec.relationship_code := 'CONTACT_OF'; p_org_contact_rec.party_rel_rec.relationship_type := 'CONTACT'; p_org_contact_rec.party_rel_rec.start_date := SYSDATE; hz_party_contact_v2pub.create_org_contact( 'T', p_org_contact_rec, x_org_contact_id, x_party_rel_id, x_party_id, x_party_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_org_contact_id: '||x_org_contact_id); dbms_output.put_line('x_party_rel_id: '||x_party_rel_id); 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_return_status: '||x_return_status); dbms_output.put_line('x_msg_count: '||x_msg_count);
  • 43. dbms_output.put_line('x_msg_data: '||x_msg_data); dbms_output.put_line('***************************'); END; ------------------------------------ -- 9. Create a contact using party_id you get 8 and cust_account_id from step 2 ------------------------------------ DECLARE p_cr_cust_acc_role_rec HZ_CUST_ACCOUNT_ROLE_V2PUB.cust_account_role_rec_type; x_cust_account_role_id NUMBER; x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000); BEGIN -- NOTE: -- must be unique CUST_ACCOUNT_ID, PARTY_ID,ROLE_TYPE -- must be unique CUST_ACCT_SITE_ID, PARTY_ID,ROLE_TYPE p_cr_cust_acc_role_rec.party_id := XX; --<<value for party_id from step 8> p_cr_cust_acc_role_rec.cust_account_id := XX; --<<value for cust_account_id from step 2> p_cr_cust_acc_role_rec.primary_flag := 'Y'; p_cr_cust_acc_role_rec.role_type := 'CONTACT'; p_cr_cust_acc_role_rec.created_by_module := 'TCAPI_EXAMPLE'; HZ_CUST_ACCOUNT_ROLE_V2PUB.create_cust_account_role( 'T', p_cr_cust_acc_role_rec, x_cust_account_role_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_role_id: '|| x_cust_account_role_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('***************************');
  • 44. END; /* END contact */ commit; ********************************************************************** ***************************************************** ********************************************************************** ***************************************************** How To Create A Contact At Address Level Without Phone Via TCA API Example: ------------------------------------ -- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'ACC01_01_06'; p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE'; -- p_cust_account_rec.orig_system_reference := '001_001'; -- is not mandatory p_organization_rec.organization_name := 'CUSTAPI6'; p_organization_rec.created_by_module := 'TCAPI_EXAMPLE';
  • 45. hz_cust_account_v2pub.create_cust_account( 'T', p_cust_account_rec, p_organization_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; /* 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 := 'Address6'; 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,
  • 46. 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; ------------------------------------ -- 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 := XX; --<<value for party_id from step 2> p_party_site_rec.location_id := XX; --<<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;
  • 47. ------------------------------------ -- 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 := XX; --<<value for cust_account_id you get from step 2> p_cust_acct_site_rec.party_site_id := XX; --<<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; ------------------------------------ -- 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);
  • 48. BEGIN p_cust_site_use_rec.cust_acct_site_id := XX; --<<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; /* END address */ commit; /* BEGIN contact to an address */ ------------------------------------ -- 7. Create a contact definition ------------------------------------ DECLARE p_create_person_rec HZ_PARTY_V2PUB.person_rec_type; 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_create_person_rec.person_pre_name_adjunct := 'MR.'; p_create_person_rec.person_first_name := 'Fennerc6'; p_create_person_rec.person_last_name := 'Giraldoc6'; p_create_person_rec.created_by_module := 'TCAPI_EXAMPLE'; HZ_PARTY_V2PUB.create_person(
  • 49. 'T', p_create_person_rec, 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_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; ------------------------------------ -- 8. Create a relation cont-org using party_id from step 7 and party_id from step 2 ------------------------------------ DECLARE p_org_contact_rec HZ_PARTY_CONTACT_V2PUB.ORG_CONTACT_REC_TYPE; x_org_contact_id NUMBER; x_party_rel_id NUMBER; x_party_id NUMBER; x_party_number VARCHAR2(2000); x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000); BEGIN p_org_contact_rec.department_code := 'ACCOUNTING'; p_org_contact_rec.job_title := 'ACCOUNTS OFFICER'; p_org_contact_rec.decision_maker_flag := 'Y'; p_org_contact_rec.job_title_code := 'APC'; p_org_contact_rec.created_by_module := 'TCAPI_EXAMPLE'; p_org_contact_rec.party_rel_rec.subject_id := XX; --<<value for party_id from step 7> p_org_contact_rec.party_rel_rec.subject_type := 'PERSON'; p_org_contact_rec.party_rel_rec.subject_table_name := 'HZ_PARTIES'; p_org_contact_rec.party_rel_rec.object_id := XX; --<<value for party_id from step 2> p_org_contact_rec.party_rel_rec.object_type := 'ORGANIZATION'; p_org_contact_rec.party_rel_rec.object_table_name := 'HZ_PARTIES'; p_org_contact_rec.party_rel_rec.relationship_code := 'CONTACT_OF'; p_org_contact_rec.party_rel_rec.relationship_type := 'CONTACT';
  • 50. p_org_contact_rec.party_rel_rec.start_date := SYSDATE; hz_party_contact_v2pub.create_org_contact( 'T', p_org_contact_rec, x_org_contact_id, x_party_rel_id, x_party_id, x_party_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_org_contact_id: '||x_org_contact_id); dbms_output.put_line('x_party_rel_id: '||x_party_rel_id); 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_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; ------------------------------------ -- 9. Create a contact using party_id you get 8, cust_account_id from step 2 and cust_acct_site_id from step 5 ------------------------------------ DECLARE p_cr_cust_acc_role_rec HZ_CUST_ACCOUNT_ROLE_V2PUB.cust_account_role_rec_type; x_cust_account_role_id NUMBER; x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000); BEGIN -- NOTE: -- must be unique CUST_ACCOUNT_ID, PARTY_ID,ROLE_TYPE -- must be unique CUST_ACCT_SITE_ID, PARTY_ID,ROLE_TYPE p_cr_cust_acc_role_rec.party_id := XX; --<<value for party_id from step 8> p_cr_cust_acc_role_rec.cust_account_id := XX; --<<value for cust_account_id from step 2> p_cr_cust_acc_role_rec.cust_acct_site_id := XX; --<<value for cust_acct_site_id from step 5> p_cr_cust_acc_role_rec.primary_flag := 'Y';
  • 51. p_cr_cust_acc_role_rec.role_type := 'CONTACT'; p_cr_cust_acc_role_rec.created_by_module := 'TCAPI_EXAMPLE'; HZ_CUST_ACCOUNT_ROLE_V2PUB.create_cust_account_role( 'T', p_cr_cust_acc_role_rec, x_cust_account_role_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_role_id: '|| x_cust_account_role_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; /* END contact */ commit; ********************************************************************** ***************************************************** ********************************************************************** ***************************************************** How To Create A Contact At Address Level Without Phone Via TCA API using conditions like: HZ: Generate Contact Number : No Fix How To Create A Contact At Address Level Without Phone Via TCA API using conditions like: Profiles Options: HZ: Generate Contact Number : No HZ: Generate Party Number : No HZ: Generate Party Site Number : No system Options Form has values: Automatic Site Numbering : NULL Automatic Customer Numbering : NULL Example:
  • 52. ------------------------------------ -- 1a. Setup the Org_id ------------------------------------ exec dbms_application_info.set_client_info('290'); ------------------------------------ -- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'CHEXAM001'; p_cust_account_rec.account_number := 'CHEXAM001'; p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE'; -- p_cust_account_rec.orig_system_reference := '001_001'; -- is not mandatory p_organization_rec.organization_name := 'CHEXAM001'; p_organization_rec.created_by_module := 'TCAPI_EXAMPLE'; p_organization_rec.party_rec.party_number := '0001122'; hz_cust_account_v2pub.create_cust_account( 'T', p_cust_account_rec, p_organization_rec, p_customer_profile_rec, 'F', x_cust_account_id, x_account_number, x_party_id, x_party_number, x_profile_id,
  • 53. 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: 2571 x_account_number: CHEXAM001 x_party_id: 27093 x_party_number: 0001122 x_profile_id: 2123 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 := 'Address0001aa'; 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';
  • 54. 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: 2474 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 := 27093; --<<value for party_id from step 2> p_party_site_rec.location_id := 2474; --<<value for location_id from step 3> p_party_site_rec.identifying_address_flag := 'Y'; p_party_site_rec.created_by_module := 'TCAPI_EXAMPLE'; p_party_site_rec.party_site_number := '0003344'; hz_party_site_v2pub.create_party_site( 'T', p_party_site_rec, x_party_site_id, x_party_site_number, x_return_status,
  • 55. 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: 2944 x_party_site_number: 0003344 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 := 2571; --<<value for cust_account_id you get from step 2> p_cust_acct_site_rec.party_site_id := 2944; --<<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 ....');
  • 56. 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: 2943 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 := 2943; --<<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'; p_cust_site_use_rec.location := 'LOC_XXXSS'; 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);
  • 57. 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; /* END address */ *************************** Output information .... x_site_use_id: 2963 x_return_status: S x_msg_count: 0 x_msg_data: 0 *************************** commit; /* BEGIN contact to an address */ ------------------------------------ -- 7. Create a contact definition ------------------------------------ DECLARE p_create_person_rec HZ_PARTY_V2PUB.person_rec_type; 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_create_person_rec.person_pre_name_adjunct := 'MR.'; p_create_person_rec.person_first_name := 'FennerDDD'; p_create_person_rec.person_last_name := 'GiraldoDDD'; p_create_person_rec.created_by_module := 'TCAPI_EXAMPLE'; p_create_person_rec.party_rec.party_number := '0001255'; HZ_PARTY_V2PUB.create_person( 'T', p_create_person_rec, 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 ....');
  • 58. 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_party_id: 27094 x_party_number: 0001255 x_profile_id: 25186 x_return_status: S x_msg_count: 0 x_msg_data: *************************** ------------------------------------ -- 8. Create a relation cont-org using party_id from step 7 and party_id from step 2 ------------------------------------ DECLARE p_org_contact_rec HZ_PARTY_CONTACT_V2PUB.ORG_CONTACT_REC_TYPE; x_org_contact_id NUMBER; x_party_rel_id NUMBER; x_party_id NUMBER; x_party_number VARCHAR2(2000); x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000); BEGIN p_org_contact_rec.department_code := 'ACCOUNTING'; p_org_contact_rec.job_title := 'APC'; p_org_contact_rec.decision_maker_flag := 'Y'; p_org_contact_rec.job_title_code := 'APC'; p_org_contact_rec.created_by_module := 'TCAPI_EXAMPLE'; p_org_contact_rec.party_rel_rec.subject_id := 27094; --<<value for party_id from step 7> p_org_contact_rec.party_rel_rec.subject_type := 'PERSON'; p_org_contact_rec.party_rel_rec.subject_table_name := 'HZ_PARTIES'; p_org_contact_rec.party_rel_rec.object_id := 27093; --<<value for party_id from step 2> p_org_contact_rec.party_rel_rec.object_type := 'ORGANIZATION'; p_org_contact_rec.party_rel_rec.object_table_name := 'HZ_PARTIES'; p_org_contact_rec.party_rel_rec.relationship_code := 'CONTACT_OF'; p_org_contact_rec.party_rel_rec.relationship_type := 'CONTACT'; p_org_contact_rec.party_rel_rec.start_date := SYSDATE; p_org_contact_rec.party_rel_rec.party_rec.party_number := '0012277';
  • 59. p_org_contact_rec.contact_NUMber := '0012266'; hz_party_contact_v2pub.create_org_contact( 'T', p_org_contact_rec, x_org_contact_id, x_party_rel_id, x_party_id, x_party_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_org_contact_id: '||x_org_contact_id); dbms_output.put_line('x_party_rel_id: '||x_party_rel_id); 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_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_org_contact_id: 1906 x_party_rel_id: 1908 x_party_id: 27095 x_party_number: 0012277 x_return_status: S x_msg_count: 0 x_msg_data: *************************** ------------------------------------ -- 9. Create a contact using party_id you get 8, cust_account_id from step 2 and cust_acct_site_id from step 5 ------------------------------------ DECLARE p_cr_cust_acc_role_rec HZ_CUST_ACCOUNT_ROLE_V2PUB.cust_account_role_rec_type; x_cust_account_role_id NUMBER; x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000); BEGIN
  • 60. -- NOTE: -- must be unique CUST_ACCOUNT_ID, PARTY_ID,ROLE_TYPE -- must be unique CUST_ACCT_SITE_ID, PARTY_ID,ROLE_TYPE p_cr_cust_acc_role_rec.party_id := 27095; --<<value for party_id from step 8> p_cr_cust_acc_role_rec.cust_account_id := 2571; --<<value for cust_account_id from step 2> p_cr_cust_acc_role_rec.cust_acct_site_id := 2943; --<<value for cust_acct_site_id from step 5> p_cr_cust_acc_role_rec.primary_flag := 'Y'; p_cr_cust_acc_role_rec.role_type := 'CONTACT'; p_cr_cust_acc_role_rec.created_by_module := 'TCAPI_EXAMPLE'; HZ_CUST_ACCOUNT_ROLE_V2PUB.create_cust_account_role( 'T', p_cr_cust_acc_role_rec, x_cust_account_role_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_role_id: '|| x_cust_account_role_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_role_id: 1906 x_return_status: S x_msg_count: 0 x_msg_data: *************************** /* END contact */ commit; ********************************************************************** ***************************************************** **********************************************************************
  • 61. ***************************************************** How To Create A Contact At Customer Level With Phone Via TCA API ---------------------------------------------------------------- Example of How To Add A Contact At Customer Level With Phone Via TCA API ------------------------------------ -- 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_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_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 := 'Fenner_01'; p_cust_account_rec.created_by_module := 'TCAPI_EXAMPLE'; p_organization_rec.organization_name := 'Fenner_01'; p_organization_rec.created_by_module := 'TCAPI_EXAMPLE'; hz_cust_account_v2pub.create_cust_account( 'T', p_cust_account_rec, p_organization_rec, p_customer_profile_rec, 'F', x_cust_account_id, x_account_number, x_party_id,
  • 62. 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: 10033 x_account_number: 2441 x_party_id: 11337 x_party_number: 20413 x_profile_id: 3231 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 := 'Address4'; 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';
  • 63. 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: 21581 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 := 11337; --<<value for party_id from step 2> p_party_site_rec.location_id := 21581; --<<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,
  • 64. 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: 5967 x_party_site_number: 4476 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 := 10033; --<<value for cust_account_id you get from step 2> p_cust_acct_site_rec.party_site_id := 5967; --<<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);
  • 65. 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: 4672 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 := 4672; --<<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);
  • 66. 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; / /* END address */ commit; /* BEGIN contact to an organization */ ------------------------------------ -- 7. Create a definition contact ------------------------------------ DECLARE p_create_person_rec HZ_PARTY_V2PUB.person_rec_type; 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_create_person_rec.person_pre_name_adjunct := 'MR.'; p_create_person_rec.person_first_name := 'FENNERCTFN_01'; p_create_person_rec.person_last_name := 'FENNERCTLN_01'; p_create_person_rec.created_by_module := 'TCAPI_EXAMPLE'; HZ_PARTY_V2PUB.create_person( 'T', p_create_person_rec, 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_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('***************************');