TCAAPIEX

109
Using TCA APIs Including Examples – V2 An Oracle White Paper May 2002 Author : Viswanathan Rajagopalan Creation Date : April 2002 Last Updated : May 2002 Version : 1.0

Transcript of TCAAPIEX

Page 1: TCAAPIEX

Using TCA APIs Including Examples – V2

An Oracle White Paper May 2002 Author : Viswanathan Rajagopalan Creation Date : April 2002 Last Updated : May 2002 Version : 1.0

Page 2: TCAAPIEX

Using TCA APIs including Examples – V2

Introduction To API .........................................................................................3 API Components...........................................................................................4 Advantages of Using TCA API...................................................................4

Features of TCA API ........................................................................................5 Exception Handling and Results Messages ...............................................5 Messages .........................................................................................................5 Robust Validation..........................................................................................6 Locking Mechanism ......................................................................................6 Debug Messages (PL/SQL API) ................................................................7

Location of API in Oracle Applications DirectoryError! Bookmark not defined. Identification of the Package Name and Version of an API.................... 10 Uploading Data Using API............................................................................ 10 APIs Available For Trading Community Architecture ............................. 11 Example on running TCA API..................................................................... 13

Example 1 : Running The Create Organization API ............................ 13 Example 2 : Running The Create Person API ....................................... 16 Example 3 : Running The Create Group API........................................ 19 Example 4 : Create Org Contact API...................................................... 22 Example 5 : Create Location API ............................................................ 26 Example 6 : Update Location API........................................................... 29 Example 7 : Create Party Site API ........................................................... 32 Example 8 : Create Party Site Use API ................................................... 35 Example 9 : Create Party Site API ........................................................... 37 Example 10 : Create Relationship Type API.......................................... 41 Example 11 : Create Relationship API................................................... 45 Example 12 : Create Class Category API................................................ 50 Example 13 : Create Code Assignment API .......................................... 53 Example 14 : Create Customer Account API ........................................ 57 Example 15 : Update Customer Account API....................................... 61 Example 16 : Create Customer Account API ........................................ 64 Example 17 : Update Customer Account Site Use API ....................... 67 Example 18 : Create Customer Profile API ........................................... 70 Example 19 : Update Customer Profile API.......................................... 73 Example 20 : Create Location Assignment API .................................... 76

PL/SQL Record Structures Used by TCA APIs ....................................... 79 PL/SQL Record Structure for Organization ......................................... 79 PL/SQL Record Structure for Person .................................................... 82 PL/SQL Record Structure for Group..................................................... 83 PL/SQL Record Structure for Organization Contact .......................... 83

Documentation on using TCA APIs - V2 Page 1

Page 3: TCAAPIEX

PL/SQL Record Structure for Location................................................. 84 PL/SQL Record Structure for Party Site................................................ 86 PL/SQL Record Structure for Party Site Use........................................ 87 PL/SQL Record Structure for Contact Point........................................ 87 PL/SQL Record Structure for Phone ..................................................... 88 PL/SQL Record Structure for Create Relationship Type API............ 88 PL/SQL Record Structure for Create Relationship API...................... 89 PL/SQL Record Structure for Create Class Category API.................. 90 PL/SQL Record Structure for Create Code Assignment API ............ 91 PL/SQL Record Structure for Customer Account............................... 91 PL/SQL Record Structure for Customer Account Site ....................... 93 PL/SQL Record Structure for Customer Account Site Use ............... 95 PL/SQL Record Structure for Create Customer Profile API ............. 97

Messages for the TCA API.......................................................................... 100

Documentation on using TCA APIs - V2 Page 2

Page 4: TCAAPIEX

Using TCA APIs including Examples – V2

INTRODUCTION TO API Application Programming Interface (API) is a PL/SQL packaged procedure which can be used as an alternative to traditional Application online form.

Using APIs give users an advantage of adding data to the system is that user can enter new information or alter existing data without entering information manually into the application.

APIs insures the integrity of the interrelationship of Oracle Applications tables. User can modify application information without being aware of every feature of the database structure. It also depends on the API to update all the interrelated tables.

Continuous utilization of APIs helps to protect customer-specific data from database structural changes. As the table structures changes, the APIs can be modified to those same structural changes so that data can continue to be modified without any error or need to update coding.

The APIs available in Oracle Receivables have been written to fulfill business needs like Create Customer, Update Customer Contact etc. and can be used in many other ways like :

a) Data Uploads - Bulk transfer of data from an existing system into Oracle Receivables. b) Interfacing - Regular interface from, for example, a Third party Personnel system into Oracle

Receivables. c) Spreadsheets - Uploading data via ADE. d) Forms - standard interface, standard or web forms.

While the API package contains many procedures to insert, modify, or delete application data, the API is not executed on its own. The API must be called, or executed, by other pl/sql modules, by a direct SQL*Plus call, or through a front end such as the Data Pump.

The API package should never be modified for specific custom use. If modified, Oracle will not be able to support them. If user needs additional functionality, APIs can be used as building blocks, to be called within a more extensive package that user may build to address the unique functionality desired.

PL/SQL Public API , JAVA Public API and Forms API are the three categories of APIs. The discussion in this document will be on PL/SQL V2 Public API for TCA.

Documentation on using TCA APIs - V2 Page 3

Page 5: TCAAPIEX

INTRODUCTION TO TCA API

The TCA API is an integrated set of code designed in a highly modular fashion, resulting in code that are easy to understand, maintain and extend.

The modular approach defaults and validates users who enter infromation, defauts information not provided by the user and calls the appropriate entity handler to perform the business related tasks.

Customers, consultants, and Oracle internal development teams can use Version 2 of the public TCA application programming interfaces (APIs). Version 1 of the APIs are only made available to Oracle internal development teams. The Version 2 Public API feature is available from HZ Patchset E.

The Trading Community Architecture (TCA) datamodel is the foundation for the 11i Oracle e-Business Suite of Applications via PL/SQL APIs. These APIs (version 2) will be supported for use by customers and consultants and are available for use by internal product teams in ERP and CRM. This is a step forward from the version 1 APIs that are available only for use by internal product teams.

API Components �� API category �� PL/SQL package �� PL/SQL record structure �� PL/SQL procedure �� Parameter description �� Validations

Advantages of Using TCA API �� Flexible, easy to understand and modular. �� Extensive debugging capability. �� Extensive error handling and reporting capability. �� Robust validation in all of the APIs. �� A new locking mechanism based on the OBJECT_VERSION_NUMBER field, which has been

included in all of the HZ entities for which the public APIs have been provided. �� Standard signature and availability of common parameters

The following main categories of entities are covered : �� Parties - person, organization, group �� Locations �� Party sites, party site use �� Organization contact, organization contact role �� Contact points �� Contact preferences �� Relationship types �� Relationships �� Classification �� Customer accounts �� Account sites and site uses �� Customer account role, role responsibility Customer profile and customer profile amount

Documentation on using TCA APIs - V2 Page 4

Page 6: TCAAPIEX

FEATURES OF TCA API

Exception Handling and Results Messages The APIs provide an extensive set of error-handling and error-reporting mechanisms. The errors that are encountered in the different phases of the API execution are reported and put on the message stack. The calling program has the option of displaying all the error messages or the first error message on the stack. If there is only one error in the message stack, the error is displayed as one of the output parameters of the API routine. User need not fetch that message from the stack. There are three types of information that the TCA APIs provide to their calling programs:

�� Overall status �� Messages describing the operations performed or errors encountered by the API �� Output values that the program making the call to the API might need to use

Return Status The return status (x_return_status) of the API informs the caller about the result of the operation or operations performed by the API. The return status values are: Success FND_API. G_RET_STS_SUCCESS (PL/SQL API)

A success return status indicates that the API performed all the operations requested by its caller. A success return status can be accompanied by informative messages in the API message list. Failure FND_API. G_RET_STS_ERROR (PL/SQL API)

An error return status indicates that the API failed to perform some or all the operations requested by its caller. An error return status is usually accompanied by messages describing any errors and how to resolve them. In most cases, user should be able to correct normal, expected errors such as missing attributes or invalid date ranges. Unexpected Error FND_API. G_RET_STS_UNEXP_ERROR (PL/SQL API) An unexpected error status indicates that the API encounteres an unexpected error condition that it could not handle. In this case, the API cannot continue its regular processing. Examples of such errors are irrecoverable data inconsistency errors, memory errors and programming errors such as attempting to divide by zero. In most cases, an end user is unable to correct unexpected errors. These errors usually require resolution by a system administrator or an application developer.

Messages The APIs put result messages into a message list. Programs calling these APIs can then get the messages from the list and process those messages by issuing them, loading them into a database table, or writing them to a log file. The APIs store messages in an encoded format so that the API callers can use standard functions provided by the message dictionary to find message names. With the message dictionary, users can store these messages in database tables and generate reports from these tables in different languages. For more information, see List of Messages.

Documentation on using TCA APIs - V2 Page 5

Page 7: TCAAPIEX

The API message list must be initialized every time a program calls an API. API callers can either call the message list utility function, FND_MSG_PUB.Initialize, or request that the API do the initialization by setting the p_init_msg_list parameter to T (TRUE). The program calling the API can retrieve messages from the message stack using the existing FND API functions FND_MSG_PUB.Count_Msg (or standard output parameter x_msg_count) and FND_MSG_PUB.Get. For examples of these functions, see Sample Code.

Robust Validation The TCA APIs perform robust validations. The APIs collect all the validation errors encountered and put them on the message stack. The relevant entity handler is called only if no errors are reported during the validation phases.

Locking Mechanism The TCA public APIs provide a new locking mechanism for update procedures, based on the new OBJECT_VERSION_NUMBER column, which has been included in all HZ tables. For this reason, OBJECT_VERSION_NUMBER is a mandatory attribute for all update APIs. The locking mechanism works as follows:

�� Whenever a new record is created, the value in the OBJECT_VERSION_NUMBER column is set to 1.

�� Whenever a record is updated, the value in the OBJECT_VERSION_NUMBER column is reset to OBJECT_VERSION_NUMBER plus 1.

�� For records that existed in the HZ tables prior to introduction of this locking mechanism, the API sets the value in the OBJECT_VERSION_NUMBER column to null.

Standard Parameters and Missing Attributes (PL/SQL API) The TCA APIs have been developed to conform to the Oracle Applications API standards. The parameters below are common to all of the APIs. Brief descriptions are provided for some of the important features of the API. Standard Parameters IN or IN/OUT Parameters p_<entity>_object_version_number IN/OUT NUMBER Required This parameter is either called p_object_version_number or p_<entity>_object_version_number. For example, for the hz_party_v2pub.update_organization API, this parameter is called p_party_object_version_number because organization is a type of party. The parameter value must match the version number in the database of the record being updated. An error will be returned if the calling program passes an object version number that is not identical to the one in the database for the existing record. p_init_msg_list IN VARCHAR2 Optional The default is FND_API.G_FALSE. If set to true, the API calls fnd_msg_pub.initialize to initialize the message stack. If it set to false, then the calling program must initialize the message stack. The initialization must only be done once in the case where more than one API is being called. OUT Parameters The names of all output parameters begin with x_.

Documentation on using TCA APIs - V2 Page 6

Page 8: TCAAPIEX

x_return_status OUT VARCHAR2(1) The Out parameter returns the status of the API. The returned value is one of the following : x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 FND_API.G_RET_STS_SUCCESS - Success FND_API.G_RET_STS_ERROR - Expected error, validation or missing data FND_API.G_RET_STS_UNEXP_ERROR - Unexpected error, cannot be corrected by the calling program The x_msg_count column contains the number of messages in the message list. If the count is one, then the x_msg_data column holds the encoded message. Nested Record Types PL/SQL record types have been used in all of the create and update APIs. In some cases, nested record types have been used as well. For example, in the Create_Person API, the p_person_rec input parameter is of the person_rec_type record type. The person_rec_type has party_rec as one of its elements, which itself is of party_rec_type record type. The reason for doing this is that the attributes of the Person party type include attributes of a party, because Person is a subtype of Party. Primary Key Generation The Create APIs handle both sequence-generated and manually-passed primary keys, which can be generated on a device from an Oracle Mobile application. In order to prevent duplicate primary keys, the Create APIs handle exceptions to the unique key violation. Missing Attributes Optional IN parameters do not have default values. An attribute value that is not passed in is assumed to have a default of null for a Create API. For an Update API, if a particular attribute value is not passed into the API, then the database retains the existing value. In order to set a database value to null, the calling program must explicitly set the attribute value to one of the following constants, based on the data type of the attribute.

�� FND_API.G_MISS_NUM for NUMBER type. �� FND_API.G_MISS_CHAR for VARCHAR2 type. �� FND_API.G_MISS_DATE for DATE type.

These are pre-defined values in the FND_API Package (fndapis.pls) �� G_MISS_NUM CONSTANT NUMBER:= 9.99E125 �� G_MISS_CHAR CONSTANT VARCHAR2(1):= chr(0) �� G_MISS_DATE CONSTANT DATE:= TO_DATE('1','j') ;

Debug Messages (PL/SQL API) Use the extensive debug messages to troubleshoot in case of unexpected problems. These debugging messages are useful because an API would be difficult to debug otherwise. User can turn on debug messages with a certain profile option. These messages can be written to a log file as well. The profiles for controlling the debug mechanism are:

�� Name - HZ_API_FILE_DEBUG_ON �� User Profile Name - HZ: Turn On File Debug

Documentation on using TCA APIs - V2 Page 7

Page 9: TCAAPIEX

�� Name - HZ_API_DEBUG_FILE_NAME �� User Profile Name - HZ: API Debug File Name �� Name - HZ_API_DEBUG_FILE_PATH �� User Profile Name - HZ: API Debug File Directory �� Name - HZ_API_DBMS_DEBUG_ON �� User Profile Name - HZ: Turn On Development Debug.

If the HZ_API_FILE_DEBUG_ON profile is set to Y when any APIs are called, then debug messages are written to the file specified in HZ_API_DEBUG_FILE_PATH and HZ_API_DEBUG_FILE_NAME. If the HZ_API_FILE_DEBUG_ON profile is set to N, no debug messages are generated. The value of the HZ_API_DEBUG_FILE_PATH profile specifies a directory file path that the database has write access to, as provided in init.ora. User can find path information by querying: select value from v$parameter where name equals utl_file_dir. If user turn the file debug mode on, but did not set a proper value for the HZ_API_DEBUG_FILE_PATH profile or the HZ_API_DEBUG_FILE_NAME profile is null, the API errors out. Debug messages accumulate in the debug file. After collecting any debug messages, user must reset the HZ_API_FILE_DEBUG_ON profile back to N. If user do not, system might cause an exceeded file size error. User should only use the HZ_API_DBMS_DEBUG_ON profile during the development phase or in SQLPLUS because of limitation of dbms_output. There are two ways to run APIs in the debug mode: From Oracle Applications the debug mode can be enabled or disabled by setting HZ_API_FILE_DEBUG_ON to Y or N, respectively. The default value is N. When the profile is set Y, user must set the proper values for the HZ_API_DEBUG_FILE_NAME and HZ_API_DEBUG_FILE_PATH profiles. With SQLPLUS or server side PL/SQL custom code - user can enable or disable the debug mode by calling FND_PROFILE API. This example assumes that the directory, /sqlcom/out/tca115, has write access that is specified by the utl_file_dir parameter in the init.ora for the relevant database. From SQLPLUS exec fnd_profile.put('HZ_API_DEBUG_FILE_PATH', '/sqlcom/out/tca115/'); exec fnd_profile.put('HZ_API_DEBUG_FILE_NAME', 'api_debug'); exec fnd_profile.put('HZ_API_FILE_DEBUG_ON', 'Y'); From PL/SQL code fnd_profile.put('HZ_API_DEBUG_FILE_PATH', '/sqlcom/out/tca115/'); fnd_profile.put('HZ_API_DEBUG_FILE_NAME', 'api_debug'); fnd_profile.put('HZ_API_FILE_DEBUG_ON', 'Y'); Follow the same strategy for dbms debug mode, but be sure to use the set serveroutput on option. From SQLPLUS set serveroutput on exec fnd_profile.put('HZ_API_DBMS_DEBUG_ON', 'Y'); From PL/SQL set serveroutput on fnd_profile.put('HZ_API_DBMS_DEBUG_ON', 'Y');

Documentation on using TCA APIs - V2 Page 8

Page 10: TCAAPIEX

This debug strategy is provided as a public utility procedure that can include in custom code. Refer to the HZ_UTILITY_PUB package for further details. The following portion of the document will discuss about using V2 Public TCA APIs which are available both to the users and the internal development team. Some Salient Features of the V2 Public APIs Flexible, easy to understand, modular with new API signatures as compared to V1 version of the APIs, that is after a major data model cleanup project several attributes from the API signatures that are obsolete and have not been used in a consistent manner were eliminated. Appropriate data migration has also been provided.

�� Major Performance Improvements over the previous version of the APIs �� API Hooks using the new Business Event System (BES) provided by Application

Technology Group �� New Locking Mechanism based in an OBJECT_VERSION_NUMBER field that has been

included in all the HZ entities for which the V2 APIs are provided �� An extensive error handling and reporting capability �� An extensive debugging capability that was not available in the V1 version of the APIs �� V2 APIs are now PUBLIC, that is, Will be supported by World Wide Support. Customers

and consultants can now use these APIs and log tars/bugs to get support on these which was not possible with the V1 version of the APIs

The following are main categories of entities that are covered in TCA APIs :

�� Parties - Person, Organization, Relationship, Group. �� Locations, Party Sites, Party Site Uses �� Contact Points, Contact Preferences �� Customer Accounts, Account Sites and Site Uses �� Classification �� Relationships �� Relationship, Relationship types and Groups

Documentation on using TCA APIs - V2 Page 9

Page 11: TCAAPIEX

IDENTIFICATION OF THE PACKAGE NAME AND VERSION OF AN API To identify the package name of an API as compiled into the Oracle database, in SQL*Plus enter the following select statement (logged in as APPS)

sql>SELECT text FROM all_source WHERE name like '%user_api_name%' (example: HZ_CUSTOMER_ACCOUNT_PUB API) AND text like '%Header%'; A header line of the package and package body showing the package name and version number is returned.

To compare the version of the API package in user’s operating system directory to the one compiled in user’s database, execute the following from the command line from the API directory:

prompt>strings -a packagename | grep Header

All occurrences of the package, package body, and the version number of the file. Version numbers should match what is compiled in the database.

UPLOADING DATA USING API While the API package contains many procedures to insert, modify, or delete application data, the API is not executed on its own. The API must be called, or executed, by other PL/SQL modules, by a direct SQL*Plus call, or through a front end such as the Data Pump.

