Friday, July 5, 2013

Customer Account Creation Using TCA APIs

Purpose

The purpose of this article is to explain Customer Account Creation Flow and Data Model with the help of Trading Community Architecture (TCA) API scripts to create the data, and view the result using database queries, application navigation and screens.

Scope

This article will cover:
•Categories of Customer Entities
•TCA API Coding Steps
•Example of Customer Account Creation using TCA APIs

Details

CUSTOMER ENTITIES

Party Layer APIs

Customer Entities can be grouped under two main categories – Party layer and Account layer entities. These are the main entities that are used for Receivables Customer information. A party entity must exist before the Account entity can be created. They can be created using the Party APIs given here.
However, some party entities can also be created together with the Account, using the Account APIs.
EntityAPITables
Party – OrganizationHZ_PARTY_V2PUB.create_organizationHZ_PARTIES
HZ_ORGANIZATION_PROFILES
Party - PersonHZ_PARTY_V2PUB.create_personHZ_PARTIES
HZ_PERSON_PROFILES
LocationHZ_LOCATION_V2PUB.create_locationHZ_LOCATIONS
HZ_LOCATIONS_PROFILES
Party SiteHZ_PARTY_SITE_V2PUB.create_party_siteHZ_PARTY_SITES
Party Site UseHZ_PARTY_SITE_V2PUB.create_party_site_useHZ_PARTY_SITE_USES
Party Contact (Organization Contact)HZ_PARTY_CONTACT_V2PUB.create_org_contactHZ_ORG_CONTACTS
HZ_RELATIONSHIPS
(Subject: Contact person Object: Organization/Person)
HZ_PARTIES
(party_type=PARTY_RELATIONSHIP)
Contact RoleHZ_PARTY_CONTACT_V2PUB.create_org_contact_roleHZ_ORG_CONTACT_ROLES
Contact PointHZ_CONTACT_POINT_V2PUB.create_contact_point
HZ_CONTACT_POINT_V2PUB.create_phone_contact_point
HZ_CONTACT_POINT_V2PUB.create_email_contact_point
HZ_CONTACT_POINT_V2PUB.create_web_contact_point
HZ_CONTACT_POINT_V2PUB.create_telex_contact_point
HZ_CONTACT_POINT_V2PUB.create_edi_contact_point
HZ_CONTACT_POINT_V2PUB.create_eft_contact_point
HZ_CONTACT_POINTS
Owner_table_name=HZ_PARTIES and owner_table_id=party_id
Or
Owner_table_name=HZ_PARTY_SITES and owner_table_id=party_site_id

Account Layer APIs
EntityAPITables
Customer AccountHZ_CUST_ACCOUNT_V2PUB.create_cust_accountHZ_CUST_ACCOUNTS
HZ_PARTIES
HZ_CUSTOMER_PROFILES
HZ_CUST_PROFILE_AMTS
Account SiteHZ_CUST_ACCOUNT_SITE_V2PUB.create_cust_acct_siteHZ_CUST_ACCT_SITES_ALL
Account Site UseHZ_CUST_ACCOUNT_SITE_V2PUB.create_cust_site_useHZ_CUST_SITE_USES_ALL
HZ_CUSTOMER_PROFILES
HZ_CUST_PROFILE_AMTS
Account RelationshipHZ_CUST_ACCOUNT_V2PUB. create_cust_acct_relateHZ_CUST_ACCT_RELATE_ALL
Account / Account Site Use ProfileHZ_CUSTOMER_PROFILE_V2PUB.create_customer_profileHZ_CUSTOMER_PROFILESHZ_CUST_PROFILE_AMTS
Account / Account Site Use Profile AmountHZ_CUSTOMER_PROFILE_V2PUB.create_cust_profile_amtHZ_CUST_PROFILE_AMTS
Account / Account Site Role (Contact)HZ_CUST_ACCOUNT_ROLE_V2PUB.create_cust_account_roleHZ_CUST_ACCOUNT_ROLES
Account / Account Site Role ResponsibilityHZ_CUST_ACCOUNT_ROLE_V2PUB.create_role_responsibilityHZ_ROLE_RESPONSIBILITY

Customer Account Creation Flow

Sample Code Structure:
Login to SQLPLUS with user APPS.

-- Set operating unit context
mo_global.init('S',&operating_unit_id);

