------------------------------------
-- 1A. setup the org_id
------------------------------------
Exec dbms_application_info.set_client_info ('20140901 ');
------------------------------------
-- 1B. Show the output variables
------------------------------------
Set serveroutput on
------------------------------------
-- 2a. Create a party and an account
------------------------------------
Declare
P_cust_account_rec hz_cust_account_v2pub.cust_account_rec_type;
P_organization_rec hz_party_v2pub.organization_rec_type;
P_customer_profile_rec
Hz_customer_profile_v2pub.customer_profile_rec_type;
X_cust_account_id number;
X_account_number varchar2 (2000 );
X_party_id number;
X_party_number varchar2 (2000 );
X_profile_id number;
X_return_status varchar2 (2000 );
X_msg_count number;
X_msg_data varchar2 (2000 );
P_create_profile_amt varchar2 (2000 );
Begin
-- Record for the Account
P_cust_account_rec.account_name: = 'fennerprofapiamtc002 ';
P_cust_account_rec.created_by_module: = 'tcapi _ example ';
-- P_cust_account_rec.orig_system_reference: = '001 _ 001'; -- is not mandatory
-- Record for the Organization
P_organization_rec.organization_name: = 'fennerprofapiamtc002 ';
P_organization_rec.created_by_module: = 'tcapi _ example ';
-- Record for the profile (this will use he default profile but change these fields)
P_customer_profile_rec.credit_checking: = 'y ';
P_customer_profile_rec.interest_charges: = 'n ';
-- As interest charges is N, you need to set this two values in null
P_customer_profile_rec.charge_on_finance_charge_flag: = fnd_api.g_miss_char;
P_customer_profile_rec.interest_period_days: = fnd_api.g_miss_num;
P_customer_profile_rec.created_by_module: = 'tcapi _ example ';
-- Record for the profile amounts
-- You are not able to assign values for the amounts in this API
-- As you want to create specific values for the amounts set the field in 'F'
-- You will insertthe information later
P_create_profile_amt: = 'F ';
Hz_cust_account_v2pub.create_cust_account (
'T ',
P_cust_account_rec,
P_organization_rec,
P_customer_profile_rec,
P_create_profile_amt,
X_cust_account_id,
X_account_number,
X_party_id,
X_party_number,
X_profile_id,
X_return_status,
X_msg_count,
X_msg_data );
Dbms_output.put_line ('***************************');
Dbms_output.put_line ('output information ....');
Dbms_output.put_line ('x _ cust_account_id: '| x_cust_account_id );
Dbms_output.put_line ('x _ account_number: '| x_account_number );
Dbms_output.put_line ('x _ party_id: '| x_party_id );
Dbms_output.put_line ('x _ party_number: '| x_party_number );
Dbms_output.put_line ('x _ profile_id: '| x_profile_id );
Dbms_output.put_line ('x _ return_status: '| x_return_status );
Dbms_output.put_line ('x _ msg_count: '| x_msg_count );
Dbms_output.put_line ('x _ msg_data: '| x_msg_data );
Dbms_output.put_line ('***************************');
End;
/
***************************
Output information ....
X_cust_account_id: 7744
X_account_number: 3991
X_party_id: 19566
X_party_number: 16479
X_profile_id: 8679
X_return_status: S
X_msg_count: 0
X_msg_data:
***************************
------------------------------------
-- 2B. Create the profile amounts record
------------------------------------
Declare
P_cpamt_rec hz_customer_profile_v2pub.cust_profile_amt_rec_type;
V_cust_account_profile_id number;
X_return_status varchar2 (2000 );
X_msg_count number;
X_msg_data varchar2 (2000 );
X_cust_acct_profile_amt_id number;
Begin
Select cust_account_profile_id into v_cust_account_profile_id
From hz_customer_profiles where cust_account_id = 7744; -- <value for cust_account_id from Step 2a
P_cpamt_rec.cust_account_profile_id: = v_cust_account_profile_id;
P_cpamt_rec.currency_code: = 'usd'; -- <currency code
P_cpamt_rec.created_by_module: = 'tcapi _ example ';
P_cpamt_rec.overall_credit_limit: = 1000000;
P_cpamt_rec.cust_account_id: = 7744; -- <value for cust_account_id from Step 2a
Hz_customer_profile_v2pub.create_cust_profile_amt (
'T ',
'T ',
P_cpamt_rec,
X_cust_acct_profile_amt_id,
X_return_status,
X_msg_count,
X_msg_data
);
Dbms_output.put_line ('***************************');
Dbms_output.put_line ('output information ....');
Dbms_output.put_line ('<x_cust_acct_profile_amt_id:' | x_cust_acct_profile_amt_id );
Dbms_output.put_line ('x _ return_status: '| x_return_status );
Dbms_output.put_line ('x _ msg_count: '| x_msg_count );
Dbms_output.put_line ('x _ msg_data: '| x_msg_data );
Dbms_output.put_line ('***************************');
End;
/
***************************
Output information ....
<X_cust_acct_profile_amt_id: 14883
X_return_status: S
X_msg_count: 0
X_msg_data:
***************************
/* Begin address */
------------------------------------
-- 3. Create a physical location
------------------------------------
Declare
P_location_rec hz_location_v2pub.location_rec_type;
X_location_id number;
X_return_status varchar2 (2000 );
X_msg_count number;
X_msg_data varchar2 (2000 );
Begin
P_location_rec.country: = 'us ';
P_location_rec.address1: = 'fennerprofapiamtc002 ';
P_location_rec.city: = 'san Mateo ';
P_location_rec.postal_code: = '201312 ';
P_location_rec.state: = 'CA ';
P_location_rec.created_by_module: = 'tcapi _ example ';
Hz_location_v2pub.create_location (
'T ',
P_location_rec,
X_location_id,
X_return_status,
X_msg_count,
X_msg_data );
Dbms_output.put_line ('***************************');
Dbms_output.put_line ('output information ....');
Dbms_output.put_line ('x _ location_id: '| x_location_id );
Dbms_output.put_line ('x _ return_status: '| x_return_status );
Dbms_output.put_line ('x _ msg_count: '| x_msg_count );
Dbms_output.put_line ('x _ msg_data: '| x_msg_data );
Dbms_output.put_line ('***************************');
End;
/
***************************
Output information ....
X_location_id: 15538
X_return_status: S
X_msg_count: 0
X_msg_data:
***************************
------------------------------------
-- 4. Create a party site using party_id from Step 2a and location_id from step 3
------------------------------------
Declare
P_party_site_rec hz_party_site_v2pub.party_site_rec_type;
X_party_site_id number;
X_party_site_number varchar2 (2000 );
X_return_status varchar2 (2000 );
X_msg_count number;
X_msg_data varchar2 (2000 );
Begin
P_party_site_rec.party_id: = 19566; -- <value for party_id from Step 2a>
P_party_site_rec.location_id: = 15538; -- <value for location_id from step 3>
P_party_site_rec.identifying_address_flag: = 'y ';
P_party_site_rec.created_by_module: = 'tcapi _ example ';
Hz_party_site_v2pub.create_party_site (
'T ',
P_party_site_rec,
X_party_site_id,
X_party_site_number,
X_return_status,
X_msg_count,
X_msg_data );
Dbms_output.put_line ('***************************');
Dbms_output.put_line ('output information ....');
Dbms_output.put_line ('x _ party_site_id: '| x_party_site_id );
Dbms_output.put_line ('x _ party_site_number: '| x_party_site_number );
Dbms_output.put_line ('x _ return_status: '| x_return_status );
Dbms_output.put_line ('x _ msg_count: '| x_msg_count );
Dbms_output.put_line ('x _ msg_data: '| x_msg_data );
Dbms_output.put_line ('***************************');
End;
/
***************************
Output information ....
X_party_site_id: 10710
X_party_site_number: 8437
X_return_status: S
X_msg_count: 0
X_msg_data:
***************************
------------------------------------
-- 5. Create an account site using cust_account_id from Step 2a and party_site_id from step 4.
------------------------------------
Declare
P_cust_acct_site_rec hz_cust_account_site_v2pub.cust_acct_site_rec_type;
X_return_status varchar2 (2000 );
X_msg_count number;
X_msg_data varchar2 (2000 );
X_cust_acct_site_id number;
Begin
P_cust_acct_site_rec.cust_account_id: = 7744; -- <value for cust_account_id you get from Step 2a>
P_cust_acct_site_rec.party_site_id: = 10710; -- <value for party_site_id from step 4>
P_cust_acct_site_rec.language: = 'us ';
P_cust_acct_site_rec.created_by_module: = 'tcapi _ example ';
Hz_cust_account_site_v2pub.create_cust_acct_site (
'T ',
P_cust_acct_site_rec,
X_cust_acct_site_id,
X_return_status,
X_msg_count,
X_msg_data );
Dbms_output.put_line ('***************************');
Dbms_output.put_line ('output information ....');
Dbms_output.put_line ('x _ cust_acct_site_id: '| x_cust_acct_site_id );
Dbms_output.put_line ('x _ return_status: '| x_return_status );
Dbms_output.put_line ('x _ msg_count: '| x_msg_count );
Dbms_output.put_line ('x _ msg_data: '| x_msg_data );
Dbms_output.put_line ('***************************');
End;
/
***************************
Output information ....
X_cust_acct_site_id: 7261
X_return_status: S
X_msg_count: 0
X_msg_data:
***************************
------------------------------------
-- 6. Create an account site use using cust_acct_site_id from Step 5 and site_use_code = 'bill _'
------------------------------------
Declare
P_cust_site_use_rec hz_cust_account_site_v2pub.cust_site_use_rec_type;
P_customer_profile_rec hz_customer_profile_v2pub.customer_profile_rec_type;
X_site_use_id number;
X_return_status varchar2 (2000 );
X_msg_count number;
X_msg_data varchar2 (2000 );
Begin
P_cust_site_use_rec.cust_acct_site_id: = 7261; -- <value for cust_acct_site_id from Step 5>
P_cust_site_use_rec.site_use_code: = 'bill _ ';
P_cust_site_use_rec.created_by_module: = 'tcapi _ example ';
Hz_cust_account_site_v2pub.create_cust_site_use (
'T ',
P_cust_site_use_rec,
P_customer_profile_rec,
'',
'',
X_site_use_id,
X_return_status,
X_msg_count,
X_msg_data );
Dbms_output.put_line ('***************************');
Dbms_output.put_line ('output information ....');
Dbms_output.put_line ('x _ site_use_id: '| x_site_use_id );
Dbms_output.put_line ('x _ return_status: '| x_return_status );
Dbms_output.put_line ('x _ msg_count: '| x_msg_count );
Dbms_output.put_line ('x _ msg_data: '| x_msg_count );
Dbms_output.put_line ('***************************');
End;
/
***************************
Output information ....
X_site_use_id: 8943
X_return_status: S
X_msg_count: 0
X_msg_data: 0
***************************
/* End address */
Commit;
Detailed description of import of the customer configuration file of the EBS interface (2)