The API package should never be modified for specific custom use. If modified, Oracle will not be able to support them. If user need additional functionality, APIs can be used as building blocks, to be called within a more extensive package that user may build to address the unique functionality desired.

Documentation on using TCA APIs - V2 Page 10

Page 12: TCAAPIEX

APIS AVAILABLE FOR TRADING COMMUNITY ARCHITECTURE Party APIs

�� Create Organization API �� Update Organization API �� Create Person API �� Update Person API �� Create Group API �� Update Group API

Party Contact APIs

�� Create Org Contact API �� Update Org Contact API �� Create Org Contact Role API �� Update Org Contact Role API

Person Info API

�� Create Person Language API �� Update Person Language API

Location API

�� Create Location API �� Update Location API

Party Site API

�� Create Party Site API �� Update Party Site API �� Create Party Site Use API �� Update Party Site Use API

Contact Point API

�� Create Contact Point API �� Update Contact Point API

Relationship Type API

�� Create Relationship Type API �� Update Relationship Type API

Relationship API

�� Create Relationship API �� Update Relationship API

Classification APIs

�� Create Class Category API �� Update Class Category API �� Create Class Code Relation API �� Update Class Code Relation API �� Create Code Assignment API �� Update Code Assignment API

Documentation on using TCA APIs - V2 Page 11

Page 13: TCAAPIEX

�� Create Class Category Use API �� Update Class Category Use API

Contact Preference API

�� Create Contact Preference API �� Update Contact Preference API

Customer Account APIs

�� Create Customer Account API (Person or Organization) �� Update Customer Account API �� Create Customer Account Relationship API �� Update Customer Account Relationship API

Customer Account Site APIs

�� Create Customer Account Site API �� Update Customer Account Site API �� Create Customer Account Site Use API �� Update Customer Account Site Use API

Customer Profile APIs

�� Create Customer Profile API �� Update Customer Profile API �� Create Customer Profile Amount API �� Update Customer Profile Amount API

Customer Account Role API

�� Create Customer Account Role API �� Update Customer Account Role API �� Create Role Responsibility API �� Update Role Responsibility API

Tax Assignment API

�� Create Location Assignment API �� Update Location Assignment API

Documentation on using TCA APIs - V2 Page 12

Page 14: TCAAPIEX

EXAMPLE ON RUNNING TCA API

Example 1 : Running The Create Organization API Name of the API : CREATE ORGANIZATION API

Base Tables Affected : HZ_PARTIES HZ_ORGANIZATION_PROFILES

PL/SQL Procedure used : CREATE_ORGANIZATION

Package Used : HZ_PARTY_V2PUB

Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_organization_rec IN ORGANIZATION_REC_TYPE x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 x_party_id OUT NUMBER x_party_number OUT VARCHAR2 x_profile_id OUT NUMBER Procedure

PROCEDURE create_organization ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_organization_rec IN ORGANIZATION_REC_TYPE, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2, x_party_id OUT NUMBER, x_party_number OUT VARCHAR2, x_profile_id OUT NUMBER )

General Tips for Running the Create Organization API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN createorg.txt) b) Enter the values for the Parameters from inside the script file itself unless it is

required to Enter some value from the SQL Prompt. c) Set the organization id before running the script as : d) EXEC fnd_client_info.set_org_context('<orgid>');

Ensure that the Profile Option HZ : Generate Party Number is Set to ‘Yes’ at Site Level.

Code for Create Organization API

Documentation on using TCA APIs - V2 Page 13

Page 15: TCAAPIEX

DECLARE p_organization_rec HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE; x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000); x_party_id NUMBER; x_party_number VARCHAR2(2000); x_profile_id NUMBER;

BEGIN p_organization_rec.organization_name := ’New TCA Corporation’; p_organization_rec.created_by_module := ’INDIA_ISC_ORGANIZATION’; hz_party_v2pub.create_organization ( ’T’, p_organization_rec, x_return_status, x_msg_count, x_msg_data, x_party_id, x_party_number, x_profile_id); dbms_output.put_line('return_status='|| SUBSTR (x_return_status,1,255)); dbms_output.put_line('count='||TO_CHAR(x_msg_count)); dbms_output.put_line('Msg_data = '|| SUBSTR (x_msg_data,1,255)); dbms_output.put_line('Party Id='|| SUBSTR (x_party_id,1,255)); dbms_output.put_line('Party_Number='|| SUBSTR (x_party_number,1,255)); dbms_output.put_line('Organization_Name='||SUBSTR(p_organization_rec.organization_name,1,255)); dbms_output.put_line('CreatedBy='||SUBSTR (p_organization_rec.created_by_module,1,255)); dbms_output.put_line('Profile Id='|| SUBSTR (x_profile_id,1,255));

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; END; Sample Output of the Create Organization Script return_status=S count=0 Msg_data = Party Id=4104 Party_Number=2448 Organization_Name=New TCA Corporation Created By=INDIA_ISC_ORGANIZATION Profile Id=2021

Documentation on using TCA APIs - V2 Page 14

Page 16: TCAAPIEX

Script To Verify whether the Create Organization API is successful SELECT party_id, SUBSTR(party_number,1,5), SUBSTR(party_name,1,20), SUBSTR (object_version_number,1,1), SUBSTR (created_by_module,1,25) FROM hz_parties WHERE party_id = 4104; party_id = 4104

party_number = 2448 party_name = New TCA Corpporation obj_ver = 1 created_by_mod = INDIA_ISC_ORGANIZATION

SELECT organization_profile_id, party_id, organization_name, object_version_number, created_by_module FROM hz_organization_profiles WHERE party_id = 4104;

org_profile_id = 2021 party_id = 4104 organization_name = New TCA Corporation obj_ver_num = 1 created_by_mod = INDIA_ISC_ORGANIZATION

Documentation on using TCA APIs - V2 Page 15

Page 17: TCAAPIEX

Example 2 : Running The Create Person API Name of the API : CREATE PERSON API Base Tables Affected : HZ_PARTIES HZ_PERSON_PROFILES PL/SQL Procedure used : CREATE_PERSON Package Used : HZ_PARTY_V2PUB HZ_CUST_ACCOUNT_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_person_rec IN PERSON_REC_TYPE x_party_id OUT NUMBER, x_party_number OUT VARCHAR2 x_prof i l e_i d OUT NUMBER x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_person ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_person_rec IN PERSON_REC_TYPE, x_party_id OUT NUMBER, x_party_number OUT VARCHAR2, x_prof i l e_i d OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Person API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN createperson.txt) b) Enter the values for the Parameters from inside the script file itself unless it is

required to Enter some value from the SQL Prompt. c) Set the organization id before running the script as :

EXEC fnd_client_info.set_org_context('<orgid>'); d) Ensure that the Profile Option HZ : Generate Party Number is Set to ‘Yes’

at Site Level. Code for Create Person API DECLARE

Documentation on using TCA APIs - V2 Page 16

Page 18: TCAAPIEX

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 Fnd_client_info.set_org_context('&Org_Id'); p_cust_account_rec.account_name := '&Customer_Name'; p_cust_account_rec.created_by_module := 'TCA_EXAMPLE'; p_person_rec.person_first_name := '&First_Name'; p_person_rec.person_last_name := '&Last_Name'; 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('x_return_status = '|| SUBSTR (x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Party Id = '||TO_CHAR(x_party_id)); dbms_output.put_line('Party Number = '||x_party_number); dbms_output.put_line('Profile Id = '||TO_CHAR(x_profile_id)); dbms_output.put_line('x_msg_data = '|| SUBSTR (x_msg_data,1,255)); 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; END;

Documentation on using TCA APIs - V2 Page 17

Page 19: TCAAPIEX

Sample Output of the Create Person Script x_return_status = S x_msg_count = 0 Party Id = 7860 Party Number = 6245 Profile Id = 4955 x_msg_data = Script To Verify whether the Create Person API is successful SELECT party_id, SUBSTR (party_number,1,5), SUBSTR (party_name,1,20), SUBSTR (person_last_name,1,20), SUBSTR(person_first_name,1,20), SUBSTR (object_version_number,1,1), SUBSTR (created_by_module,1,25) FROM hz_parties WHERE party_id = '7860';

Party_id = 7860 Party_number = 6245 Party_name = Oracle India Person_last_name = India Person_first_name = Oracle Object_version_number = 1 Created_by_module = TCA_EXAMPLE

SELECT person_profile_id, party_id, effective_start_date, object_version_number, SUBSTR (created_by_module,1,20) FROM hz_person_profiles WHERE person_profile_id = ‘4955’;

person_profile_id = 4955 party_id = 7860 effective_start_date = 12-MAY-02 object_version_number = 1 created_by_module = TCA_EXAMPLE

Documentation on using TCA APIs - V2 Page 18

Page 20: TCAAPIEX

Example 3 : Running The Create Group API Name of the API : CREATE GROUP API Base Tables Affected : HZ_PARTIES PL/SQL Procedure used : CREATE_GROUP Package Used : HZ_PARTY_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_group_rec IN GROUP_REC_TYPE x_party_id OUT NUMBER x_party_number OUT VARCHAR2 x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_group ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_group_rec IN GROUP_REC_TYPE, x_party_id OUT NUMBER, x_party_number OUT VARCHAR2, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Group API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN create_party_group.txt) b) Enter the values for the Parameters from inside the script file itself unless it is

required to Enter some value from the SQL Prompt. c) Set the organization id before running the script as :

EXEC fnd_client_info.set_org_context('<orgid>'); d) Ensure that the Profile Option HZ : Generate Party Number is Set to ‘Yes’

at Site Level. Code for Create Group API DECLARE

p_group_rec HZ_PARTY_V2PUB.GROUP_REC_TYPE; x_party_id NUMBER; x_party_number VARCHAR2(2000); x_return_status VARCHAR2(2000);

Documentation on using TCA APIs - V2 Page 19

Page 21: TCAAPIEX

x_msg_count NUMBER; x_msg_data VARCHAR2(2000);

BEGIN Fnd_client_info.set_org_context(‘&Org_Id’); P_group_rec.group_name := ‘&Group_Name’; P_group_rec.group_type := ‘&Group_Type’; p_group_rec.created_by_module := 'TCA_EXAMPLE'; hz_party_v2pub.create_group( ‘T’, p_group_rec, x_party_id, x_party_number, x_return_status, x_msg_count, x_msg_data); dbms_output.put_line(‘x_return_status = ‘||SUBSTR(x_return_status,1,255)); dbms_output.put_line(‘x_msg_count = ‘||TO_CHAR(x_msg_count)); dbms_output.put_line(‘Party Id = ‘||TO_CHAR(x_party_id)); dbms_output.put_line(‘Party Number = ‘||x_party_number); dbms_output.put_line(‘Group Name = ‘||SUBSTR (p_group_rec.group_name,1,50)); dbms_output.put_line(‘x_msg_data = ‘||SUBSTR (x_msg_data,1,255)); 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;

END; Sample Output of the Create Group Script x_return_status = S x_msg_count = 0 Party Id = 7861 Party Number = 6246 Group Name = ISC Group x_msg_data =

Script To Verify whether the Create Group API is successful SELECT party_id, SUBSTR (party_number,1,5), SUBSTR(party_name,1,20), SUBSTR (object_version_number,1,1), SUBSTR (created_by_module,1,25) FROM hz_parties WHERE party_id = 7861; Party_id = 7861

Party_number = 6246 Party_name = ISC Group Obj_ver = 1

Documentation on using TCA APIs - V2 Page 20

Page 22: TCAAPIEX

Created_by_module = TCA_EXAMPLE

Documentation on using TCA APIs - V2 Page 21

Page 23: TCAAPIEX

Example 4 : Create Org Contact API Name of the API : CREATE ORG CONTACT Base Tables Affected : HZ_ORG_CONTACTS HZ_RELATIONSHIPS PL/SQL Procedure used : CREATE_ORG_CONTACT Package Used : HZ_PARTY_CONTACT_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_org_contact_rec IN ORG_CONTACT_REC_TYPE x_org_contact_id OUT NUMBER x_party_rel_id OUT NUMBER x_party_id OUT NUMBER x_party_number OUT VARCHAR2 x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_org_contact ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_org_contact_rec IN ORG_CONTACT_REC_TYPE, x_org_contact_id OUT NUMBER, x_party_rel_id OUT NUMBER, x_party_id OUT NUMBER, x_party_number OUT VARCHAR2, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Organization Contact API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN contactphone.txt) b) To get the value for Department Parameter run the query:

SELECT DISTINCT department FROM hz_org_contacts; To get the value for Job Title Parameter run the query : SELECT DISTINCT job_title FROM hz_org_contacts; To get the Decision Make Flag Parameter run the query : SELECT DISTINCT decision_maker_flag FROM hz_org_contacts; To get the Job Title Code Parameter run the query:

Documentation on using TCA APIs - V2 Page 22

Page 24: TCAAPIEX

SELECT DISTINCT job_title_code FROM hz_org_contacts; To get the Subject Id Parameter run the query: SELECT subject_id FROM hz_relationships; To get the Subject Type Parameter run the query: SELECT DISTINCT subject_type FROM hz_relationships; To get the Object Id Parameter run the query: SELECT DISTINCT object_id FROM hz_relationships; To get the Object Type Parameter run the query: SELECT DISTINCT object_type FROM hz_relationships; To get the Relationship Code Parameter run the query: SELECT DISTINCT relationship_code FROM hz_relationships; To get the Relationship Type Parameter run the query : SELECT DISTINCT relationship_type FROM hz_relationships;

c) Set the organization id before running the script as : EXEC fnd_client_info.set_org_context('<orgid>');

Example For Running a Create Org Contact API 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 := INITCAP(‘&Department_Code’); p_org_contact_rec.job_title := INITCAP(‘&Job_Title’); p_org_contact_rec.decision_maker_flag := UPPER(‘&Decision_Maker_Flag’); p_org_contact_rec.job_title_code := UPPER(‘&Job_Title_Code’); p_org_contact_rec.created_by_module := 'TCA_EXAMPLE'; p_org_contact_rec.party_rel_rec.subject_id := &Subject_Id; p_org_contact_rec.party_rel_rec.subject_type := UPPER(‘&Subject_Type’); p_org_contact_rec.party_rel_rec.subject_table_name := 'HZ_PARTIES'; p_org_contact_rec.party_rel_rec.object_id := &Object_Id; p_org_contact_rec.party_rel_rec.object_type := UPPER(‘&Object_Type’); p_org_contact_rec.party_rel_rec.object_table_name := 'HZ_PARTIES'; p_org_contact_rec.party_rel_rec.relationship_code := UPPER(‘&Relation_Code’); p_org_contact_rec.party_rel_rec.relationship_type := UPPER(‘&Relation Type’); 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,

Documentation on using TCA APIs - V2 Page 23

Page 25: TCAAPIEX

x_party_id, x_party_number, x_return_status, x_msg_count, x_msg_data); dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line(‘Subject Id=’||p_org_contact_rec.party_rel_rec.subject_id); dbms_output.put_line(‘Subject Type=’||UPPER(p_org_contact_rec.party_rel_rec.subject_Type)); dbms_output.put_line(‘Object Id=’||p_org_contact_rec.party_rel_rec.object_id); dbms_output.put_line(‘Object Type=’||UPPER(p_org_contact_rec.party_rel_rec.object_type)); dbms_output.put_line('x_msg_data = '||SUBSTR(x_msg_data,1,255)); 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; END; Sample Output of the Create Org Contact Script old 11: p_org_contact_rec.department_code := INITCAP('&Department_Code'); new 11: p_org_contact_rec.department_code := INITCAP ('Finance'); old 12: p_org_contact_rec.job_title := INITCAP ('&Job_Title'); new 12: p_org_contact_rec.job_title := INITCAP ('Accounting Manager'); old 13: p_org_contact_rec.decision_maker_flag := UPPER('&Decision_Maker_Flag'); new 13: p_org_contact_rec.decision_maker_flag := UPPER('n'); old 14: p_org_contact_rec.job_title_code := UPPER('&Job_Title_Code'); new 14: p_org_contact_rec.job_title_code := UPPER('aps'); old 16: p_org_contact_rec.party_rel_rec.subject_id := &Subject_Id; new 16: p_org_contact_rec.party_rel_rec.subject_id := 1006; old 17: p_org_contact_rec.party_rel_rec.subject_type := UPPER('&Subject_Type'); new 17: p_org_contact_rec.party_rel_rec.subject_type := UPPER('organization'); old 19: p_org_contact_rec.party_rel_rec.object_id := &Object_Id; new 19: p_org_contact_rec.party_rel_rec.object_id := 3610; old 20: p_org_contact_rec.party_rel_rec.object_type := UPPER('&Object_Type'); new 20: p_org_contact_rec.party_rel_rec.object_type := UPPER('person');

Documentation on using TCA APIs - V2 Page 24

Page 26: TCAAPIEX

old 22: p_org_contact_rec.party_rel_rec.relationship_code := UPPER('&Relation_Code’); new 22: p_org_contact_rec.party_rel_rec.relationship_code := UPPER('contact'); x_return_status = S x_msg_count = 0 Subject Id=1006 Subject Type=ORGANIZATION Object Id=3610 Object Type=PERSON x_msg_data = Script To Verify whether the Org Contact Point API is successful SELECT org_contact_id, party_relationship_id, department_code FROM hz_org_contacts WHERE party_relationship_id = 3284 ;

org_contact_id = 3248 party_relationship_id = 3284 department_code = FINANCE

SELECT relationship_id, subject_id, subject_type, subject_table_name, object_id, object_type, directional_flag , relationship_type, relationship_code, party_id FROM hz_relationships WHERE relationship_id = 3284 ;

relationship_id = 3284 subject_id = 3610 subject_type = person subject_table_name = HZ_PARTIES object_id = 1006 object_type = ORGANIZATION directional_flag = F relationship_type = EMPLOYMENT relationship_code = EMPLOYEE_OF party_id = 3611

SELECT party_id, party_number, party_name, party_type FROM hz_parties WHERE Party_id = 3611;

Party_id = 3611 Party_number = 3611 Party_name = Paul Cheng-Computer Service Party_type = PARTY_RELATIONSHIP

Documentation on using TCA APIs - V2 Page 25

Page 27: TCAAPIEX

Example 5 : Create Location API Name of the API : CREATE LOCATION API Base Tables Affected : HZ_LOCATIONS PL/SQL Procedure used : CREATE_LOCATION Package Used : HZ_LOCATION_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_location_rec IN LOCATION_REC_TYPE x_location_id OUT NUMBER x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_location ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_location_rec IN LOCATION_REC_TYPE, x_location_id OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Location API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN createloc.txt) b) Enter the values for the Parameters from inside the script file itself unless it is