-- PL/SQL procedure to run
set serveroutput on
DECLARE
-- Standard IN/OUT parameter variables
p_init_msg_list VARCHAR2(1) := FND_API.G_TRUE;
x_return_status VARCHAR2(2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);

-- API Record Type variable
p_person_rec HZ_PARTY_V2PUB.PERSON_REC_TYPE;

-- API output parameter variables
x_party_id NUMBER;
x_party_number VARCHAR2(2000);
x_profile_id NUMBER;
BEGIN
-- Values to pass to API
p_person_rec.person_first_name := 'Ash';
p_person_rec.person_last_name := 'Lee';
p_person_rec.created_by_module := 'TCA_V2_API';

-- API to call
HZ_PARTY_V2PUB.create_person (
p_init_msg_list,
p_person_rec,
x_party_id,
x_party_number,
x_profile_id,
x_return_status,
x_msg_count,
x_msg_data);

-- Result status and error handling
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);
IF x_msg_count > 1 THEN
FOR I IN 1..x_msg_count LOOP
dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.
Get(p_encoded => FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF;

-- Display API output parameters
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);

EXCEPTION
when others then dbms_output.put_line(sqlerrm(sqlcode));
END;

Sample Flow:
 1. Customer Account: Model Artworks Asia
     •Organization Party: Model Artworks
     •Organization Profile
     •Account Profile and Profile Amounts
 2. Location: 1 Robinson Road, Singapore 601010
 3. Organization Address: Model Artworks – 1 Robinson Road
 4. Customer Account Site: Model Artworks Asia – 1 Robinson Road
 5. Customer Account Site Use: Model Artworks Asia – 1 Robinson Road – BILL TO
     •Party Site Use: Model Artworks – 1 Robinson Road – BILL TO
     •Account Site Profile and Profile Amounts
 6. Person: Ash Lee
 7. Organization Contact: Ash Lee – Model Artworks
 8. Location: 2 Robinson Road, Singapore 601020.
 9. Organization Contact - Address: Ash Lee – Model Artworks – 2 Robinson Road
10. Organization Contact - Contact Point: Ash Lee – Model Artworks – Phone 65-7771212
11. Customer Account Role: Model Artworks Asia - Ash Lee – Model Artworks – CONTACT
12. Customer Account Role Responsibility: - Ash Lee – Model Artworks – CONTACT – Bill to


1. Create Account / Organization / Organization Profile / Account Profile / Account Profile Amount 

API: HZ_CUST_ACCOUNT_V2PUB.create_cust_account
Record type variables: 
  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;
Output variables:
  x_cust_account_id NUMBER;
  x_account_number VARCHAR2(2000);
  x_party_id NUMBER;
  x_party_number VARCHAR2(2000);
  x_profile_id NUMBER;
Values to pass to API:
  p_cust_account_rec.account_name := 'Model Artworks Asia';
  p_cust_account_rec.created_by_module := 'TCA_V2_API';
  p_organization_rec.organization_name := 'Model Artworks';
  p_organization_rec.created_by_module := 'TCA_V2_API';

Output:
x_cust_account_id: 252705
x_account_number: 7660
x_party_id: 488974
x_party_number: 55446
x_profile_id: 415422

Query Data:
select cust_account_id, party_id, account_number, account_name
from hz_cust_accounts
where cust_account_id = 252705;

CUST_ACCOUNT_ID PARTY_ID ACCOUNT_NUMBER ACCOUNT_NAME
252705          488974   7660           Model Artworks Asia

select party_id, party_number, party_type, party_name
from hz_parties
where party_id = 488974;

PARTY_ID PARTY_NUMBER PARTY_TYPE   PARTY_NAME
488974   55446        ORGANIZATION Model Artworks

select organization_profile_id,party_id
from hz_organization_profiles
where organization_profile_id = 414426;

ORGANIZATION_PROFILE_ID PARTY_ID
415422                  488974

select cust_account_profile_id, cust_account_id, party_id, profile_class_id, site_use_id
from hz_customer_profiles
where cust_account_id = 252705;

CUST_ACCOUNT_PROFILE_ID CUST_ACCOUNT_ID PARTY_ID PROFILE_CLASS_ID SITE_USE_ID
244818                  252705          488974 0

