Professional Documents
Culture Documents
Using Tca Apis Including Examples - V2: An Oracle White Paper May 2002
Using Tca Apis Including Examples - V2: An Oracle White Paper May 2002
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.
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
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.
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
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_.
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') ;
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');
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.
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
Location API
· Create Location API
· Update Location 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
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
)
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
)
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.
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
)
x_return_status = S
x_msg_count = 0
Subject Id=1006
Subject Type=ORGANIZATION
Object Id=3610
Object Type=PERSON
x_msg_data =
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
)
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
)
x_return_status = S
x_msg_count = 0
Changed Address1 = 4th Floor Cyber Gateway
x_msg_data =
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
)
x_return_status = S
x_msg_count = 0
Party Site Id = 3615
Party Site Number = 2248
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>');
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
Mandatory Parameters :
Parameter Name Parameter Type Data Type
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
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
)
x_return_status = S
x_msg_count = 0
Relationship Id =1024
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,
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
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
)
x_return_status = S
x_msg_count = 0
Class Category = ACCOUNT_CLASSES
Allow Multi Parent Flag = Y
x_msg_data =
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
)
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 =
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
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.
x_return_status = S
x_msg_count = 0
Party Id = 4113
Party Number = 2457
Profile Id = 2266
x_msg_data =
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
)
dbms_output.put_line(I||'.'||SUBSTR(FND_MSG_PUB.Get(p_encoded=>
FND_API.G_FALSE ), 1, 255));
END LOOP;
END IF;
END;
x_return_status = S
x_msg_count = 0
Object Version Number =2
x_msg_data =
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>');
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;
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.
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
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
)
x_return_status = S
Cust Account Id = 1307
Cust Account Profile Id = 4425
Status =
Credit Checking =
Interest Charges =
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
)
x_return_status = S
Object Version Number = 2
Credit Rating = Poor
x_msg_count = 0
x_msg_data =
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
)
x_return_status = S
Location Id = 5624
Created By Moudle = TCA_Example
x_msg_count = 0
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