required to Enter some value from the SQL Prompt c) Set the organization id before running the script as :

EXEC fnd_client_info.set_org_context('<orgid>'); d) Ensure that the Profile Option Default Country is Set to ‘<Country Name>’

at Site Level.

Documentation on using TCA APIs - V2 Page 26

Page 28: TCAAPIEX

Example For Running a Create Location API 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 := '4th Floor Cyber Towers'; p_location_rec.address2 := 'Hitec City'; p_location_rec.city := 'Madhapur'; p_location_rec.postal_code := '500083'; p_location_rec.state := 'Andhra Pradesh'; p_location_rec.created_by_module := 'TCA_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('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Location Id = '||TO_CHAR(x_location_id)); dbms_output.put_line('Country = '|| SUBSTR(p_location_rec.country,1,255)); dbms_output.put_line('Address1 = '|| SUBSTR(p_location_rec.Address1,1,255)); dbms_output.put_line('State = '|| SUBSTR(p_location_rec.state,1,255)); dbms_output.put_line('Created By = '|| SUBSTR(p_location_rec.created_by_module,1,255)); dbms_output.put_line('x_msg_data = '|| SUBSTR(x_msg_data,1,255)); 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; END; Sample Output of the Create Location Script x_return_status = S x_msg_count = 0 Location Id = 3220 Country = US Address1 = 4th Floor Cyber Towers State = Andhra Pradesh Created By = TCA_EXAMPLE

Documentation on using TCA APIs - V2 Page 27

Page 29: TCAAPIEX

x_msg_data = Script To Verify whether the Create Location API is successful SELECT SUBSTR(location_id,1,5), SUBSTR(address1,1,25), SUBSTR(address2,1,10), SUBSTR(city,1,10), SUBSTR(state,1,10), SUBSTR(Postal_code,1,7), SUBSTR(country,1,10), SUBSTR(object_version_number,1,1), SUBSTR(created_by_module,1,10) FROM hz_locations WHERE location_id = 3220;

Location_id = 3220 Address1 = 4th Floor Cyber Towers Address2 = Hitec City City = Madhapur State = Andhara Pra Postal_code = 500083 Country = US Object_version_number = 1 Created_by_module = TCA_EXAMPLE

Documentation on using TCA APIs - V2 Page 28

Page 30: TCAAPIEX

Example 6 : Update Location API Name of the API : UPDATE LOCATION API Base Tables Affected : HZ_LOCATIONS PL/SQL Procedure used : UPDATE_LOCATION Package Used : HZ_LOCATION_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_location_rec IN LOCATION_REC_TYPE p_object_version_number IN OUT NUMBER x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE update_location ( p_init_msg_list IN VARCHAR2:=FND_API.G_FALSE, p_location_rec IN LOCATION_REC_TYPE, p _ object_version_number IN OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Update Location API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN updateloc.txt) b) Enter the new value for the Parameters Address1 which has to be changed, from

the SQL Prompt. c) Set the organization id before running the script as :

EXEC fnd_client_info.set_org_context('<orgid>');

Documentation on using TCA APIs - V2 Page 29

Page 31: TCAAPIEX

Example For Running a Update Location API DECLARE

p_location_rec HZ_LOCATION_V2PUB.LOCATION_REC_TYPE; p_object_version_number NUMBER; x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000);

BEGIN p_location_rec.location_id := &Location_Id; p_location_rec.address2 := FND_API.G_MISS_CHAR; p_location_rec.address1 := '&New_Address1'; p_object_version_number := 1; hz_location_v2pub.update_location( 'T', p_location_rec, p_object_version_number, x_return_status, x_msg_count, x_msg_data); dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Changed Address1 = '||SUBSTR(p_location_rec.address1,1,255)); dbms_output.put_line('x_msg_data = '||SUBSTR(x_msg_data,1,255)); 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; END; Sample Output of the Update Location Script old 8: p_location_rec.location_id := &Location_Id; new 8: p_location_rec.location_id := 3211; Enter value for new_address1: 4th Floor Cyber Gateway old 10: p_location_rec.address1 := '&New_Address1'; new 10: p_location_rec.address1 := '4th Floor Cyber Gateway'; x_return_status = S x_msg_count = 0 Changed Address1 = 4th Floor Cyber Gateway x_msg_data = Script To Verify whether Update Location API is successful SELECT address1, address2, county, object_version_number

Documentation on using TCA APIs - V2 Page 30

Page 32: TCAAPIEX

FROM hz_locations WHERE location_id = 3211; address1 = 4TH FLOOR CYBER GATEWAY address2 = ‘ ‘ county = TEST object_version_number = 2

Documentation on using TCA APIs - V2 Page 31

Page 33: TCAAPIEX

Example 7 : Create Party Site API Name of the API : CREATE PARTY SITE Base Tables Affected : HZ_PARTY_SITES PL/SQL Procedure used : CREATE_PARTY_SITE Package Used : HZ_PARTY_SITE_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_party_site_rec IN PARTY_SITE_REC_TYPE x_party_site_id OUT NUMBER x_party_site_number OUT VARCHAR2 x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_party_site ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_party_site_rec IN PARTY_SITE_REC_TYPE, x_party_site_id OUT NUMBER, x_party_site_number OUT VARCHAR2, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Party Site API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN createpsite.txt) b) Enter the values for the Parameters Party Id and Location Id from the SQL

prompt itself as hard coding these two parameters means the script has to be changed for the value of these two parameters each time a new Party Site is created.

c) Enter the values for Party Id and Location Id as valid values from HZ_PARTIES and HZ_LOCATIONS respectively. SELECT party_id FROM hz_parties; SELECT location_id FROM hz_locations;

d) Set the organization id inside the script as : EXEC fnd_client_info.set_org_context('<orgid>');

Documentation on using TCA APIs - V2 Page 32

Page 34: TCAAPIEX

Example For Running a Create Party Site API 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 := &Party_Id; p_party_site_rec.location_id := &Location_Id; p_party_site_rec.identifying_address_flag := 'Y'; p_party_site_rec.created_by_module := 'TCA_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('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Party Site Id = '||TO_CHAR(x_party_site_id)); dbms_output.put_line('Party Site Number = '||SUBSTR(x_party_site_number,1,255)); dbms_output.put_line('x_msg_data = '||SUBSTR(x_msg_data,1,255)); 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;

END;

Sample Output of the Create Party Site Script old 9: p_party_site_rec.party_id := &Party_Id; new 9: p_party_site_rec.party_id := 4102; old 10: p_party_site_rec.location_id := &Location_Id; new 10: p_party_site_rec.location_id := 3220; x_return_status = S x_msg_count = 0 Party Site Id = 3615 Party Site Number = 2248

Documentation on using TCA APIs - V2 Page 33

Page 35: TCAAPIEX

x_msg_data = Script To Verify whether the Create Party Site API is successful SELECT SUBSTR(party_site_id,1,6), SUBSTR (party_id,1,5), SUBSTR (location_id,1,6), SUBSTR (party_site_number,1,7) FROM hz_party_sites WHERE party_site_id = 3615;

party_site_id = 3615 party_id = 4102 location_id = 3220 party_site_number = 2248

SELECT SUBSTR(ADDRESS1,1,20), SUBSTR(ADDRESS2,1,15), SUBSTR(CITY,1,10), SUBSTR(STATE,1,10), SUBSTR(POSTAL_CODE,1,6), SUBSTR(COUNTRY,1,10) FROM HZ_PARTIES WHERE PARTY_ID = 4102;

address1 = 4th Floor Cyber Towe address2 = Hitec City city = Madhapur state = Andhra Pra postal_code = 500083 country = US

Documentation on using TCA APIs - V2 Page 34

Page 36: TCAAPIEX

Example 8 : Create Party Site Use API Name of the API : CREATE PARTY SITE USE Base Tables Affected : HZ_PARTY_SITE_USES PL/SQL Procedure used : CREATE_PARTY_SITE_USE Package Used : HZ_PARTY_SITE_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_party_site_use_rec IN PARTY_SITE_USE_REC_TYPE x_party_site_use_id OUT NUMBER x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER Procedure

PROCEDURE create_party_site_use ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_party_site_use_rec IN PARTY_SITE_USE_REC_TYPE, x_party_site_use_id OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Party Site Use API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN createpsiteuse.txt) b) Enter the values for the Parameters Party Site Use and Party Site Id from SQL

Prompt itself as hard coding these two parameters means the script has to be changed for the value of these two parameters each time a new Party Site Use is created.

c) The Parameter Party Site Use can be entered in either lower case or upper case as the system will take care of changing the case to upper. That is The Site use can be entered as bill_to or BILL_TO or Bill_To.

d) Enter the value for Party Site Id as a valid value from HZ_PARTY_SITES table. SELECT party_site_id FROM hz_party_sites;

e) Set the organization id before running the script as : EXEC fnd_client_info.set_org_context('<orgid>');

Example For Running a Create Party Site Use API DECLARE

p_party_site_use_rec HZ_PARTY_SITE_V2PUB.PARTY_SITE_USE_REC_TYPE;

Documentation on using TCA APIs - V2 Page 35

Page 37: TCAAPIEX

x_party_site_use_id NUMBER; x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000);

BEGIN p_party_site_use_rec.site_use_type := upper('&Party_Site_Use'); p_party_site_use_rec.party_site_id := &Party_Site_Id; p_party_site_use_rec.created_by_module := 'TCA_EXAMPLE'; hz_party_site_v2pub.create_party_site_use( 'T', p_party_site_use_rec, x_party_site_use_id, x_return_status, x_msg_count, x_msg_data); dbms_output.put_line('x_return_status = '||substr(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Site Use Id = '||TO_CHAR(x_party_site_use_id)); dbms_output.put_line(SubStr('x_msg_data = '||x_msg_data,1,255)); 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; END; Sample Output of the Create Party Site Use Script old 8: p_party_site_use_rec.site_use_type := upper('&Party_Site_Use'); new 8: p_party_site_use_rec.site_use_type := upper('bill_to'); old 9: p_party_site_use_rec.party_site_id := &Party_Site_Id; new 9: p_party_site_use_rec.party_site_id := 3614; x_return_status = S x_msg_count = 0 Site Use Id = 2022 x_msg_data = Script To Verify whether the Create Party Site Use API is successful SELECT party_site_use_id, party_site_id, site_use_type, primary_per_type FROM hz_party_site_uses WHERE party_site_use_id = 2022;

party_site_use_id = 2022 party_site_id = 3614 use_type = BILL_TO primary_per_type = Y

Documentation on using TCA APIs - V2 Page 36

Page 38: TCAAPIEX

Example 9 : Create Party Site API

Name of the API : CREATE CONTACT POINT Base Tables Affected : HZ_CONTACT_POINTS PL/SQL Procedure used : CREATE_CONTACT_POINT Package Used : HZ_CONTACT_POINT_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type

p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_contact_point_rec IN CONTACT_POINT_REC_TYPE p_edi_rec IN EDI_REC_TYPE:= G_MISS_EDI_REC p_email_rec IN EMAIL_REC_TYPE:= G_MISS_EMAIL_REC p_phone_rec IN PHONE_REC_TYPE:= G_MISS_PHONE_REC p_telex_rec IN TELEX_REC_TYPE:= G_MISS_TELEX_REC p_web_rec IN WEB_REC_TYPE:= G_MISS_WEB_REC x_contact_point_id OUT NUMBER x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_contact_point ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_contact_point_rec IN CONTACT_POINT_REC_TYPE, p_edi_rec IN EDI_REC_TYPE:= G_MISS_EDI_REC, p_email_rec IN EMAIL_REC_TYPE:= G_MISS_EMAIL_REC, p_phone_rec IN PHONE_REC_TYPE:= G_MISS_PHONE_REC, p_telex_rec IN TELEX_REC_TYPE:= G_MISS_TELEX_REC, p_web_rec IN WEB_REC_TYPE:= G_MISS_WEB_REC, x_contact_point_id OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Contact Point API (Phone) a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN contactphone.txt) b) Enter the values for the Parameters Primary Flag, Contact Point Purpose, Phone

Area Code, Phone Country Code, Phone Number and Phone Line Type from SQL Prompt itself as hard coding these parameters means the script has to be changed for

Documentation on using TCA APIs - V2 Page 37

Page 39: TCAAPIEX

the value of these parameters each time a new Contact Point ( Phone ) is created. c) The Parameter Primary Flag, Contact Point Purpose and Phone Line Type can be

entered in either lower case or upper case as the system will take care of changing the case to upper.

d) The values for owner_table_id and owner_table_name parameters can be seen from HZ_PARTIES table using the query : SELECT owner_table_id, owner_table_name FROM hz_contact_points WHERE owner_table_name LIKE ‘%HZ_PARTIES%’;

e) Enter the value for phone_country_code as a valid value from from hz_phone_country_codes using the query : SELECT territory_code, phone_country_code FROM hz_phone_country_codes WHERE UPPER(territory_code) LIKE ‘%US%’;

f) Enter the value of area code using the query : SELECT UPPER(area_code) FROM hz_timezone_mapping;

g) Set the organization id before running the script as : EXEC fnd_client_info.set_org_context('<orgid>');

Example For Running a Create Contact Point API (Phone) DECLARE

p_contact_point_rec HZ_CONTACT_POINT_V2PUB.CONTACT_POINT_REC_TYPE; 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_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000); x_contact_point_id NUMBER;

BEGIN p_contact_point_rec.contact_point_type := 'PHONE'; p_contact_point_rec.owner_table_name := 'HZ_PARTIES'; p_contact_point_rec.owner_table_id := '3804'; p_contact_point_rec.primary_flag := UPPER('&Primary_Flag'); p_contact_point_rec.contact_point_purpose := UPPER('&Contact_Purpose'); p_phone_rec.phone_area_code := '&Phone_Area_Code'; p_phone_rec.phone_country_code := UPPER('&Phone_Country_Code'); p_phone_rec.phone_number := '&Phone_Number'; p_phone_rec.phone_line_type := UPPER('&Phone_Line_Type'); p_contact_point_rec.created_by_module := 'TCA_EXAMPLE'; hz_contact_point_v2pub.create_contact_point( 'T', p_contact_point_rec, p_edi_rec, p_email_rec,

Documentation on using TCA APIs - V2 Page 38

Page 40: TCAAPIEX

p_phone_rec, p_telex_rec, p_web_rec, x_contact_point_id, x_return_status, x_msg_count, x_msg_data); dbms_output.put_line(SUBSTR('x_return_status = '||x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line(SUBSTR('x_msg_data = '||x_msg_data,1,255)); 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; END;

Sample Output of the Create Contact Point (Phone) Script old 16: p_contact_point_rec.primary_flag := UPPER('&Primary_Flag'); new 16: p_contact_point_rec.primary_flag := UPPER('y'); old 17: p_contact_point_rec.contact_point_purpose := UPPER('&Contact_Purpose'); new 17: p_contact_point_rec.contact_point_purpose := UPPER('business'); old 18: p_phone_rec.phone_area_code := '&Phone_Area_Code'; new 18: p_phone_rec.phone_area_code := '650';

old 19: p_phone_rec.phone_country_code := UPPER('&Phone_Country_Code');

new 19: p_phone_rec.phone_country_code := UPPER('1'); old 20: p_phone_rec.phone_number := '&Phone_Number'; new 20: p_phone_rec.phone_number := '7000-200'; old 21: p_phone_rec.phone_line_type := UPPER('&Phone_Line_Type'); new 21: p_phone_rec.phone_line_type := UPPER('gen'); x_return_status = S x_msg_count = 0 Contact Point Id = 6330 Phone Number = 7000-200 x_msg_data =

Script To Verify whether the Contact Point API (Phone) is successful SELECT contact_point_id, contact_point_type, owner_table_name, owner_table_id,

Documentation on using TCA APIs - V2 Page 39

Page 41: TCAAPIEX

primary_flag, phone_area_code, phone_country_code, phone_number, phone_line_type, raw_phone_number FROM hz_contact_points WHERE contact_point_id = 6330 ;

contact_point_id = 6330 contact_point_phone = PHONE owner_table_name = HZ_PARTIES owner_table_id = 3804 primary_flag = Y phone_area_code = 650 phone_country_code = 1 phone_number = 7000-200 phone_line_type = GEN raw_phone_num = 650-7000-200

Documentation on using TCA APIs - V2 Page 40

Page 42: TCAAPIEX

Example 10 : Create Relationship Type API Name of the API : CREATE RELATIONSHIP TYPE Base Tables Affected : HZ_RELATIONSHIP_TYPES PL/SQL Procedure used : CREATE_RELATIONSHIP_TYPE Package Used : HZ_RELATIONSHIP_TYPE_V2PUB Mandatory Parameters :

Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_relationship_type_rec IN RELATIONSHIP_TYPE_REC_TYPE x_relationship_type_id OUT NUMBER x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_relationship_type ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_relationship_type_rec IN RELATIONSHIP_TYPE_REC_TYPE, x_relationship_type_id OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Relationship Type API a) Save the API in a script file and then run the script from the SQL Prompt

1. (Example : RUN createrelationtype.txt) b) The Value for Organization Id is accepted as a Parameter. c) Enter the Values of the Parameters :

Relationship_Type, Forward_Relationship_Code, Backward_Relationship_Code, Direction_Code, Subject_Type, Object_Type, Created_By_Moudle either from inside the API or at the SQL Prompt.

i. The value for Parameter Relationship_Type should be one of the Values defined for the Look Up Code PARTY_RELATIONS_TYPE .

ii. The Value for Parameter Forward_Relationship_Code should be one of the Values for the Look Up Code PARTY_RELATIONS_TYPE .

Documentation on using TCA APIs - V2 Page 41

Page 43: TCAAPIEX

iii. The Value for Parameter Backward_Relationship_Code should be one of the Values for the Look Up Code PARTY_RELATIONS_TYPE .

iv. The Value of Direction_Code should be either : P - Parent, C – Child, N – Non-Directional.

v. If the values of the parameters Forward_Relationship_Code and Backward_Relationship_Code are same then the Direction_Code should be ‘N’ only.

vi. The Value for Parameter Subject_Type should be one of the Values from the Column INSTANCE_SET_NAME from the table FND_OBJECT_INSTANCE_SETS .

vii. The Value for Parameter Object_Type should be one of the Values from the Column INSTANCE_SET_NAME from the table FND_OBJECT_INSTANCE_SETS .