select cust_acct_profile_amt_id, cust_account_profile_id, cust_account_id, site_use_id, currency_code
from hz_cust_profile_amts
where cust_account_profile_id = 244818;

CUST_ACCT_ CUST_ACCOUNT_
PROFILE_AMT_ID PROFILE_ID CUST_ACCOUNT_ID SITE_USE_ID CURRENCY_CODE
241143 244818 252705 CAD
241144 244818 252705 EUR
241145 244818 252705 GBP
241146 244818 252705 RUR
241147 244818 252705 SEK
241148 244818 252705 USD 

Navigation: 
Receivables> Customers> Query Name = Model Artworks


Receivables> Customers> Accounts> Account – Model Artworks Asia [Details] > Account Profile


Receivables> Customers> Accounts> Account – Model Artworks Asia [Details] > Profile Amounts


For Party and Organization Profile:
Oracle Customers Online> Customers> Organizations> Query Name = Model Artworks> Click on Name link> Profile


2. Create Location for Organization Address

API: HZ_LOCATION_V2PUB.create_location
Record type variables:
  p_location_rec HZ_LOCATION_V2PUB.LOCATION_REC_TYPE;
Output variables:
  x_location_id NUMBER;
Values to pass to API:
  p_location_rec.country := 'SG';
  p_location_rec.address1 := '1 Robinson Road';
  p_location_rec.city := 'Singapore';
  p_location_rec.postal_code := '601010';
  p_location_rec.created_by_module := 'TCA_V2_API';

Output:
  x_location_id: 28964

Query Data:
select location_id,address1,city,postal_code
from hz_locations
where location_id = 28964;

LOCATION_ID ADDRESS1        CITY      POSTAL_CODE
28964       1 Robinson Road Singapore 601010


3. Organization Address - Create Party Site

API: HZ_PARTY_SITE_V2PUB.create_party_site
Record type variables:
  p_party_site_rec HZ_PARTY_SITE_V2PUB.PARTY_SITE_REC_TYPE;
Output variables:
  x_party_site_id NUMBER;
  x_party_site_number VARCHAR2(2000);
Values to pass to API:
  p_party_site_rec.party_id := 488974; -- value of party_id from step 1
  p_party_site_rec.location_id := 28964; -- value of location_id from step 2
  p_party_site_rec.identifying_address_flag := 'Y';
  p_party_site_rec.created_by_module := 'TCA_V2_API';

Output:

  x_party_site_id: 357430
  x_party_site_number: 26165

Query Data:
select party_site_id, party_id, location_id, party_site_number
from hz_party_sites
where party_site_id = 357430;

PARTY_SITE_ID PARTY_ID LOCATION_ID PARTY_SITE_NUMBER
357430        488974   28964       26165


Navigation:
Oracle Customers Online> Customers> Organizations> Query Name = Model Artworks> Click on Name link> Addresses


4. Create Customer Account Site

API: HZ_CUST_ACCOUNT_SITE_V2PUB.create_cust_acct_site
Record type variables:
  p_cust_acct_site_rec hz_cust_account_site_v2pub.cust_acct_site_rec_type;
Output variables:
  x_cust_acct_site_id NUMBER;
Values to pass to API:
  p_cust_acct_site_rec.cust_account_id := 252705; -- value of cust_account_id from step 1
  p_cust_acct_site_rec.party_site_id := 357430; -- value of party_site_id from step 3
  p_cust_acct_site_rec.created_by_module := 'TCA_V2_API';

Output:

 x_cust_acct_site_id: 13903

Query Data:
select cust_acct_site_id, cust_account_id, party_site_id, org_id
from hz_cust_acct_sites_all
where cust_acct_site_id = 13903;

CUST_ACCT_SITE_ID CUST_ACCOUNT_ID PARTY_SITE_ID ORG_ID
13903             252705          357430        204


Navigation:
Receivables> Customers> Accounts> Account – Model Artworks Asia [Details]> Account> Sites


5. Create Account Site Use / Party Site Use / Account Site Profile / Account Site Profile Amounts 

API: HZ_CUST_ACCOUNT_SITE_V2PUB.create_cust_site_use
Record type variables:
  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;
Output variables:
  x_site_use_id NUMBER;