viii. The combination of relationship type, forward relationship code, backward relationship code, subject type, and object_type should be unique.

ix. The combination of forward relationship code, subject type, and object type should be able to identify an unique backward relationship code. Thus, a second record with same combination of these three should have same backward relationship code.

x. The direction code will be used to determine if a backward relationship type should be created. If the direction code is ‘P’ or ‘C’, we will create a second relationship type. If the forward relationship code is the same as the backward relationship code, the direction code should be ‘N’ - Non directional.

General Tips for Running the Create Relationship Type API DECLARE

p_relationship_type_rec_type HZ_RELATIONSHIP_TYPE_V2PUB.RELATIONSHIP_TYPE_REC_TYPE; x_relationship_type_id NUMBER; x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000);

BEGIN fnd_client_info.set_org_context('&Org_Id'); p_relationship_type_rec_type.relationship_type := upper('&Relationship_Type'); p_relationship_type_rec_type.forward_rel_code := upper('&Forward_Relationship_Code'); p_relationship_type_rec_type.backward_rel_code := upper('&Backward_Relationship_Code'); p_relationship_type_rec_type.direction_code := upper('&Rel_Direction'); p_relationship_type_rec_type.subject_type := upper('&Subject_Type'); p_relationship_type_rec_type.object_type := upper('&Object_Type'); p_relationship_type_rec_type.created_by_module := 'TCA_Example'; hz_relationship_type_v2pub.create_relationship_type( 'T', p_relationship_type_rec_type, x_relationship_type_id, x_return_status,

Documentation on using TCA APIs - V2 Page 42

Page 44: TCAAPIEX

x_msg_count, x_msg_data); dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Relationship Id ='||TO_CHAR(x_relationship_type_id)); dbms_output.put_line('x_msg_data = '||SUBSTR(x_msg_data,1,255)); 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;

END; Sample Output of the Create Relationship Type Script Enter value for org_id: 204 old 9: fnd_client_info.set_org_context('&Org_Id'); new 9: fnd_client_info.set_org_context('204'); Enter value for relationship_type: contact old 10: p_relationship_type_rec_type.relationship_type := UPPER('&Relationship_Type'); new 10: p_relationship_type_rec_type.relationship_type := UPPER ('contact'); Enter value for forward_relationship_code: contact_of old 11: p_relationship_type_rec_type.forward_rel_code := UPPER ('&Forward_Relationship_Code'); new 11: p_relationship_type_rec_type.forward_rel_code := UPPER ('contact_of'); Enter value for backward_relationship_code: contact_of old 12: p_relationship_type_rec_type.backward_rel_code := UPPER ('&Backward_Relationship_Code'); new 12: p_relationship_type_rec_type.backward_rel_code := UPPER ('contact_of'); Enter value for rel_direction: n old 13: p_relationship_type_rec_type.direction_code := UPPER ('&Rel_Direction'); new 13: p_relationship_type_rec_type.direction_code := UPPER ('n'); Enter value for subject_type: organization old 14: p_relationship_type_rec_type.subject_type := UPPER ('&Subject_Type'); new 14: p_relationship_type_rec_type.subject_type := UPPER ('organization'); Enter value for object_type: organization old 15: p_relationship_type_rec_type.object_type := UPPER ('&Object_Type'); new 15: p_relationship_type_rec_type.object_type := UPPER ('organization'); x_return_status = S x_msg_count = 0 Relationship Id =1024

Documentation on using TCA APIs - V2 Page 43

Page 45: TCAAPIEX

x_msg_data = Script To Verify whether Create Relationship Type API is successful SELECT relationship_type_id, relationship_type, forward_rel_code, backward_rel_code, direction_code, subject_type, object_type, status, created_by_module FROM hz_relationship_types WHERE relationship_type_id = '1024';

relationship_type_id = 1024 relationship_type = CONTACT forward_rel_code = CONTACT_OF backward_rel_code = CONTACT_OF direction_code = N subject_type = ORGANIZATION object_type = ORGANIZATION status = A created_by_module = TCA_EXAMPLE

Documentation on using TCA APIs - V2 Page 44

Page 46: TCAAPIEX

Example 11 : Create Relationship API Name of the API : CREATE RELATIONSHIP Base Tables Affected : HZ_RELATIONSHIPS PL/SQL Procedure used : CREATE_RELATIONSHIP Package Used : HZ_RELATIONSHIP_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_relationship_rec IN RELATIONSHIP_REC_TYPE x_relationship_id OUT NUMBER x_party_id OUT NUMBER x_party_number OUT VARCHAR2 x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_relationship ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_relationship_rec IN RELATIONSHIP_REC_TYPE, x_relationship_id OUT NUMBER, x_party_id OUT NUMBER, x_party_number OUT VARCHAR2, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Relationship API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN createrelation.txt) b) The Value for Organization is accepted as a Parameter. c) Enter the Values of the Parameters :

Relationship_Type, Relationship_Code, Subject_Id, Subject_Table_Name, Subject_Type, Object_Id, Object_Table_Name, Object_Type, Start_Date,

Documentation on using TCA APIs - V2 Page 45

Page 47: TCAAPIEX

Created_By_Moudle either from inside the API or at the SQL Prompt.

i. The value for Parameter Relationship_Type should be one of the Values defined for the Look Up Code PARTY_RELATIONS_TYPE .

ii. The Value for Parameter Relationship_Code should be one of the Values for the Look Up Code PARTY_RELATIONS_TYPE .

iii. The Value for Parameter Subject_Id should be one of the Values from the Column Object_Id in FND_OBJECT_INSTANCE_SETS .

iv. The Value for Parameter Subject_Table_Name should be one of the values from the Column Obj_Name from table FND_OBJECTS.

v. The Value for Parameter Subject_Type should be one of the Values from the Column INSTANCE_SET_NAME from the table FND_OBJECT_INSTANCE_SETS .

vi. The Value for Parameter Object_Id should be one of the Values from the Column Object_Id from table FND_OBJECTS.

vii. The Value for Parameter Object_Table_Name should be one of the Values from the Column Obj_Name from table FND_OBJECTS.

viii. The Value for Parameter Object_Type should be one of the Values from the Column INSTANCE_SET_NAME from the table FND_OBJECT_INSTANCE_SETS .

ix. When user call the create relationship procedure, two new records will be created in HZ_RELATIONSHIPS table.

x. Users are required to specify a subject id, an object id, a subject type, an object type, a subject table name (where the subject belongs to, for example, HZ_PARTIES for subject type of ‘PERSON’, ‘ORGANIZATION’), an object table name, a relationship type, a relationship code, and start date to create a relationship.

xi. The relationship code must be either a forward or backward relationship code defined in active records in the HZ_RELATIONSHIP_TYPES table for the relationship type.

xii. The end date will be default to '31-DEC-4712' if not specified. The end date must be greater than the start date.

xiii. For a given subject_id, object_id, relationship_code, there can be no overlap of the start date and the end date.

xiv. The subject type and the object type will be used to do the foreign key check for the subject id and the object id column. The subject id should be a valid object instance defined in the object instance set which is specified as the subject type. The object id should be a valid object instance defined in the object instance set which is specified as the object type.

xv. The subject id and the object id cannot be the same value unless the self related flag of the relationship type is set to yes.

xvi. It will check the “denormalized to party” flag in the HZ_RELATIONSHIP_ TYPES table to see if a denormalized party is necessary. If the flag is set to yes, a party will be created for the relationship. Only the relationship with both subject_table_name and object_table_name as 'HZ_PARTIES' can be denormalized to HZ_PARTIES table.

xvii. A record will be created in the HZ_RELATIONSHIPS table with the relationship

Documentation on using TCA APIs - V2 Page 46

Page 48: TCAAPIEX

code Entered as input parameter. xviii. It will find the 2 nd relationship code from the HZ_RELATIONSHIP_TYPES

table, and use it to create a second relationship. The 2 nd relationship will have the same relationship_id and party_id as the first relationship. The requested relationship will be created with directional_code value ‘F’ (meaning forward) and the reciprocal relationship will be created with directional_code value ‘B’ (meaning backward).

Example For Running Create Relationship API DECLARE

p_relationship_rec_type HZ_RELATIONSHIP_V2PUB.RELATIONSHIP_REC_TYPE; x_relationship_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 fnd_client_info.set_org_context('&Org_Id'); p_relationship_rec_type.relationship_type := UPPER('&Relationship_Type'); p_relationship_rec_type.relationship_code := UPPER ('&Relationship_Code'); p_relationship_rec_type.subject_id := '&Subject_Id'; p_relationship_rec_type.subject_table_name := UPPER ('&Subject_Table_Name'); p_relationship_rec_type.subject_type := UPPER ('&Subject_Type'); p_relationship_rec_type.object_id := '&Object_Id'; p_relationship_rec_type.object_table_name := UPPER ('&Object_Table_Name'); p_relationship_rec_type.object_type := UPPER ('&Object_Type'); p_relationship_rec_type.start_date := '&Start_Date'; p_relationship_rec_type.created_by_module := 'TCA_Example'; hz_relationship_v2pub.create_relationship( 'T', p_relationship_rec_type, x_relationship_id, x_party_id, x_party_number, x_return_status, x_msg_count, x_msg_data); dbms_output.put_line('x_return_status = '|| SUBSTR (x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Relationship Id ='||TO_CHAR(x_relationship_id)); dbms_output.put_line('Party Id = '||TO_CHAR(x_party_id)); dbms_output.put_line('Party Number = '|| SUBSTR (x_party_number,1,255)); dbms_output.put_line('x_msg_data = '|| SUBSTR (x_msg_data,1,255)); IF x_msg_count >1 THEN FOR I IN 1..x_msg_count LOOP

Documentation on using TCA APIs - V2 Page 47

Page 49: TCAAPIEX

dbms_output.put_line(I||'.'||SUBSTR(FND_MSG_PUB.Get(p_encoded=> FND_API.G_FALSE ), 1, 255)); END LOOP; END IF;

END; Sample Output of the Create Relationship Script Enter value for org_id: 204 old 11: fnd_client_info.set_org_context('&Org_Id'); new 11: fnd_client_info.set_org_context('204'); Enter value for relationship_type: contact old 12: p_relationship_rec_type.relationship_type := UPPER('&Relationship_Type'); new 12: p_relationship_rec_type.relationship_type := UPPER ('contact'); Enter value for relationship_code: contact_of old 13: p_relationship_rec_type.relationship_code := UPPER ('&Relationship_Code'); new 13: p_relationship_rec_type.relationship_code := UPPER ('contact_of'); Enter value for subject_id: 3906 old 14: p_relationship_rec_type.subject_id := '&Subject_Id'; new 14: p_relationship_rec_type.subject_id := '3906'; Enter value for subject_table_name: hz_parties old 15: p_relationship_rec_type.subject_table_name := UPPER ('&Subject_Table_Name') new 15: p_relationship_rec_type.subject_table_name := UPPER ('hz_parties'); Enter value for subject_type: person old 16: p_relationship_rec_type.subject_type := UPPER ('&Subject_Type'); new 16: p_relationship_rec_type.subject_type := UPPER ('person'); Enter value for object_id: 3903 old 17: p_relationship_rec_type.object_id := '&Object_Id'; new 17: p_relationship_rec_type.object_id := '3903'; Enter value for object_table_name: hz_parties old 18: p_relationship_rec_type.object_table_name := UPPER ('&Object_Table_Name'); new 18: p_relationship_rec_type.object_table_name := UPPER ('hz_parties'); Enter value for object_type: person old 19: p_relationship_rec_type.object_type := UPPER ('&Object_Type'); new 19: p_relationship_rec_type.object_type := UPPER ('person'); Enter value for start_date: 01-JAN-1952 old 20: p_relationship_rec_type.start_date := '&Start_Date'; new 20: p_relationship_rec_type.start_date := '01-JAN-1952';

Documentation on using TCA APIs - V2 Page 48

Page 50: TCAAPIEX

x_return_status = S x_msg_count = 0 Relationship Id =3593 Party Id = 3949 Party Number = 1881 x_msg_data = Script To Verify whether Create Relationship API is successful SELECT relationship_id, subject_id, subject_type, subject_table_name, object_id, object_type, object_table_name, relationship_code, relationship_type, start_date FROM hz_relationships WHERE relationship_id = ‘3593’;

Relationship_id = 3593 Subject_id = 3903 Subject_type = PERSON Subject_table_name = HZ_PARTIES Object_id = 3906 Object_type = PERSON Object_table_name = HZ_PARTIES Relationship_code = CONTACT Relationship_type = CONTACT Start_date = 01-JAN-52

Relationship_id = 3593 Subject_id = 3906 Subject_type = person Subject_table_name = HZ_PARTIES Object_id = 3903 Object_type = PERSON Object_table_name = HZ_PARTIES Relationship_code = CONTACT Relationship_type = CONTACT Start_date = 01-JAN-52

Documentation on using TCA APIs - V2 Page 49

Page 51: TCAAPIEX

Example 12 : Create Class Category API Name of the API : CREATE CLASS CATEGORY Base Tables Affected : HZ_CLASS_CATEGORIES PL/SQL Procedure used : CREATE_CLASS_CATEGORY Package Used : HZ_CLASSIFICATION_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_class_category_rec IN CLASS_CATEGORY_REC_TYPE x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2

Procedure PROCEDURE create_class_category( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_class_category_rec IN CLASS_CATEGORY_REC_TYPE, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Class Category API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN create_class_category.txt) b) The Value for Organization Id is accepted as a Parameter. c) Enter the values for the Parameters :

Class_Category Allow_Multi_Parent_Flag Allow_Multi_Assign_Flag Allow_Leaf_Node_Flag

from the SQL Prompt. The Value of the Parameter Class_Category must belong to a Lookup Code YES/NO. The Value for Parameter Allow_Multi_Parent_Flag must belong to a Lookup Code YES/NO. The Value for Parameter Allow_Leaf_Node_Flag must belong to a Lookup Code YES/NO.

Example For Running Create Class Category API DECLARE

Documentation on using TCA APIs - V2 Page 50

Page 52: TCAAPIEX

p_class_category_rec HZ_CLASSIFICATION_V2PUB.CLASS_CATEGORY_REC_TYPE; x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000);

BEGIN fnd_client_info.set_org_context('&Org_Id'); p_class_category_rec.class_category := UPPER('&Class_Category'); p_class_category_rec.allow_multi_assign_flag := UPPER ('&Multi_Assign_Flag'); p_class_category_rec.allow_multi_parent_flag := UPPER ('&Multi_Parent_Flag'); p_class_category_rec.allow_leaf_node_only_flag := UPPER ('&Leaf_Node_Flag'); p_class_category_rec.created_by_module := 'TCA_Example'; hz_classification_v2pub.create_class_category( 'T', p_class_category_rec, x_return_status, x_msg_count, x_msg_data); dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Class Category = '||p_class_category_rec.class_category); dbms_output.put_line('Allow Multi Parent Flag = '||p_class_category_rec.allow_multi_parent_flag); dbms_output.put_line('x_msg_data = '|| SUBSTR (x_msg_data,1,255)); 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;

END; Sample Output of the Create Class Category Script Enter value for org_id: 204 old 8: fnd_client_info.set_org_context('&Org_Id'); new 8: fnd_client_info.set_org_context('204'); Enter value for class_category: account_classes old 9: p_class_category_rec.class_category := UPPER('&Class_Category'); new 9: p_class_category_rec.class_category := UPPER ('account_classes'); Enter value for multi_assign_flag: y old 10: p_class_category_rec.allow_multi_assign_flag := UPPER ('&Multi_Assign_Flag'); new 10: p_class_category_rec.allow_multi_assign_flag := UPPER ('y'); Enter value for multi_parent_flag: y old 11: p_class_category_rec.allow_multi_parent_flag := UPPER ('&Multi_Parent_Flag');

Documentation on using TCA APIs - V2 Page 51

Page 53: TCAAPIEX

new 11: p_class_category_rec.allow_multi_parent_flag := UPPER ('y'); Enter value for leaf_node_flag: y old 12: p_class_category_rec.allow_leaf_node_only_flag := UPPER ('&Leaf_Node_Flag'); new 12: p_class_category_rec.allow_leaf_node_only_flag := UPPER ('y'); x_return_status = S x_msg_count = 0 Class Category = ACCOUNT_CLASSES Allow Multi Parent Flag = Y x_msg_data = Script To Verify whether the Create Class Category API is successful SELECT Class_Category, Allow_Multi_Parent_Flag, Allow_Multi_Assign_Flag, Allow_Leaf_Node_Only_Flag FROM hz_class_categories WHERE class_category = ‘Account_Classes’;

class_category = ACCOUNT_CLASSES allow_multi_parent_flag = Y allow_multi_assign_flag = Y allow_leaf_node_only_flag = Y

Documentation on using TCA APIs - V2 Page 52

Page 54: TCAAPIEX

Example 13 : Create Code Assignment API Name of the API : CREATE CODE ASSIGNMENT Base Tables Affected : HZ_CODE_ASSIGNMENTS PL/SQL Procedure used : CREATE_CODE_ASSIGNMENT Package Used : HZ_CLASSIFICATION_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_code_assignment_rec IN CODE_ASSIGNMENT_REC_TYPE x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 x_code_assignment_id OUT NUMBER Procedure

PROCEDURE create_code_assignment( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_code_assignment_rec IN CODE_ASSIGNMENT_REC_TYPE, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2, x_code_assignment_id OUT NUMBER )

General Tips for Running the Create Code Assignment API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN create_code_assignment.txt) b) The Value for Organization Id is accepted as a Parameter. c) Enter the values for the Parameters :

Owner_Table_Name Owner_Table_Id Class_Category Class_Code Primary_Flag Start_Date from the SQL Prompt.

i. The Value of the Parameter Owner_Table_Name must belong to a Lookup Code Code_Assign_Owner_Table.

ii. The Value for Parameter Owner_Table_Id must belong to a Column value of the Table_Name selected in Owner_Table_Name.

iii. For example if the value of the Parameter Owner_Table_Name is HZ_PARTIES then the

Documentation on using TCA APIs - V2 Page 53

Page 55: TCAAPIEX

value of the Parameter Owner_Table_Id shall one of the values of the column PARTY_ID . iv. The Value for Parameter Class_Category must belong to the Column CLASS_CATEGORY

from the table HZ_CLASS_CATEGORIES. v. The Value for Parameter Class_Code must be one of the values given

for the Lookup Code selected in (iii) above. vi. The Value for Parameter Primary_Flag must be Validated against the LookUp Code YES_NO .

Example For Running Create Code Assignment API DECLARE

p_code_assignment_rec_type HZ_CLASSIFICATION_V2PUB.CODE_ASSIGNMENT_REC_TYPE; x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000); x_code_assignment_id NUMBER;

BEGIN fnd_client_info.set_org_context('&Org_Id'); p_code_assignment_rec_type.owner_table_name := UPPER('&Owner_Table_Name'); p_code_assignment_rec_type.owner_table_id := &Owner_Table_Id; p_code_assignment_rec_type.class_category := UPPER ('&Class_Category'); p_code_assignment_rec_type.class_code := UPPER ('&Class_Code'); p_code_assignment_rec_type.Primary_Flag := v('&Primary_Flag'); p_code_assignment_rec_type.start_date_active := '&Start_Date_Active'; p_code_assignment_rec_type.created_by_module := 'TCA_Example'; hz_classification_v2pub.create_code_assignment( 'T', p_code_assignment_rec_type, x_return_status, x_msg_count, x_msg_data, x_code_assignment_id); dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Owner Table Name = '||p_code_assignment_rec_type.owner_table_name); dbms_output.put_line('Class Category = '||p_code_assignment_rec_type.class_category); dbms_output.put_line('Class Code = '||p_code_assignment_rec_type.class_code); dbms_output.put_line('Primary Flag = '||p_code_assignment_rec_type.primary_flag); dbms_output.put_line('x_Code_Assignment_Id = '||TO_CHAR(x_code_assignment_id)); dbms_output.put_line('x_msg_data = '|| SUBSTR (x_msg_data,1,255)); 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;

Documentation on using TCA APIs - V2 Page 54

Page 56: TCAAPIEX

END; Sample Output of the Create Code Assignment Script Enter value for org_id: 204 old 9: fnd_client_info.set_org_context('&Org_Id'); new 9: fnd_client_info.set_org_context('204'); Enter value for owner_table_name: hz_parties old 10: p_code_assignment_rec_type.owner_table_name := UPPER('&Owner_Table_Name'); new 10: p_code_assignment_rec_type.owner_table_name := UPPER ('hz_parties'); Enter value for owner_table_id: 1000 old 11: p_code_assignment_rec_type.owner_table_id := &Owner_Table_Id; new 11: p_code_assignment_rec_type.owner_table_id := 1000; Enter value for class_category: accounting_method old 12: p_code_assignment_rec_type.class_category := UPPER ('&Class_Category'); new 12: p_code_assignment_rec_type.class_category := UPPER ('accounting_method'); Enter value for class_code: cash old 13: p_code_assignment_rec_type.class_code := UPPER ('&Class_Code'); new 13: p_code_assignment_rec_type.class_code := UPPER ('cash'); Enter value for primary_flag: y old 14: p_code_assignment_rec_type.Primary_Flag := UPPER ('&Primary_Flag'); new 14: p_code_assignment_rec_type.Primary_Flag := UPPER ('y'); Enter value for start_date_active: 01-JAN-1952 old 15: p_code_assignment_rec_type.start_date_active := '&Start_Date_Active'; new 15: p_code_assignment_rec_type.start_date_active := '01-JAN-1952'; x_return_status = S x_msg_count = 0 Owner Table Name = HZ_PARTIES Class Category = ACCOUNTING_METHOD Class Code = CASH Primary Flag = Y x_Code_Assignment_Id = 1131 x_msg_data = Script To Verify whether the Create Code Assignment API is successful SELECT code_assignment_id, owner_table_name, owner_table_id, class_category, class_code, primary_flag FROM hz_code_assignments WHERE code_assignment_id = '1131';

code_assignment_id = 131 owner_table_name = HZ_PARTIES owner_table_id = 1000

Documentation on using TCA APIs - V2 Page 55

Page 57: TCAAPIEX

class_category = ACCOUNTING_METHOD class_code = CASH primary_flag = Y

Documentation on using TCA APIs - V2 Page 56

Page 58: TCAAPIEX

Example 14 : Create Customer Account API Name of the API : CREATE CUSTOMER ACCOUNT API Base Tables Affected : HZ_CUST_ACCOUNTS HZ_CUSTOMER_PROFILES PL/SQL Procedure used : CREATE_CUST_ACCOUNT Package Used : HZ_CUST_ACCOUNT_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_cust_account_rec IN CUST_ACCOUNT_REC_TYPE p_person_rec IN HZ_PARTY_V2PUB.PERSON_REC_TYPE p_custome r_ prof ile_rec IN HZ_ CUSTOMER_ PROFI LE_

V2PUB.CUSTOMER_PROFILE_REC_TYPE p_create_profil e_amt IN VARCHAR2:= FND_API. G_TRUE x_cust_account_id OUT NUMBER x_account_number OUT VARCHAR2 x_party_id OUT NUMBER x_party_number OUT VARCHAR2 x_profile_id OUT NUMBER x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_cust_account ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_cust_account_rec IN CUST_ACCOUNT_REC_TYPE, p_person_rec IN HZ_PARTY_V2PUB.PERSON_REC_TYPE, p _custome r_prof ile_rec IN HZ_CUSTOMER_ PROFI LE_ V2PUB.CUSTOMER_PROFILE_REC_TYPE, p_create_profil e_amt IN VARCHAR2:= FND_API. G_TRUE, x_cust_account_id OUT NUMBER, x_account_number OUT VARCHAR2, x_party_id OUT NUMBER, x_party_number OUT VARCHAR2, x_profile_id OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

Note: p_create_profile_amt indicates whether to create profile

Documentation on using TCA APIs - V2 Page 57

Page 59: TCAAPIEX

amounts for the customer profile being created. If value equals to FND_API.G_TRUE, profile amounts will be created by copying over the profile amounts for the profile class on which this customer profile is based. General Tips for Running the Create Customer Account API (Person)

a) Save the API in a script file and then run the script from the SQL Prompt (Example : RUN createperson.txt)

b) Enter the Values for the Parameters Account Name, First Name and Last Name from the SQL prompt.

c) The Organization Id is accepted as a Parameter. Example For Running a Create Customer Account API (Person) 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 Fnd_client_info.set_org_context(‘&Org_Id’); p_cust_account_rec.account_name := '&Customer_Name'; p_cust_account_rec.created_by_module := 'TCA_EXAMPLE'; p_person_rec.person_first_name := '&First_Name'; p_person_rec.person_last_name := '&Last_Name'; 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);

Documentation on using TCA APIs - V2 Page 58

Page 60: TCAAPIEX

dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Party Id = '||TO_CHAR(x_party_id)); dbms_output.put_line('Party Number = '||x_party_number); dbms_output.put_line('Profile Id = '||TO_CHAR(x_profile_id)); dbms_output.put_line('x_msg_data = '|| SUBSTR (x_msg_data,1,255)); 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;

END;

Sample Output of the Create Customer Account Script (Person) Enter value for org_id: 204 old 14: Fnd_client_info.set_org_context('&Org_Id'); new 14: Fnd_client_info.set_org_context('204'); Enter value for customer_name: ISC AR TEAM old 15: p_cust_account_rec.account_name := '&Customer_Name'; new 15: p_cust_account_rec.account_name := 'ISC AR TEAM'; Enter value for first_name: ISC old 17: p_person_rec.person_first_name := '&First_Name'; new 17: p_person_rec.person_first_name := 'ISC'; Enter value for last_name: US AR TEAM old 18: p_person_rec.person_last_name := '&Last_Name'; new 18: p_person_rec.person_last_name := 'US AR TEAM'; x_return_status = S x_msg_count = 0 Party Id = 4113 Party Number = 2457 Profile Id = 2266 x_msg_data = Script To Verify whether Create Customer Account API (Person) is successful SELECT cust_account_id, party_id, account_number, account_name FROM hz_cust_accounts WHERE party_id = 4113;

cust_account_id = 3473 party_id = 4113 account_number = 1795 account_name =

SELECT party_id, party_number, party_name, party_type FROM hz_parties WHERE party_id = 4113;

party_id = 4113

Documentation on using TCA APIs - V2 Page 59

Page 61: TCAAPIEX

party_number = 2457 party_name = ISC US AR TEAM party_type = PERSON

SELECT person_profile_id, party_id, person_first_name, person_last_name FROM hz_person_profiles WHERE party_id = 4113;

person_profile_id = 2266 party_id = 4113 person_first_name = ISC person_last_name = US AR TEAM

SELECT cust_account_profile_id, cust_account_id, profile_class_id, collector_id FROM hz_customer_profiles WHERE cust_account_id = 3473;

cust_account_profile_id = 4144 cust_account_id = 3473 profile_class_id = 0 collector = 1000

Documentation on using TCA APIs - V2 Page 60

Page 62: TCAAPIEX

Example 15 : Update Customer Account API Name of the API : UPDATE CUSTOMER ACCOUNT Base Tables Affected : HZ_CUST_ACCOUNTS PL/SQL Procedure used : UPDATE_CUST_ACCOUNT Package Used : HZ_CUST_ACCOUNT_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_cust_account_rec IN CUST_ACCOUNT_REC_TYPE p_object_version_number IN OUT NUMBER x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE update_cust_account ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_cust_account_rec IN CUST_ACCOUNT_REC_TYPE, p_object_version_number IN OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Update Customer Account API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN updatecustacct.txt) b) Enter the values for the Cust_Account_Id and Customer_Type from the SQL

prompt itself as hard coding these two parameters means the script has to be changed for the value of these two parameters each time a Customer Account is Updated.

c) To Select the Customer Account Id run the query: SELECT cust_account_id FROM hz_cust_accounts;

d) The Value for Organization is accepted as a Parameter. Example For Running Update Customer Account Record API DECLARE

p_cust_account_rec HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE; p_object_version_number NUMBER; x_return_status VARCHAR2(2000);

Documentation on using TCA APIs - V2 Page 61

Page 63: TCAAPIEX

x_msg_count NUMBER; x_msg_data VARCHAR2(2000);

BEGIN fnd_client_info.set_org_context('&Org_Id'); p_cust_account_rec.cust_account_id := &Customer_Account_Id; p_cust_account_rec.customer_type := '&Customer_Type'; p_cust_account_rec.account_name := FND_API.G_MISS_CHAR; p_object_version_number := 1; hz_cust_account_v2pub.update_cust_account( 'T', p_cust_account_rec, p_object_version_number, x_return_status, x_msg_count, x_msg_data); dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Object Version Number ='||TO_CHAR(p_object_version_number)); dbms_output.put_line('x_msg_data = '|| SUBSTR (x_msg_data,1,255)); 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;

END; Sample Output of the Update Customer Account Record Script Enter value for org_id: 204 old 8: fnd_client_info.set_org_context('&Org_Id'); new 8: fnd_client_info.set_org_context('204'); Enter value for customer_account_id: 3473 old 9: p_cust_account_rec.cust_account_id := &Customer_Account_Id; new 9: p_cust_account_rec.cust_account_id := 3473; Enter value for customer_type: R old 10: p_cust_account_rec.customer_type := '&Customer_Type'; new 10: p_cust_account_rec.customer_type := 'R'; x_return_status = S x_msg_count = 0 Object Version Number =2 x_msg_data =

Documentation on using TCA APIs - V2 Page 62

Page 64: TCAAPIEX

Script To Verify whether the Update Customer Account API is successful SELECT cust_account_id, customer_type, account_name FROM hz_cust_accounts WHERE cust_account_id = 3473;

cust_account_id = 3473 customer_type = R account_name = ‘ ‘

Documentation on using TCA APIs - V2 Page 63

Page 65: TCAAPIEX

Example 16 : Create Customer Account API Name of the API : CREATE CUSTOMER ACCOUNT SITE Base Tables Affected : HZ_CUST_ACCT_SITES PL/SQL Procedure used : CREATE_CUST_ACCT_SITE Package Used : HZ_CUST_ACCOUNT_SITE_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_cust_acct_site_rec IN CUST_ACCT_SITE_REC_TYPE x_cust_acct_site_id OUT NUMBER x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_cust_acct_site ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_cust_acct_site_rec IN CUST_ACCT_SITE_REC_TYPE, x_cust_acct_site_id OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Customer Account Site API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN createcustacctsite.txt) b) Enter the values for the Cust_Account_Id and Party_Site_id from the SQL

prompt itself as hard coding these two parameters means the script has to be changed for the value of these two parameters each time a new Customer Account Site is created.

c) To Select the Customer Account Id run the query: SELECT cust_account_id FROM hz_cust_accounts;

d) To Select the Party Site Id run the Query : SELECT party_site_id FROM hz_party_sites;

e) Set the organization id before running the script as : EXEC fnd_client_info.set_org_context('<orgid>');

Example For Running a Create Customer Account Site API DECLARE

p_cust_acct_site_rec hz_cust_account_site_v2pub.cust_acct_site_rec_type;

Documentation on using TCA APIs - V2 Page 64

Page 66: TCAAPIEX

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 := &Customer_Account_Id; p_cust_acct_site_rec.party_site_id := &Party_Site_Id; p_cust_acct_site_rec.language := 'US'; p_cust_acct_site_rec.created_by_module := 'TCA-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('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Customer Account Site Id is = '||TO_CHAR(x_cust_acct_site_id)); dbms_output.put_line('x_msg_data = '|| SUBSTR(x_msg_data,1,255)); 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;

END;

Sample Output of the Create Customer Account Site Script Enter value for customer_account_id: 3473 old 8: p_cust_acct_site_rec.cust_account_id := &Customer_Account_Id; new 8: p_cust_acct_site_rec.cust_account_id := 3473; Enter value for party_site_id: 3450 old 9: p_cust_acct_site_rec.party_site_id := &Party_Site_Id; new 9: p_cust_acct_site_rec.party_site_id := 3450; x_return_status = S x_msg_count = 0 Customer Account Site Id is = 3707 x_msg_data = Script To Verify whether the Create Customer Account Site API is successful SELECT cust_acct_site_id, cust_account_id, party_site_id, org_id FROM hz_cust_acct_sites_all WHERE cust_acct_site_id = 3707;

Documentation on using TCA APIs - V2 Page 65

Page 67: TCAAPIEX

cust_acct_site_id = 3707 cust_account_id = 3473 party_site_id = 3450 org_id = 204

Documentation on using TCA APIs - V2 Page 66

Page 68: TCAAPIEX

Example 17 : Update Customer Account Site Use API Name of the API : CREATE CUSTOMER ACCOUNT SITE USE Base Tables Affected : HZ_CUST_SITE_USES PL/SQL Procedure used : CREATE_CUST_SITE_USE Package Used : HZ_CUST_ACCOUNT_SITE_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_cust_site_use_rec IN CUST_SITE_USE_REC_TYPE p_customer_profile_rec IN HZ_CUSTOMER_PROFILE_V2PUB. CUSTOMER_PROFILE_REC_TYPE p_create_profile IN VARCHAR2:=FND_API.G_TRUE p_create_profile_amt IN VARCHAR2:=FND_API.G_TRUE x_site_use_id OUT NUMBER x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_cust_site_use ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_cust_site_use_rec IN CUST_SITE_USE_REC_TYPE, p_customer_ profile_rec IN HZ_CUSTOMER_PROFI LE_ V2PUB.CUSTOMER_PROFILE_REC_TYPE, p_create_profile IN VARCHAR2:= FND_API.G_TRUE, p_create_profile_amt IN VARCHAR2:= FND_API.G_TRUE, x_site_use_id OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

Note: p_create_profile indicates whether to create customer profile for the site use being created. If value equals to FND_API.G_ TRUE, a profile will be created. Similarly, p_create_profile_amt indicates whether to create profile amounts for the customer profile being created. If value equals to FND_API.G_TRUE, profile amounts will be created by copying over the profile amounts for the profile class on which this customer profile is based. p_create_ profile_amt is processed only when p_create_profile equals to FND_API.G_TRUE.

Documentation on using TCA APIs - V2 Page 67

Page 69: TCAAPIEX

General Tips for Running the Create Customer Account Site Use API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN custacctsiteuse.txt) b) Enter the values for the Cust_Account_Site_Id , Site_Use and Location from the SQL

prompt itself as hard coding these two parameters means the script has to be changed for the value of these two parameters each time a new Customer Account Site is created.

c) To Select the Customer Account Site Id run the query: SELECT cust_acct_site_id FROM hz_cust_acct_sites;

d) The Value for Organization is accepted as a Parameter. Example For Running a Create Customer Account Site Use API 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 fnd_client_info.set_org_context('&Org_Id'); p_cust_site_use_rec.cust_acct_site_id := &Customer_Account_Site_Id; p_cust_site_use_rec.site_use_code := '&Site_Use'; p_cust_site_use_rec.location := '&Location'; p_cust_site_use_rec.created_by_module := 'TCA_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('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('Site Use Id = '||TO_CHAR(x_site_use_id)); dbms_output.put_line('Site Use = '|| SUBSTR (p_cust_site_use_rec.site_use_code,1,255)); dbms_output.put_line('x_msg_data = '|| SUBSTR (x_msg_data,1,255)); 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;

Documentation on using TCA APIs - V2 Page 68

Page 70: TCAAPIEX

END IF; END; Sample Output of the Create Customer Account Site Use Script Enter value for org_id: 204 old 9: fnd_client_info.set_org_context('&Org_Id'); new 9: fnd_client_info.set_org_context('204'); Enter value for customer_account_site_id: 3461 old 10: p_cust_site_use_rec.cust_acct_site_id := &Customer_Account_Site_Id; new 10: p_cust_site_use_rec.cust_acct_site_id := 3461; Enter value for site_use: INV old 11: p_cust_site_use_rec.site_use_code := '&Site_Use'; new 11: p_cust_site_use_rec.site_use_code := 'INV'; Enter value for location: NEW LOCATION old 12: p_cust_site_use_rec.location := '&Location'; new 12: p_cust_site_use_rec.location := 'NEW LOCATION'; x_return_status = S x_msg_count = 0 Site Use Id = 3703 Site Use = INV x_msg_data = Script To Verify whether the Create Customer Account Site Use API is successful SELECT site_use_id, cust_acct_site_id, site_use_code, location, org_id FROM hz_cust_site_uses_all WHERE site_use_id = 3703;

site_use_id = 3703 cust_acct_site_id = 3461 site_use_code = INV location = NEW LOCATION org_id = 204

Documentation on using TCA APIs - V2 Page 69

Page 71: TCAAPIEX

Example 18 : Create Customer Profile API Name of the API : CREATE CUSTOMER PROFILE Base Tables Affected : HZ_CUSTOMER_PROFILES PL/SQL Procedure used : CREATE_CUSTOMER_PROFILE Package Used : HZ_CUSTOMER_PROFILE_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p _ customer _prof ile_rec IN CUSTOMER_ PROFI LE_ REC_ TYPE p_create_profil e_amt IN VARCHAR2:= FND_API. G_TRUE x_cust_account_profile_id OUT NUMBER x_return_status OUT VARCHAR2 x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 Procedure