Values to pass to API:
  p_cust_site_use_rec.cust_acct_site_id := 13903; -- value of cust_acct_site_id from step 4
  p_cust_site_use_rec.site_use_code := 'BILL_TO';
  p_cust_site_use_rec.created_by_module := 'TCA_V2_API';
  select hz_cust_site_uses_s.nextval into p_location from dual;
  p_cust_site_use_rec.location := p_location;

Output:

  x_site_use_id: 16390

Query Data:
select site_use_id, cust_acct_site_id, site_use_code, location, org_id
from hz_cust_site_uses_all
where site_use_id = 16390;

SITE_USE_ID CUST_ACCT_SITE_ID SITE_USE_CODE LOCATION ORG_ID
16390       13903             BILL_TO       16389    204

Party Site Use:

select party_site_use_id, party_site_id, site_use_type, primary_per_type
from hz_party_site_uses
where party_site_id = 357430;

PARTY_SITE_USE_ID PARTY_SITE_ID SITE_USE_TYPE PRIMARY_PER_TYPE
322876            357430        BILL_TO       Y

Account Site Use Profile:

select cust_account_profile_id, cust_account_id, party_id, profile_class_id, site_use_id
from hz_customer_profiles
where cust_account_id = 252705;

CUST_ACCOUNT_PROFILE_ID CUST_ACCOUNT_ID PARTY_ID PROFILE_CLASS_ID SITE_USE_ID

244818                  252705          488974 0
245819                  252705          488974 0 16390

Account Site Use Profile Amounts:

select cust_acct_profile_amt_id, cust_account_profile_id, cust_account_id, site_use_id, currency_code
from hz_cust_profile_amts
where cust_account_profile_id = 245819;


CUST_ CUST_
ACCT_PROFILE_AMT_ID ACCOUNT_PROFILE_ID CUST_ACCOUNT_ID SITE_USE_ID CURRENCY_CODE

242143 245819 252705 16390 CAD
242144 245819 252705 16390 EUR
242145 245819 252705 16390 GBP
242146 245819 252705 16390 RUR
242147 245819 252705 16390 SEK
242148 245819 252705 16390 USD 

Navigation:
Receivables> Customers> Accounts> Account – Model Artworks Asia [Details]> Sites> Account Sites [Details] – Business Purposes


Receivables> Customers> Accounts> Account – Model Artworks Asia [Details]> Sites [Details] – Profile


Receivables> Customers> Accounts> Account – Model Artworks Asia [Details]> Sites [Details] – Profile Amounts


Party Site Use:
Oracle Customers Online> Customers> Organizations> Query Name = Model Artworks> Click on Name link> Addresses - Purpose



6. Create Person

API: HZ_PARTY_V2PUB.create_person
Record type variables:
  p_person_rec HZ_PARTY_V2PUB.PERSON_REC_TYPE;
Output variables:
  x_party_id NUMBER;
  x_party_number VARCHAR2(2000);
  x_profile_id NUMBER;
Values to pass to API:
  p_person_rec.person_first_name := 'Ash';
  p_person_rec.person_last_name := 'Lee';
  p_person_rec.created_by_module := 'TCA_V2_API';

Output:

x_party_id = 490974

Query Data:
Select party_id, party_name
From hz_parties
Where party_id = 490974;

PARTY_ID PARTY_NAME
490974   Ash Lee

Navigation:
Oracle Customers Online> Customers> Persons> Query Name = Ash Lee



7. Create Organization Contact (Link Person to Organization)


API: HZ_PARTY_CONTACT_V2PUB.create_org_contact
Record type variables:
  p_org_contact_rec HZ_PARTY_CONTACT_V2PUB.org_contact_rec_type;
Output variables:
  x_corg_contact_id NUMBER;
  x_cparty_rel_id NUMBER;
  x_cparty_id NUMBER;
  x_cparty_number VARCHAR2(2000);
Values to pass to API:
  p_org_contact_rec.created_by_module := 'TCA_V2_API';
  p_org_contact_rec.party_rel_rec.subject_id:= 490974; -- value of party_id from step 6
  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:= 488974; -- value of party_id from step 1
  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_type:='CONTACT';
  p_org_contact_rec.party_rel_rec.relationship_code:='CONTACT_OF';
  p_org_contact_rec.party_rel_rec.status := 'A';

  --For Organization Address level contact, assign following value:
  --p_org_contact_rec.party_site_id:=357430; -- value of party_site_id from step 3