PROCEDURE create_customer_profile ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p _ c us t ome r _ profile_ rec IN CUSTOMER_ PROFI LE_ REC_ TYPE, p_create_profil e_amt IN VARCHAR2:= FND_API. G_TRUE, x_cust_account_profile_id OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Create Customer Profile API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN create_customer_profile.txt) b) The Value for Organization is also accepted as a Parameter. c) Enter the values for the Parameter cust_account_id from the SQL Prompt or from

within API itself as a fixed value. d) The Cust_Account_Id must exists in hz_cust_accounts.

Example For Running Create Customer Profile API DECLARE

p_customer_profile_rec_type HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE; x_cust_account_profile_id NUMBER; x_return_status VARCHAR2(2000);

Documentation on using TCA APIs - V2 Page 70

Page 72: TCAAPIEX

x_msg_count NUMBER; x_msg_data VARCHAR2(2000);

BEGIN fnd_client_info.set_org_context('&Org_Id'); p_customer_profile_rec_type.cust_account_id := '&Cust_Account_Id'; p_customer_profile_rec_type.created_by_module := 'TCA_Example'; hz_customer_profile_v2pub.create_customer_profile( 'T', p_customer_profile_rec_type, 'T', x_cust_account_profile_id, x_return_status, x_msg_count, x_msg_data); dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('Cust Account Id = '||TO_CHAR(p_customer_profile_rec_type.cust_account_id)); dbms_output.put_line('Cust Account Profile Id = '||TO_CHAR(x_cust_account_profile_id)); dbms_output.put_line('Status = '||p_customer_profile_rec_type.status); dbms_output.put_line('Credit Checking = '||p_customer_profile_rec_type.credit_checking); dbms_output.put_line('Interest Charges = '||p_customer_profile_rec_type.interest_charges); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('x_msg_data = '|| SUBSTR (x_msg_data,1,255)); 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;

END; Sample Output of the Create Customer Profile Script Enter value for org_id: 204 old 9: fnd_client_info.set_org_context('&Org_Id'); new 9: fnd_client_info.set_org_context('204'); Enter value for cust_account_id: 1307 old 10: p_customer_profile_rec_type.cust_account_id := '&Cust_Account_Id'; new 10: p_customer_profile_rec_type.cust_account_id := '1307'; x_return_status = S Cust Account Id = 1307 Cust Account Profile Id = 4425 Status = Credit Checking = Interest Charges =

Documentation on using TCA APIs - V2 Page 71

Page 73: TCAAPIEX

x_msg_count = 0 x_msg_data = Script To Verify whether the Create Customer Profile API is successful SELECT cust_account_profile_id, creation_date, cust_account_id, status, created_by_module FROM hz_customer_profiles WHERE cust_account_profile_id = '4425'; Cust_account_profile_id = 4425

Creation_date = 22-APR-02 Cust_account_id = 1307 Status = A Created_by_module = TCA_EXAMPLE

Documentation on using TCA APIs - V2 Page 72

Page 74: TCAAPIEX

Example 19 : Update Customer Profile API Name of the API : UPDATE CUSTOMER PROFILE Base Tables Affected : HZ_CUSTOMER_PROFILES PL/SQL Procedure used : UPDATE_CUSTOMER_PROFILE Package Used : HZ_CUSTOMER_PROFILE_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_customer_ profile_rec IN CUSTOMER_ PROFI LE_ REC_ TYPE, p_object_version_number IN OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 Procedure

PROCEDURE update_customer_profile ( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p _ c us t omer _ profile_rec I N CUSTOMER_ PROFI LE_ REC_ TYPE, p_object_version_number IN OUT NUMBER, x_return_status OUT VARCHAR2, x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2 )

General Tips for Running the Update Customer Profile API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN update_customer_profile.txt) b) The Value for Organization is also accepted as a Parameter.

Example For Running Update Customer Profile API DECLARE

p_customer_profile_rec_type HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE; p_cust_account_profile_id NUMBER; p_object_version_number NUMBER; x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000);

BEGIN fnd_client_info.set_org_context('&Org_Id'); p_customer_profile_rec_type.cust_account_profile_id := '&Cust_Account_Profile_Id';

Documentation on using TCA APIs - V2 Page 73

Page 75: TCAAPIEX

p_customer_profile_rec_type.credit_rating := '&New_Credit_Rating'; p_object_version_number := ‘&object_version_number; hz_customer_profile_v2pub.update_customer_profile( 'T', p_customer_profile_rec_type, p_object_version_number, x_return_status, x_msg_count, x_msg_data); dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('Object Version Number = '||TO_CHAR(p_object_version_number)); dbms_output.put_line('Credit Rating = '||p_customer_profile_rec_type.credit_rating); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('x_msg_data = '|| SUBSTR (x_msg_data,1,255)); 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;

END; Sample Output of the Update Customer Profile Script Enter value for org_id: 204 old 10: fnd_client_info.set_org_context('&Org_Id'); new 10: fnd_client_info.set_org_context('204'); Enter value for cust_account_profile_id: 1017 old 11: p_customer_profile_rec_type.cust_account_profile_id := '&Cust_Account_Profile_Id'; new 11: p_customer_profile_rec_type.cust_account_profile_id := '1017'; Enter value for new_credit_rating: Poor old 12: p_customer_profile_rec_type.credit_rating := '&New_Credit_Rating'; new 12: p_customer_profile_rec_type.credit_rating := 'Poor'; x_return_status = S Object Version Number = 2 Credit Rating = Poor x_msg_count = 0 x_msg_data = Script To Verify whether the Update Customer Profile API is successful SELECT cust_account_profile_id, cust_account_id, status, credit_checking FROM hz_customer_profiles WHERE cust_account_profile_id = '1017';

cust_account_profile_id = 1017 cust_account_id = 1008

Documentation on using TCA APIs - V2 Page 74

Page 76: TCAAPIEX

status = A credit_checking = Y

Documentation on using TCA APIs - V2 Page 75

Page 77: TCAAPIEX

Example 20 : Create Location Assignment API Name of the API : UPDATE CUSTOMER PROFILE Base Tables Affected : HZ_LOC_ASSIGNMENTS PL/SQL Procedure used : CREATE_LOC_ASSIGNMENT Package Used : HZ_TAX_ASSIGNMENT_V2PUB Mandatory Parameters : Parameter Name Parameter Type Data Type p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE p_location_id IN NUMBER p_lock_flag IN VARCHAR2:= FND_API.G_FALSE p_created_by_module IN VARCHAR2 p_application_id IN NUMBER x_return_status IN OUT VARCHAR2, x_msg_count OUT NUMBER x_msg_data OUT VARCHAR2 x_loc_id OUT NUMBER Procedure

PROCEDURE create_loc_assignment( p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE, p_location_id IN NUMBER, p_lock_flag IN VARCHAR2:= FND_API.G_FALSE, p_created_by_module IN VARCHAR2, p_application_id IN NUMBER, x_return_status IN OUT VARCHAR2 , x_msg_count OUT NUMBER, x_msg_data OUT VARCHAR2, x_loc_id OUT NUMBER )

General Tips for Running the Create Location Assignment API a) Save the API in a script file and then run the script from the SQL Prompt

(Example : RUN create_loc_assignment.txt) b) The Value for Organization is accepted as a Parameter. c) Enter the value of the Parameter Location_Id as a value which exists in

HZ_LOCATIONS table. Example For Running Create Location Assignment API DECLARE

p_location_id NUMBER; p_created_by_module VARCHAR2(500);

Documentation on using TCA APIs - V2 Page 76

Page 78: TCAAPIEX

p_application_id NUMBER; x_return_status VARCHAR2(2000); x_msg_count NUMBER; x_msg_data VARCHAR2(2000); x_loc_id NUMBER;

BEGIN fnd_client_info.set_org_context('&Org_Id'); p_location_id := '&Location_Id'; p_created_by_module := 'TCA_Example'; hz_tax_assignment_v2pub.create_loc_assignment( 'T', p_location_id, 'T', p_created_by_module, p_application_id, x_return_status, x_msg_count, x_msg_data, x_loc_id); dbms_output.put_line('x_return_status = '||SUBSTR(x_return_status,1,255)); dbms_output.put_line('Location Id = '||TO_CHAR(p_location_id)); dbms_output.put_line('Created By Moudle = '|| SUBSTR (p_created_by_module,1,30)); dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count)); dbms_output.put_line('x_msg_data = '|| SUBSTR (x_msg_data,1,255)); 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;

END; Sample Output of the Create Location Assignment Script Enter value for org_id: 204 old 11: fnd_client_info.set_org_context('&Org_Id'); new 11: fnd_client_info.set_org_context('204'); Enter value for location_id: 5624 old 12: p_location_id := '&Location_Id'; new 12: p_location_id := '5624';

x_return_status = S Location Id = 5624 Created By Moudle = TCA_Example x_msg_count = 0

Documentation on using TCA APIs - V2 Page 77

Page 79: TCAAPIEX

x_msg_data = Script To Verify whether the Create Location Assignment API is successful SELECT location_id, loc_id, org_id, created_by, created_by_module FROM hz_loc_assignments WHERE location_id = '5624';

Location_id = 5624 Loc_id = ‘ ‘ Org_id = 204 Created_by = -1 Created_by_module = TCA_EXAMPLE

Documentation on using TCA APIs - V2 Page 78

Page 80: TCAAPIEX

PL/SQL RECORD STRUCTURES USED BY TCA APIS These Record Structures need not be created by the user. When the HZ Patchsets are applied the PL/SQL record structures will be available as part of .pls files.

PL/SQL Record Structure for Organization TYPE organization_rec_type IS RECORD( organization_name VARCHAR2(360), duns_number_c VARCHAR2(30), enquiry_duns VARCHAR2(15), ceo_name VARCHAR2(240), ceo_title VARCHAR2(240), principal_name VARCHAR2(240), principal_title VARCHAR2(240), legal_status VARCHAR2(30), control_yr NUMBER, employees_total NUMBER, hq_branch_ind VARCHAR2(30), branch_flag VARCHAR2(1), oob_ind VARCHAR2(30), line_of_business VARCHAR2(240), cong_dist_code VARCHAR2(2), sic_code VARCHAR2(30), import_ind VARCHAR2(30), export_ind VARCHAR2(30), labor_surplus_ind VARCHAR2(30), debarment_ind VARCHAR2(30), minority_owned_ind VARCHAR2(30), minority_owned_type VARCHAR2(30), woman_owned_ind VARCHAR2(30), disadv_8a_ind VARCHAR2(30), small_bus_ind VARCHAR2(30), rent_own_ind VARCHAR2(30), debarments_count NUMBER, debarments_date DATE, failure_score VARCHAR2(30), failure_score_natnl_percentile NUMBER, failure_score_override_code VARCHAR2(30), failure_score_commentary VARCHAR2(30), global_failure_score VARCHAR2(5), db_rating VARCHAR2(5), credit_score VARCHAR2(30), credit_score_commentary VARCHAR2(30), paydex_score VARCHAR2(3), paydex_three_months_ago VARCHAR2(3), paydex_norm VARCHAR2(3),

Documentation on using TCA APIs - V2 Page 79

Page 81: TCAAPIEX

best_time_contact_begin DATE, best_time_contact_end DATE, organization_name_phonetic VARCHAR2(320), tax_reference VARCHAR2(50), gsa_indicator_flag VARCHAR2(1), jgzz_fiscal_code VARCHAR2(20), analysis_fy VARCHAR2(5), fiscal_yearend_month VARCHAR2(30), curr_fy_potential_revenue NUMBER, next_fy_potential_revenue NUMBER, year_established NUMBER, mission_statement VARCHAR2(2000), organization_type VARCHAR2(30), business_scope VARCHAR2(20), corporation_class VARCHAR2(60), known_as VARCHAR2(240), known_as2 VARCHAR2(240), known_as3 VARCHAR2(240), known_as4 VARCHAR2(240), known_as5 VARCHAR2(240), local_bus_iden_type VARCHAR2(30), local_bus_identifier VARCHAR2(60), pref_functional_currency VARCHAR2(30), registration_type VARCHAR2(30), total_employees_text VARCHAR2(60), total_employees_ind VARCHAR2(30), total_emp_est_ind VARCHAR2(30), total_emp_min_ind VARCHAR2(30), parent_sub_ind VARCHAR2(30), incorp_year NUMBER, sic_code_type VARCHAR2(30), public_private_ownership_flag VARCHAR2(1), internal_flag VARCHAR2(30), local_activity_code_type VARCHAR2(30), local_activity_code VARCHAR2(30), emp_at_primary_adr VARCHAR2(10), emp_at_primary_adr_text VARCHAR2(12), emp_at_primary_adr_est_ind VARCHAR2(30), emp_at_primary_adr_min_ind VARCHAR2(30), high_credit NUMBER, avg_high_credit NUMBER, total_payments NUMBER, credit_score_class NUMBER, credit_score_natl_percentile NUMBER, credit_score_incd_default NUMBER, credit_score_age NUMBER,

Documentation on using TCA APIs - V2 Page 80

Page 82: TCAAPIEX

credit_score_date DATE, credit_score_commentary2 VARCHAR2(30), credit_score_commentary3 VARCHAR2(30), credit_score_commentary4 VARCHAR2(30), credit_score_commentary5 VARCHAR2(30), credit_score_commentary6 VARCHAR2(30), credit_score_commentary7 VARCHAR2(30), credit_score_commentary8 VARCHAR2(30), credit_score_commentary9 VARCHAR2(30), credit_score_commentary10 VARCHAR2(30), failure_score_class NUMBER, failure_score_incd_default NUMBER, failure_score_age NUMBER, failure_score_date DATE, failure_score_commentary2 VARCHAR2(30), failure_score_commentary3 VARCHAR2(30), failure_score_commentary4 VARCHAR2(30), failure_score_commentary5 VARCHAR2(30), failure_score_commentary6 VARCHAR2(30), failure_score_commentary7 VARCHAR2(30), failure_score_commentary8 VARCHAR2(30), failure_score_commentary9 VARCHAR2(30), failure_score_commentary10 VARCHAR2(30), maximum_credit_recommendation NUMBER, maximum_credit_currency_code VARCHAR2(240), displayed_duns_party_id NUMBER, content_source_type VARCHAR2(30), content_source_number VARCHAR2(30), attribute_category VARCHAR2(30), attribute1 VARCHAR2(150), attribute2 VARCHAR2(150), attribute3 VARCHAR2(150), attribute4 VARCHAR2(150), attribute5 VARCHAR2(150), attribute6 VARCHAR2(150), attribute7 VARCHAR2(150), attribute8 VARCHAR2(150), attribute9 VARCHAR2(150), attribute10 VARCHAR2(150), attribute11 VARCHAR2(150), attribute12 VARCHAR2(150), attribute13 VARCHAR2(150), attribute14 VARCHAR2(150), attribute15 VARCHAR2(150), attribute16 VARCHAR2(150), attribute17 VARCHAR2(150),

Documentation on using TCA APIs - V2 Page 81

Page 83: TCAAPIEX

attribute18 VARCHAR2(150), attribute19 VARCHAR2(150), attribute20 VARCHAR2(150), created_by_module VARCHAR2(150), application_id NUMBER, party_rec PARTY_REC_TYPE:= G_MISS_PARTY _REC )

PL/SQL Record Structure for Person TYPE person_rec_type IS RECORD( person_pre_name_adjunct VARCHAR2(30), person_first_name VARCHAR2(150), person_middle_name VARCHAR2(60), person_last_name VARCHAR2(150), person_name_suffix VARCHAR2(30), person_title VARCHAR2(60), person_academic_title VARCHAR2(30), person_previous_last_name VARCHAR2(150), person_initials VARCHAR2(6), known_as VARCHAR2(240), known_as2 VARCHAR2(240), known_as3 VARCHAR2(240), known_as4 VARCHAR2(240), known_as5 VARCHAR2(240), person_name_phonetic VARCHAR2(320), person_first_name_phonetic VARCHAR2(60), person_last_name_phonetic VARCHAR2(60), middle_name_phonetic VARCHAR2(60), tax_reference VARCHAR2(50), jgzz_fiscal_code VARCHAR2(20), person_iden_type VARCHAR2(30), person_identifier VARCHAR2(60), date_of_birth DATE, place_of_birth VARCHAR2(60), date_of_death DATE, gender VARCHAR2(30), declared_ethnicity VARCHAR2(60), marital_status VARCHAR2(30), marital_status_effective_date DATE, personal_income NUMBER, head_of_household_flag VARCHAR2(1), household_income NUMBER, household_size NUMBER, rent_own_ind VARCHAR2(30),

Documentation on using TCA APIs - V2 Page 82

Page 84: TCAAPIEX

last_known_gps VARCHAR2(60), content_source_type VARCHAR2(30):= G_MISS_CONTENT_ SOURCE_TYPE, internal_flag VARCHAR2(2), attribute_category VARCHAR2(30), attribute1 VARCHAR2(150), attribute2 VARCHAR2(150), attribute3 VARCHAR2(150), attribute4 VARCHAR2(150), attribute5 VARCHAR2(150), attribute6 VARCHAR2(150), attribute7 VARCHAR2(150), attribute8 VARCHAR2(150), attribute9 VARCHAR2(150), attribute10 VARCHAR2(150), attribute11 VARCHAR2(150), attribute12 VARCHAR2(150), attribute13 VARCHAR2(150), attribute14 VARCHAR2(150), attribute15 VARCHAR2(150), attribute16 VARCHAR2(150), attribute17 VARCHAR2(150), attribute18 VARCHAR2(150), attribute19 VARCHAR2(150), attribute20 VARCHAR2(150), created_by_module VARCHAR2(150), application_id NUMBER, party_rec PARTY_REC_TYPE:= G_MISS_PARTY_REC )

PL/SQL Record Structure for Group TYPE group_rec_type IS RECORD( group_name VARCHAR2(255), group_type VARCHAR2(30), created_by_module VARCHAR2(150), application_id NUMBER, party_rec PARTY_REC_TYPE:= G_MISS_PARTY_REC )

PL/SQL Record Structure for Organization Contact TYPE org_contact_rec_type IS RECORD( org_contact_id NUMBER, comments VARCHAR2(240),

Documentation on using TCA APIs - V2 Page 83

Page 85: TCAAPIEX

contact_number VARCHAR2(30), department_code VARCHAR2(30), department VARCHAR2(60), title VARCHAR2(30), job_title VARCHAR2(100), decision_maker_flag VARCHAR2(1), job_title_code VARCHAR2(30), reference_use_flag VARCHAR2(1), rank VARCHAR2(30), party_site_id NUMBER, orig_system_reference VARCHAR2(240), attribute_category VARCHAR2(30), attribute1 VARCHAR2(150), attribute2 VARCHAR2(150), attribute3 VARCHAR2(150), attribute4 VARCHAR2(150), attribute5 VARCHAR2(150), attribute6 VARCHAR2(150), attribute7 VARCHAR2(150), attribute8 VARCHAR2(150), attribute9 VARCHAR2(150), attribute10 VARCHAR2(150), attribute11 VARCHAR2(150), attribute12 VARCHAR2(150), attribute13 VARCHAR2(150), attribute14 VARCHAR2(150), attribute15 VARCHAR2(150), attribute16 VARCHAR2(150), attribute17 VARCHAR2(150), attribute18 VARCHAR2(150), attribute19 VARCHAR2(150), attribute20 VARCHAR2(150), attribute21 VARCHAR2(150), attribute22 VARCHAR2(150), attribute23 VARCHAR2(150), attribute24 VARCHAR2(150), created_by_module VARCHAR2(150), application_id NUMBER, party_rel_rec HZ_RELATIONSHIP_V2PUB.relationship_rec_ type:=HZ_RELATIONSHIP_V2PUB.G_MISS_ REL_REC )

PL/SQL Record Structure for Location TYPE location_rec_type IS RECORD(

Documentation on using TCA APIs - V2 Page 84

Page 86: TCAAPIEX

location_id NUMBER, orig_system_reference VARCHAR2(240), country VARCHAR2(60), address1 VARCHAR2(240), address2 VARCHAR2(240), address3 VARCHAR2(240), address4 VARCHAR2(240), city VARCHAR2(60), postal_code VARCHAR2(60), state VARCHAR2(60), province VARCHAR2(60), county VARCHAR2(60), address_key VARCHAR2(500), address_style VARCHAR2(30), validated_flag VARCHAR2(1), address_lines_phonetic VARCHAR2(560), po_box_number VARCHAR2(50), house_number VARCHAR2(50), street_suffix VARCHAR2(50), street VARCHAR2(50), street_number VARCHAR2(50), floor VARCHAR2(50), suite VARCHAR2(50), postal_plus4_code VARCHAR2(10), position VARCHAR2(50), location_directions VARCHAR2(640), address_effective_date DATE, address_expiration_date DATE, clli_code VARCHAR2(60), language VARCHAR2(4), short_description VARCHAR2(240), description VARCHAR2(2000), geometry MDSYS.SDO_GEOMETRY:= hz_geometry_ default, loc_hierarchy_id NUMBER, sales_tax_geocode VARCHAR2(30), sales_tax_inside_city_limits VARCHAR2(30), fa_location_id NUMBER, content_source_type VARCHAR2(30):= HZ_PARTY_V2PUB.G_MISS_ CONTENT_SOURCE_TYPE, attribute_category VARCHAR2(30), attribute1 VARCHAR2(150), attribute2 VARCHAR2(150), attribute3 VARCHAR2(150), attribute4 VARCHAR2(150), attribute5 VARCHAR2(150),

Documentation on using TCA APIs - V2 Page 85

Page 87: TCAAPIEX

attribute6 VARCHAR2(150), attribute7 VARCHAR2(150), attribute8 VARCHAR2(150), attribute9 VARCHAR2(150), attribute10 VARCHAR2(150), attribute11 VARCHAR2(150), attribute12 VARCHAR2(150), attribute13 VARCHAR2(150), attribute14 VARCHAR2(150), attribute15 VARCHAR2(150), attribute16 VARCHAR2(150), attribute17 VARCHAR2(150), attribute18 VARCHAR2(150), attribute19 VARCHAR2(150), attribute20 VARCHAR2(150), timezone_id NUMBER, created_by_module VARCHAR2(150), application_id NUMBER )

PL/SQL Record Structure for Party Site TYPE party_site_rec_type IS RECORD( party_site_id NUMBER, party_id NUMBER, location_id NUMBER, party_site_number VARCHAR2(30), orig_system_reference VARCHAR2(240), mailstop VARCHAR2(60), identifying_address_flag VARCHAR2(1), status VARCHAR2(1), party_site_name VARCHAR2(240), attribute_category VARCHAR2(30), attribute1 VARCHAR2(150), attribute2 VARCHAR2(150), attribute3 VARCHAR2(150), attribute4 VARCHAR2(150), attribute5 VARCHAR2(150), attribute6 VARCHAR2(150), attribute7 VARCHAR2(150), attribute8 VARCHAR2(150), attribute9 VARCHAR2(150), attribute10 VARCHAR2(150), attribute11 VARCHAR2(150), attribute12 VARCHAR2(150),

Documentation on using TCA APIs - V2 Page 86

Page 88: TCAAPIEX

attribute13 VARCHAR2(150), attribute14 VARCHAR2(150), attribute15 VARCHAR2(150), attribute16 VARCHAR2(150), attribute17 VARCHAR2(150), attribute18 VARCHAR2(150), attribute19 VARCHAR2(150), attribute20 VARCHAR2(150), language VARCHAR2(4), addressee VARCHAR2(150), created_by_module VARCHAR2(150), application_id NUMBER )

PL/SQL Record Structure for Party Site Use TYPE party_site_use_rec_type IS RECORD ( party_site_use_id NUMBER, comments VARCHAR2(240), site_use_type VARCHAR2(30), party_site_id NUMBER, primary_per_type VARCHAR2(1), status VARCHAR2(1), created_by_module VARCHAR2(150), application_id NUMBER )

PL/SQL Record Structure for Contact Point TYPE contact_point_rec_type IS RECORD ( contact_point_id NUMBER, contact_point_type VARCHAR2(30), status VARCHAR2(30), owner_table_name VARCHAR2(30), owner_table_id NUMBER, primary_flag VARCHAR2(1), orig_system_reference VARCHAR2(240), content_source_type VARCHAR2(30):= HZ_PARTY_V2PUB.G_ MISS_CONTENT_SOURCE_TYPE, attribute_category VARCHAR2(30), attribute1 VARCHAR2(150), attribute2 VARCHAR2(150), attribute3 VARCHAR2(150), attribute4 VARCHAR2(150), attribute5 VARCHAR2(150), attribute6 VARCHAR2(150),

Documentation on using TCA APIs - V2 Page 87

Page 89: TCAAPIEX

attribute7 VARCHAR2(150), attribute8 VARCHAR2(150), attribute9 VARCHAR2(150), attribute10 VARCHAR2(150), attribute11 VARCHAR2(150), attribute12 VARCHAR2(150), attribute13 VARCHAR2(150), attribute14 VARCHAR2(150), attribute15 VARCHAR2(150), attribute16 VARCHAR2(150), attribute17 VARCHAR2(150), attribute18 VARCHAR2(150), attribute19 VARCHAR2(150), attribute20 VARCHAR2(150), contact_point_purpose VARCHAR2(30), primary_by_purpose VARCHAR2(1), created_by_module VARCHAR2(150), application_id NUMBER ) PL/SQL Record Structure for Phone TYPE phone_rec_type IS RECORD ( phone_calling_calendar VARCHAR2(30), last_contact_dt_time DATE, timezone_id NUMBER, phone_area_code VARCHAR2(10), phone_country_code VARCHAR2(10), phone_number VARCHAR2(40), phone_extension VARCHAR2(20), phone_line_type VARCHAR2(30), raw_phone_number VARCHAR2(60) )

PL/SQL Record Structure for Create Relationship Type API TYPE relationship_type_rec_type IS RECORD( relationship_type_id NUMBER, relationship_type VARCHAR2(30), forward_rel_code VARCHAR2(30), backward_rel_code VARCHAR2(30), direction_code VARCHAR2(30), hierarchical_flag VARCHAR2(1), create_party_flag VARCHAR2(1), allow_relate_to_self_flag VARCHAR2(1),

Documentation on using TCA APIs - V2 Page 88

Page 90: TCAAPIEX

allow_circular_relationships VARCHAR2(1), subject_type VARCHAR2(30), object_type VARCHAR2(30), status VARCHAR2(1), created_by_module VARCHAR2(150), application_id NUMBER )

PL/SQL Record Structure for Create Relationship API TYPE relationship_rec_type IS RECORD( relationship_id NUMBER, subject_id NUMBER, subject_type VARCHAR2(30), subject_table_name VARCHAR2(30), object_id NUMBER, object_type VARCHAR2(30), object_table_name VARCHAR2(30), relationship_code VARCHAR2(30), relationship_type VARCHAR2(30), comments VARCHAR2(240), start_date DATE, end_date DATE, status VARCHAR2(1), content_source_type VARCHAR2(30), attribute_category VARCHAR2(30), attribute1 VARCHAR2(150), attribute2 VARCHAR2(150), attribute3 VARCHAR2(150), attribute4 VARCHAR2(150), attribute5 VARCHAR2(150), attribute6 VARCHAR2(150), attribute7 VARCHAR2(150), attribute8 VARCHAR2(150), attribute9 VARCHAR2(150), attribute10 VARCHAR2(150), attribute11 VARCHAR2(150), attribute12 VARCHAR2(150), attribute13 VARCHAR2(150), attribute14 VARCHAR2(150), attribute15 VARCHAR2(150), attribute16 VARCHAR2(150), attribute17 VARCHAR2(150), attribute18 VARCHAR2(150), attribute19 VARCHAR2(150),

Documentation on using TCA APIs - V2 Page 89

Page 91: TCAAPIEX

attribute20 VARCHAR2(150), created_by_module VARCHAR2(150), application_id NUMBER, party_rec HZ_PARTY_V2PUB.PARTY_REC_TYPE:= HZ_ PARTY_V2PUB. G_MI SS_PARTY_REC additional_information1 VARCHAR2(150), additional_information2 VARCHAR2(150), additional_information3 VARCHAR2(150), additional_information4 VARCHAR2(150), additional_information5 VARCHAR2(150), additional_information6 VARCHAR2(150), additional_information7 VARCHAR2(150), additional_information8 VARCHAR2(150), additional_information9 VARCHAR2(150), additional_information10 VARCHAR2(150), additional_information11 VARCHAR2(150), additional_information12 VARCHAR2(150), additional_information13 VARCHAR2(150), additional_information14 VARCHAR2(150), additional_information15 VARCHAR2(150), additional_information16 VARCHAR2(150), additional_information17 VARCHAR2(150), additional_information18 VARCHAR2(150), additional_information19 VARCHAR2(150), additional_information20 VARCHAR2(150), additional_information21 VARCHAR2(150), additional_information22 VARCHAR2(150), additional_information23 VARCHAR2(150), additional_information24 VARCHAR2(150), additional_information25 VARCHAR2(150), additional_information26 VARCHAR2(150), additional_information27 VARCHAR2(150), additional_information28 VARCHAR2(150), additional_information29 VARCHAR2(150), additional_information30 VARCHAR2(150), )

PL/SQL Record Structure for Create Class Category API TYPE class_category_rec_type IS RECORD ( class_category VARCHAR2(30), allow_ multi _ parent _ flag VARCHAR2 ( 1) , allow_ multi _assign_ flag VARCHAR2 ( 1) , allow_leaf_node _ only _ fla g VARCHAR2 ( 1 ) , created_by_module VARCHAR2(150),

Documentation on using TCA APIs - V2 Page 90

Page 92: TCAAPIEX

application_id NUMBER )

PL/SQL Record Structure for Create Code Assignment API TYPE code_assignment_rec_type IS RECORD ( code_assignment_id NUMBER, owner_table_name VARCHAR2(30), owner_table_id NUMBER, class_category VARCHAR2(30), class_code VARCHAR2(30), primary_flag VARCHAR2(1), content_source_type VARCHAR2(30):= HZ_PARTY_V2PUB. G_MISS_ CONTENT_SOURCE_TYPE, start_date_active DATE, end_date_active DATE, status VARCHAR2(1), created_by_module VARCHAR2(150), application_id NUMBER )

PL/SQL Record Structure for Customer Account TYPE cust_account_rec_type IS RECORD ( cust_account_id NUMBER, account_number VARCHAR2(30), attribute_category VARCHAR2(30), attribute1 VARCHAR2(150), attribute2 VARCHAR2(150), attribute3 VARCHAR2(150), attribute4 VARCHAR2(150), attribute5 VARCHAR2(150), attribute6 VARCHAR2(150), attribute7 VARCHAR2(150), attribute8 VARCHAR2(150), attribute9 VARCHAR2(150), attribute10 VARCHAR2(150), attribute11 VARCHAR2(150), attribute12 VARCHAR2(150), attribute13 VARCHAR2(150), attribute14 VARCHAR2(150), attribute15 VARCHAR2(150), attribute16 VARCHAR2(150), attribute17 VARCHAR2(150), attribute18 VARCHAR2(150),

Documentation on using TCA APIs - V2 Page 91

Page 93: TCAAPIEX

attribute19 VARCHAR2(150), attribute20 VARCHAR2(150), global_attribute_category VARCHAR2(30), global_attribute1 VARCHAR2(150), global_attribute2 VARCHAR2(150), global_attribute3 VARCHAR2(150), global_attribute4 VARCHAR2(150), global_attribute5 VARCHAR2(150), global_attribute6 VARCHAR2(150), global_attribute7 VARCHAR2(150), global_attribute8 VARCHAR2(150), global_attribute9 VARCHAR2(150), global_attribute10 VARCHAR2(150), global_attribute11 VARCHAR2(150), global_attribute12 VARCHAR2(150), global_attribute13 VARCHAR2(150), global_attribute14 VARCHAR2(150), global_attribute15 VARCHAR2(150), global_attribute16 VARCHAR2(150), global_attribute17 VARCHAR2(150), global_attribute18 VARCHAR2(150), global_attribute19 VARCHAR2(150), global_attribute20 VARCHAR2(150), orig_system_reference VARCHAR2(240), status VARCHAR2(1), customer_type VARCHAR2(30), customer_class_code VARCHAR2(30), primary_salesrep_id NUMBER, sales_channel_code VARCHAR2(30), order_type_id NUMBER, price_list_id NUMBER, tax_code VARCHAR2(50), fob_point VARCHAR2(30), freight_term VARCHAR2(30), ship_partial VARCHAR2(1), ship_via VARCHAR2(25), warehouse_id NUMBER, tax_header_level_flag VARCHAR2(1), tax_rounding_rule VARCHAR2(30), coterminate_day_month VARCHAR2(6), primary_specialist_id NUMBER, secondary_specialist_id NUMBER, account_liable_flag VARCHAR2(1), current_balance NUMBER, account_established_date DATE, account_termination_date DATE,

Documentation on using TCA APIs - V2 Page 92

Page 94: TCAAPIEX

account_activation_date DATE, department VARCHAR2(30), held_bill_expiration_date DATE, hold_bill_flag VARCHAR2(1), realtime_rate_flag VARCHAR2(1), acct_life_cycle_status VARCHAR2(30), account_name VARCHAR2(240), deposit_refund_method VARCHAR2(20), dormant_account_flag VARCHAR2(1), npa_number VARCHAR2(60), suspension_date DATE, source_code VARCHAR2(150), comments VARCHAR2(240), dates_negative_tolerance NUMBER, dates_positive_tolerance NUMBER, date_type_preference VARCHAR2(20), over_shipment_tolerance NUMBER, under_shipment_tolerance NUMBER, over_return_tolerance NUMBER, under_return_tolerance NUMBER, item_cross_ref_pref VARCHAR2(30), ship_sets_include_lines_flag VARCHAR2(1), arrivalsets_include_lines_flag VARCHAR2(1), sched_date_push_flag VARCHAR2(1), invoice_quantity_rule VARCHAR2(30), pricing_event VARCHAR2(30), status_update_date DATE, autopay_flag VARCHAR2(1), notify_flag VARCHAR2(1), last_batch_id NUMBER, selling_party_id NUMBER, created_by_module VARCHAR2(150), application_id NUMBER )

PL/SQL Record Structure for Customer Account Site TYPE cust_acct_site_rec_type IS RECORD ( cust_acct_site_id NUMBER, cust_account_id NUMBER, party_site_id NUMBER, attribute_category VARCHAR2(30), attribute1 VARCHAR2(150), attribute2 VARCHAR2(150), attribute3 VARCHAR2(150),

Documentation on using TCA APIs - V2 Page 93

Page 95: TCAAPIEX

attribute4 VARCHAR2(150), attribute5 VARCHAR2(150), attribute6 VARCHAR2(150), attribute7 VARCHAR2(150), attribute8 VARCHAR2(150), attribute9 VARCHAR2(150), attribute10 VARCHAR2(150), attribute11 VARCHAR2(150), attribute12 VARCHAR2(150), attribute13 VARCHAR2(150), attribute14 VARCHAR2(150), attribute15 VARCHAR2(150), attribute16 VARCHAR2(150), attribute17 VARCHAR2(150), attribute18 VARCHAR2(150), attribute19 VARCHAR2(150), attribute20 VARCHAR2(150), global_attribute_category VARCHAR2(30), global_attribute1 VARCHAR2(150), global_attribute2 VARCHAR2(150), global_attribute3 VARCHAR2(150), global_attribute4 VARCHAR2(150), global_attribute5 VARCHAR2(150), global_attribute6 VARCHAR2(150), global_attribute7 VARCHAR2(150), global_attribute8 VARCHAR2(150), global_attribute9 VARCHAR2(150), global_attribute10 VARCHAR2(150), global_attribute11 VARCHAR2(150), global_attribute12 VARCHAR2(150), global_attribute13 VARCHAR2(150), global_attribute14 VARCHAR2(150), global_attribute15 VARCHAR2(150), global_attribute16 VARCHAR2(150), global_attribute17 VARCHAR2(150), global_attribute18 VARCHAR2(150), global_attribute19 VARCHAR2(150), global_attribute20 VARCHAR2(150), orig_system_reference VARCHAR2(240), status VARCHAR2(1), customer_category_code VARCHAR2(30), language VARCHAR2(4), key_account_flag VARCHAR2(1), tp_header_id NUMBER, ece_tp_location_code VARCHAR2(40), primary_specialist_id NUMBER,

Documentation on using TCA APIs - V2 Page 94

Page 96: TCAAPIEX

secondary_specialist_id NUMBER, territory_id NUMBER, territory VARCHAR2(30), translated_customer_name VARCHAR2(50), created_by_module VARCHAR2(150), application_id NUMBER )