Output:
x_org_contact_id = 186069
x_party_rel_id = 643026
x_party_id = 490975
x_party_number = 55488

Query Data:
select org_contact_id, party_relationship_id
from hz_org_contacts
where org_contact_id = 186069;

ORG_CONTACT_ID PARTY_RELATIONSHIP_ID
-------------- ---------------------
186069         643026

Relationship:

select relationship_id, subject_id, subject_type, subject_table_name,
object_id, object_type, object_table_name, directional_flag
relationship_type, relationship_code, party_id
from hz_relationships
where relationship_id = 643026;

RELATIONSHIP_ID SUBJECT_ID SUBJECT_TYPE SUBJECT_TABLE_NAME OBJECT_ID OBJECT_TYPE OBJECT_TABLE_NAME DIRECTIONAL_FLAG RELATIONSHIP_TYPE RELATIONSHIP_CODE PARTY_ID

643026 488974 ORGANIZATION HZ_PARTIES 490974 PERSON HZ_PARTIES B CONTACT 490975

643026 490974 PERSON HZ_PARTIES 488974 ORGANIZATION HZ_PARTIES F CONTACT_OF 490975


Relationship party:

select party_id, party_number, party_type, party_name
from hz_parties
where party_id = 490975;

PARTY_ID PARTY_NUMBER PARTY_TYPE         PARTY_NAME
490975   55488        PARTY_RELATIONSHIP Ash Lee-Model Artworks-55488 

Navigation:
Oracle Customers Online> Customers> Organizations> Query Name = Model Artworks> Click on Name link> Relationships> Contacts




8. Organization Contact Address – Create Location


API: HZ_LOCATION_V2PUB.create_location
Record type variables:
  p_location_rec HZ_LOCATION_V2PUB.LOCATION_REC_TYPE;
Output variables:
  x_location_id NUMBER;
Values to pass to API:
  p_location_rec.country := 'SG';
  p_location_rec.address1 := '2 Robinson Road';
  p_location_rec.city := 'Singapore';
  p_location_rec.postal_code := '601020';
  p_location_rec.created_by_module := 'TCA_V2_API';

Output:

x_location_id: 28985

Query Data:
select location_id,address1,city,postal_code
from hz_locations
where location_id = 28985;

LOCATION_ID ADDRESS1        CITY      POSTAL_CODE
28985       2 Robinson Road Singapore 601020
9. Organization Contact Address - Create Party Site 

API: HZ_PARTY_SITE_V2PUB.create_party_site
Record type variables:
  p_party_site_rec HZ_PARTY_SITE_V2PUB.PARTY_SITE_REC_TYPE;
Output variables:
  x_party_site_id NUMBER;
  x_party_site_number VARCHAR2(2000);
Values to pass to API:
  p_party_site_rec.party_id := 490975; -- value of party_id from step 7
  p_party_site_rec.location_id := 28985; -- value of location_id from step 8
  p_party_site_rec.identifying_address_flag := 'Y';
  p_party_site_rec.created_by_module := 'TCA_V2_API';

Output:

x_party_site_id: 358431
x_party_site_number: 26185

Query Data:
select party_site_id, party_id, location_id, party_site_number
from hz_party_sites
where party_site_id = 358431;

PARTY_SITE_ID PARTY_ID LOCATION_ID PARTY_SITE_NUMBER
358431        488975   28985       26185


Navigation:
Oracle Customers Online> Customers> Organizations> Query Name = Model Artworks> Click on Name link> Relationships> Contacts – Address



10. Organization Contact - Create Contact Point – Phone number

API: HZ_CONTACT_POINT_V2PUB.create_contact_point
Record type variables:
  p_contact_point_rec HZ_CONTACT_POINT_V2PUB.CONTACT_POINT_REC_TYPE;
Output variables:
  p_edi_rec HZ_CONTACT_POINT_V2PUB.EDI_REC_TYPE;
  p_email_rec HZ_CONTACT_POINT_V2PUB.EMAIL_REC_TYPE;
  p_phone_rec HZ_CONTACT_POINT_V2PUB.PHONE_REC_TYPE;
  p_telex_rec HZ_CONTACT_POINT_V2PUB.TELEX_REC_TYPE;
  p_web_rec HZ_CONTACT_POINT_V2PUB.WEB_REC_TYPE;
  x_contact_point_id NUMBER;