PL/SQL Record Structure for Customer Account Site Use TYPE cust_site_use_rec_type IS RECORD ( site_use_id NUMBER, cust_acct_site_id NUMBER, site_use_code VARCHAR2(30), primary_flag VARCHAR2(1), status VARCHAR2(1), location VARCHAR2(40), bill_to_site_use_id NUMBER, orig_system_reference VARCHAR2(240), sic_code VARCHAR2(30), payment_term_id NUMBER, gsa_indicator VARCHAR2(1), ship_partial VARCHAR2(1), ship_via VARCHAR2(25), fob_point VARCHAR2(30), order_type_id NUMBER, price_list_id NUMBER, freight_term VARCHAR2(30), warehouse_id NUMBER, territory_id NUMBER, attribute_category VARCHAR2(30), attribute1 VARCHAR2(150), attribute2 VARCHAR2(150), attribute3 VARCHAR2(150), attribute4 VARCHAR2(150), attribute5 VARCHAR2(150), attribute6 VARCHAR2(150), attribute7 VARCHAR2(150), attribute8 VARCHAR2(150), attribute9 VARCHAR2(150), attribute10 VARCHAR2(150), tax_reference VARCHAR2(50), sort_priority NUMBER, tax_code VARCHAR2(50), attribute11 VARCHAR2(150),

Documentation on using TCA APIs - V2 Page 95

Page 97: TCAAPIEX

attribute12 VARCHAR2(150), attribute13 VARCHAR2(150), attribute14 VARCHAR2(150), attribute15 VARCHAR2(150), attribute16 VARCHAR2(150), attribute17 VARCHAR2(150), attribute18 VARCHAR2(150), attribute19 VARCHAR2(150), attribute20 VARCHAR2(150), attribute21 VARCHAR2(150), attribute22 VARCHAR2(150), attribute23 VARCHAR2(150), attribute24 VARCHAR2(150), attribute25 VARCHAR2(150), demand_class_code VARCHAR2(30), tax_header_level_flag VARCHAR2(1), tax_rounding_rule VARCHAR2(30), global_attribute1 VARCHAR2(150), global_attribute2 VARCHAR2(150), global_attribute3 VARCHAR2(150), global_attribute4 VARCHAR2(150), global_attribute5 VARCHAR2(150), global_attribute6 VARCHAR2(150), global_attribute7 VARCHAR2(150), global_attribute8 VARCHAR2(150), global_attribute9 VARCHAR2(150), global_attribute10 VARCHAR2(150), global_attribute11 VARCHAR2(150), global_attribute12 VARCHAR2(150), global_attribute13 VARCHAR2(150), global_attribute14 VARCHAR2(150), global_attribute15 VARCHAR2(150), global_attribute16 VARCHAR2(150), global_attribute17 VARCHAR2(150), global_attribute18 VARCHAR2(150), global_attribute19 VARCHAR2(150), global_attribute20 VARCHAR2(150), global_attribute_category VARCHAR2(30), primary_salesrep_id NUMBER, finchrg_receivables_trx_id NUMBER, dates_negative_tolerance NUMBER, dates_positive_tolerance NUMBER, date_type_preference VARCHAR2(20), over_shipment_tolerance NUMBER, under_shipment_tolerance NUMBER, item_cross_ref_pref VARCHAR2(30),

Documentation on using TCA APIs - V2 Page 96

Page 98: TCAAPIEX

over_return_tolerance NUMBER, under_return_tolerance NUMBER, ship_sets_include_lines_flag VARCHAR2(1), arrivalsets_include_lines_flag VARCHAR2(1), sched_date_push_flag VARCHAR2(1), invoice_quantity_rule VARCHAR2(30), pricing_event VARCHAR2(30), gl_id_rec NUMBER, gl_id_rev NUMBER, gl_id_tax NUMBER, gl_id_freight NUMBER, gl_id_clearing NUMBER, gl_id_unbilled NUMBER, gl_id_unearned NUMBER, gl_id_unpaid_rec NUMBER, gl_id_remittance NUMBER, gl_id_factor NUMBER, tax_classification VARCHAR2(30), created_by_module VARCHAR2(150), application_id NUMBER )

PL/SQL Record Structure for Create Customer Profile API TYPE customer_profile_rec_type IS RECORD ( cust_account_profile_id NUMBER, cust_account_id NUMBER, status VARCHAR2(1), collector_id NUMBER, credit_analyst_id NUMBER, credit_checking VARCHAR2(1), next_credit_review_ DATE, tolerance NUMBER, discount_terms VARCHAR2(1), dunning_letters VARCHAR2(1), interest_charges VARCHAR2(1), send_statements VARCHAR2(1), credit_balance_statements VARCHAR2(1), credit_hold VARCHAR2(1), profile_class_id NUMBER, site_use_id NUMBER, credit_rating VARCHAR2(30), risk_code VARCHAR2(30), standard_terms NUMBER, override_terms VARCHAR2(1),

Documentation on using TCA APIs - V2 Page 97

Page 99: TCAAPIEX

dunning_letter_set_id NUMBER, interest_period_days NUMBER, payment_grace_days NUMBER, discount_grace_days NUMBER, statement_cycle_id NUMBER, account_status VARCHAR2(30), percent_collectable NUMBER, autocash_hierarchy_id NUMBER, attribute_category VARCHAR2(30), attribute1 VARCHAR2(150), attribute2 VARCHAR2(150), attribute3 VARCHAR2(150), attribute4 VARCHAR2(150), attribute5 VARCHAR2(150), attribute6 VARCHAR2(150), attribute7 VARCHAR2(150), attribute8 VARCHAR2(150), attribute9 VARCHAR2(150), attribute10 VARCHAR2(150), attribute11 VARCHAR2(150), attribute12 VARCHAR2(150), attribute13 VARCHAR2(150), attribute14 VARCHAR2(150), attribute15 VARCHAR2(150), auto_rec_incl_disputed_flag VARCHAR2(1), tax_printing_option VARCHAR2(30), charge_on_finance_charge_flag VARCHAR2(1), grouping_rule_id NUMBER, clearing_days NUMBER, jgzz_attribute_category VARCHAR2(30), jgzz_attribute1 VARCHAR2(150), jgzz_attribute2 VARCHAR2(150), jgzz_attribute3 VARCHAR2(150), jgzz_attribute4 VARCHAR2(150), jgzz_attribute5 VARCHAR2(150), jgzz_attribute6 VARCHAR2(150), jgzz_attribute7 VARCHAR2(150), jgzz_attribute8 VARCHAR2(150), jgzz_attribute9 VARCHAR2(150), jgzz_attribute10 VARCHAR2(150), jgzz_attribute11 VARCHAR2(150), jgzz_attribute12 VARCHAR2(150), jgzz_attribute13 VARCHAR2(150), jgzz_attribute14 VARCHAR2(150), jgzz_attribute15 VARCHAR2(150), global_attribute1 VARCHAR2(150),

Documentation on using TCA APIs - V2 Page 98

Page 100: TCAAPIEX

global_attribute2 VARCHAR2(150), global_attribute3 VARCHAR2(150), global_attribute4 VARCHAR2(150), global_attribute5 VARCHAR2(150), global_attribute6 VARCHAR2(150), global_attribute7 VARCHAR2(150), global_attribute8 VARCHAR2(150), global_attribute9 VARCHAR2(150), global_attribute10 VARCHAR2(150), global_attribute11 VARCHAR2(150), global_attribute12 VARCHAR2(150), global_attribute13 VARCHAR2(150), global_attribute14 VARCHAR2(150), global_attribute15 VARCHAR2(150), global_attribute16 VARCHAR2(150), global_attribute17 VARCHAR2(150), global_attribute18 VARCHAR2(150), global_attribute19 VARCHAR2(150), global_attribute20 VARCHAR2(150), global_attribute_category VARCHAR2(30), cons_inv_flag VARCHAR2(1), cons_inv_type VARCHAR2(30), autocash_hierarchy_id_for_adr NUMBER, lockbox_matchi ng_opt i on VARCHAR2( 30) , created_by_module VARCHAR2(150), application_id NUMBER )

Documentation on using TCA APIs - V2 Page 99

Page 101: TCAAPIEX

MESSAGES FOR THE TCA API Messages play an important role in the effectiveness of API calls. The appropriate messages must be raised at the right points in the processing to accurately describe the error that has occurred. In the TCA APIs all error messages are put on the message stack during execution and can be retrieved by the caller.

Number Code Message

96273 HZ_API_ACCOUNT_NUMBER_AUTO_ON User cannot pass the account number because account number auto-generation is enabled.

294227 HZ_API_ACCT_SITEUSE_MISMATCH The site use must belong to the customer account.

294228 HZ_API_ACCT_SITE_MISSMATCH The site must belong to the customer account.

294224 HZ_API_BILL_TO_SITE_USE_F The site use referenced by this bill_to_site_use_id must be active bill-to

294225 HZ_API_BILL_TO_SITE_USE_S User can only assign bill_to_site_use_id when the current account site use purpose is ship-to.

294015 HZ_API_CLA_CAT_WHERE The &OWNER_TABLE_ID record ID from the &OWNER_TABLE owner table cannot be validated against the database. Most of the time

294220 HZ_API_COLUMN_SHOULD_BE_NULL The &COLUMN column in the &TABLE table must be null. Please change the value of the column to null.

Documentation on using TCA APIs - V2 Page 100

Page 102: TCAAPIEX

96274 HZ_API_DATE_GREATER &DATE2 cannot be earlier than &DATE1.

96242 HZ_API_DUPLICATE_COLUMN Value for &COLUMN must be unique.

294237 HZ_API_DUPLICATE_RECORD The time range of this preference overlaps with the existing preference &COLUMN=&ID in the &TABLE table. Please enter a different preference or update the existing preference (&COLUMN=&ID).

96279 HZ_API_HOOK_ERROR The following error occurred in procedure &PROCEDURE:

294115 HZ_API_INACTIVE_NOT_PRIMARY An inactive contact point cannot be the primary contact point.

294219 HZ_API_INACTIVE_PROFILE_CLASS The customer profile class &NAME is inactive. Please select another profile class for the customer profile.

294067 HZ_API_INVALID_COMBINATION Backward relationship code must be the same for all records of a specified combination of forward relationship code

96249 HZ_API_INVALID_FK Invalid value for &FK. Please enter &COLUMN value from &TABLE.

96244 HZ_API_INVALID_LOOKUP Value for &COLUMN must be a value defined in lookup type &LOOKUP_TYPE.

Documentation on using TCA APIs - V2 Page 101

Page 103: TCAAPIEX

294005 HZ_API_LEAF_ONLY_NOT_ALLOWED One or more associations use the parent codes of &CLASS_CATEGORY class category.

96243 HZ_API_MISSING_COLUMN Column &COLUMN must have a value.

294009 HZ_API_MULTI_PARENT_FORBID The &CLASS_CODE3 class code cannot be a child of the &CLASS_CODE2 class code because the &CLASS_CATEGORY category does not allow multiple parents during a specific date range. The &CLASS_CODE2 class code is a child of the &CLASS_CODE1 class code in the &

294223 HZ_API_NEGATIVE_PROFILE_CLASS The profile class ID must be positive. Please enter a positive number for the profile class ID.

96246 HZ_API_NONUPDATEABLE_COLUMN User cannot update column &COLUMN.

96277 HZ_API_NONUPDATEABLE_TO_NULL User cannot update column &COLUMN to null.

294218 HZ_API_NO_DEFAULT_PROF_CLASS Cannot find the default customer profile class (profile class ID = 0). Please use a different profile class.

96247 HZ_API_NO_RECORD No &RECORD was found for ID &VALUE.

294221 HZ_API_OBSOLETE_COLUMN The &COLUMN column is obsolete. Users are not allowed to pass a value to this column.

Documentation on using TCA APIs - V2 Page 102

Page 104: TCAAPIEX

294249 HZ_API_ONE_NATIVE_PER_PARTY Each party can have only one native language. Please change any existing native language to non-native before making this the native language

96278 HZ_API_OTHERS_EXCEP The following SQL error occurred:

96271 HZ_API_PARTY_NUMBER_AUTO_ON User cannot pass the party number because the profile option HZ:Generate Party Number is either null or is set to Yes.

294222 HZ_API_PARTY_OBJECT_MISMATCH For a contact, the party ID of the party site must be the same as the object ID of the relationship. Please change either the party site or the object ID.

96272 HZ_API_PARTY_SITE_NUM_AUTO_ON Users cannot pass the party site number because the profile option HZ:Generate Party Site Number is either null or is set to Yes.

294250 HZ_API_PRIMARY_PER_ENTITY Each &ENTITY2 can have only one primary &ENTITY1. Please change any existing primary &ENTITY1 to non-primary before making this record primary

294229 HZ_API_PROF_AMT_IDS_MISMATCH The &ENTITY ID of the profile amount must be the same as the &ENTITY ID of the customer profile.

96245 HZ_API_RECORD_CHANGED This record in table &TABLE cannot be locked as it has been updated by another user.

96821 HZ_API_SIC_CODE_TYPE_OTHER This value for the column sic_code_type is allowed only if the column content_source_type has the value USER_ENTERED.

Documentation on using TCA APIs - V2 Page 103

Page 105: TCAAPIEX

96820 HZ_API_SIC_CODE_TYPE_REQUIRED Please set both the sic_code and sic_code_type columns if one of these columns already has a value.

294007 HZ_API_SIN_ASS_NOT_ALLOWED Users cannot have any records with more than one class code from the &CLASS_CATEGORY category during a specific date range. The &OWNER_TABLE_ID ID from the &OWNER_TABLE table from the &CONTENT_SOURCE_TYPE source has class codes &CLASS_CODE1 from &START1 to

294006 HZ_API_SIN_PAR_NOT_ALLOWED The &CLASS_CATEGORY category cannot update because the &CLASS_CODE3 class code in the &CLASS_CATEGORY category cannot have multiple parents during a specific date range. The &CLASS_CATEGORY category has parent class codes &CLASS_CODE1 from &START1 to &END

294251 HZ_API_SIZE_ERROR The size of the &COLUMN column cannot be more than &SIZE characters. Please pass a value of &SIZE or fewer characters.

96248 HZ_API_START_DATE_GREATER End date cannot be earlier than the start date.

96250 HZ_API_SUBJECT_OBJECT_IDS Subject ID and object ID cannot refer to the same party ID.

96965 HZ_API_UNIQUE_PRIMARY_ORG_CONT For this party, a primary contact is already defined for this type of role.

Documentation on using TCA APIs - V2 Page 104

Page 106: TCAAPIEX

96291 HZ_API_UNIQUE_PRIMARY_ROLE A Primary role is already defined for this org contact.

96292 HZ_API_UNIQUE_ROLE_TYPE A role of this type is already defined for this org contact.

96695 HZ_API_UNIQUE_SITE_USE_TYPE A site use of this type is already defined for this party site.

294014 HZ_API_USE_TAB_CAT There is no association between &OWNER_TABLE owner table and &CLASS_CATEGORY class category in HZ_CLASS_CATEGORY_USES. Please contact the applications administrator.

96815 HZ_COUNTRY_CODE_NOT_DEFINED User have passed a Raw Phone Number without a Country Code or the Country Code that does not exist.

294239 HZ_CP_REC_NOT_FOUND Updates to this field require that an update be made to a corresponding record in the HZ_CONTACT_PREFERENCES table. This field cannot be updated because no record in the HZ_CONTACT_PREFERENCES table corresponds to record (&PRIMARY_KEY= &ID) in the &SOURC

294230 HZ_CUST_ACCT_ROLE_PRIMARY A primary account role already exists for this &ENTITY. User cannot make this account role primary.

294233 HZ_INVALID_CONTACT_LEVEL_TABLE The contact level table for the &CONTACT_TYPE type of contact can not be &CONTACT_LEVEL_TABLE. Please assign a valid contact level table to the &CONTACT_TYPE type of contact.

Documentation on using TCA APIs - V2 Page 105

Page 107: TCAAPIEX

294232 HZ_INVALID_CONTACT_TYPE The &INCORRECT_CONTACT_TYPE contact type can not be assigned to the contact point of type &CONTACT_POINT_TYPE.

294065 HZ_INVALID_DIRECTION_CODE If the forward and backward relationship codes are the same, the direction code must be N which indicates a non-directional relationship.

294068 HZ_INVALID_DIRECTION_CODE1 If the forward relationship code and the backward relationship code are the same, then the direction code must be N (Non-directional).

294069 HZ_INVALID_DIRECTION_CODE2 If the forward relationship code and the backward relationship code are different, then the direction code must be either P (Parent) or C(Child).

96816 HZ_INVALID_PHONE_PARAMETER Either a Raw Phone Number or the Area Code and Phone Number should be passed.

294112 HZ_MULTIPLE_PREFERENCES User cannot pass multiple preference values. Please pass only one preference value from one of the VALUE_VARCHAR2

294238 HZ_NONUPDATEABLE_PREF_DATE Dates cannot be updated to a time earlier than the current date. Please enter a date after &SYS_DATE.

294113 HZ_NO_PREFERENCE User must pass at least one preference value. Please pass one preference value from one of the VALUE_VARCHAR2

294066 HZ_NO_REL_TYPE This relationship type is not valid for the given subject type and object type.

Documentation on using TCA APIs - V2 Page 106

Page 108: TCAAPIEX

96814 HZ_PHONE_FORMAT_NOT_DEFINED User have passed a Raw Phone Number and the Country Code. No Phone Format could be found. Please check the Phone Format setup.

294072 HZ_RELATIONSHIP_DATE_OVERLAP User cannot create a relationship for a time period that overlaps the time period of an existing relationship with the same subject id

294114 HZ_SINGLE_VALUE_PREFERENCE User cannot create multiple preference values for a single-value preference code.

294070 HZ_VALUES_NOT_SUPPORTED User cannot set the &FIELD to &VALUE. This option is not currently available.

Documentation on using TCA APIs - V2 Page 107

Page 109: TCAAPIEX

DOCUMENTATION ON USING TCA APIs – V2 May 2002 Author: Viswanathan Rajagopalan Contributing Authors: Oracle Corporation World Headquarters 500 Oracle Parkway Redwood Shores, CA 94065 U.S.A. Worldwide Inquiries: Phone: +1.650.506.7000 Fax: +1.650.506.7200 www.oracle.com Oracle is a registered trademark of Oracle Corporation. Various product and service names referenced herein may be trademarks of Oracle Corporation. All other product and service names mentioned may be trademarks of their respective owners. Copyright © 2002 Oracle Corporation All rights reserved.

Documentation on using TCA APIs - V2 Page 108