Values to pass to API:
  p_contact_point_rec.contact_point_type := 'PHONE';
  p_contact_point_rec.owner_table_name := 'HZ_PARTIES';
  p_contact_point_rec.owner_table_id := '490975'; -- value of party_id from step 7
  p_contact_point_rec.primary_flag := 'Y';
  p_contact_point_rec.contact_point_purpose := 'BUSINESS';
  p_phone_rec.phone_country_code := '65';
  p_phone_rec.phone_number := '6777-1212';
  p_phone_rec.phone_line_type := 'GEN';
  p_contact_point_rec.created_by_module := 'TCA_V2_API';

Output:

x_contact_point_id: 350447

Query Data:

select contact_point_id, contact_point_type, owner_table_name, owner_table_id, primary_flag, phone_country_code, phone_number
from hz_contact_points
where contact_point_id = 350447;

CONTACT_ CONTACT_   OWNER_     OWNER_   PRIMARY PHONE_   PHONE_
POINT_ID POINT_TYPE TABLE_NAME TABLE_ID _FLAG   COUNTRY_ NUMBER
CODE

350447   PHONE    HZ_PARTIES   490975   Y       65     6777-1212


Navigation:
Oracle Customers Online> Customers> Organizations> Query Name = Model Artworks> Click on Name link> Relationships> Contacts – Phone



11. Create Customer Account Role (Link Organization Contact to Customer Account)


API: HZ_CUST_ACCOUNT_ROLE_V2PUB.create_cust_account_role
Record type variables:
  p_cust_account_role_rec HZ_CUST_ACCOUNT_ROLE_V2PUB.CUST_ACCOUNT_ROLE_REC_TYPE;
Output variables:
  x_cust_account_role_id NUMBER;
Values to pass to API:
  p_cust_account_role_rec.created_by_module := 'TCA_V2_API';
  p_cust_account_role_rec.party_id := 490975; -- value of party_id from step 7
  p_cust_account_role_rec.cust_account_id := 252705; -- value of cust_account_id from step 1
  p_cust_account_role_rec.role_type := 'CONTACT';
  p_cust_account_role_rec.status := 'A';

  -- Note: If contact is at site level, assign value to cust_acct_site_id
  --p_cust_account_role_rec.cust_acct_site_id := 13903;

Output:
x_cust_account_role_id=81851

Query Data:
select cust_account_role_id, party_id, cust_account_id, cust_acct_site_id, role_type
from hz_cust_account_roles
where cust_account_role_id = 81851;

CUST_ACCOUNT_ROLE_ID PARTY_ID CUST_ACCOUNT_ID CUST_ACCT_SITE_ID ROLE_TYPE
81851                490975   252705                      CONTACT

Navigation:
Receivables> Customers> Account – Model Artworks Asia [Details]> Communication> Account Contacts


Receivables> Customers> Account – Model Artworks Asia [Details]> Communication> Account Contacts [Details]



12. Create Customer Account Role Responsibility 


API: HZ_CUST_ACCOUNT_ROLE_V2PUB.create_role_responsibility
Record type variables:
  p_role_responsibility_rec HZ_CUST_ACCOUNT_ROLE_V2PUB.role_responsibility_rec_TYPE;
Output variables:
  x_responsibility_id NUMBER;
Values to pass to API:
  p_role_responsibility_rec.created_by_module := 'TCA_V2_API';
  p_role_responsibility_rec.cust_account_role_id:=81851; -- value of cust_account_role_id from step 11
  p_role_responsibility_rec.primary_flag:='Y';
  p_role_responsibility_rec.responsibility_type:='BILL_TO';

Output:
x_responsibility_id=34406

Query Data:
select responsibility_id,cust_account_role_id,responsibility_type,primary_flag
from hz_role_responsibility
where responsibility_id = 34406;

RESPONSIBILITY_ID CUST_ACCOUNT_ROLE_ID RESPONSIBILITY_TYPE PRIMARY_FLAG
34406             81851                BILL_TO                  Y

Navigation:
Receivables> Customers> Account – Model Artworks Asia [Details]> Communication> Account Contacts [Details] > Contact Roles

2 comments: