Introduction
This Post illustrates the steps required to Update a Customer Account TCA in Oracle EBS R12.
Script to Update a Customer Account API TCA R12
DECLARE
p_cust_account_rec hz_cust_account_v2pub.cust_account_rec_type;
p_object_version_number NUMBER;
x_return_status VARCHAR2 (2000);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (2000);
BEGIN
— Setting the Context —
mo_global.init (‘AR’);
fnd_global.apps_initialize (user_id => 1318,
resp_id => 50559,
resp_appl_id => 222
);
mo_global.set_policy_context (‘S’, 204);
fnd_global.set_nls_context (‘AMERICAN’);
— Initializing the Mandatory API parameters
p_cust_account_rec.cust_account_id := 150734;
p_cust_account_rec.customer_type := ‘R’;
— Should be available under the lookup_type “CUSTOMER_TYPE”
p_cust_account_rec.account_name := ‘TCA – Account’;
p_object_version_number := 1;
DBMS_OUTPUT.put_line
(‘Calling the API hz_cust_account_v2pub.update_cust_account’);
hz_cust_account_v2pub.update_cust_account
(p_init_msg_list => fnd_api.g_true,
p_cust_account_rec => p_cust_account_rec,
p_object_version_number => p_object_version_number,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data
);
IF x_return_status = fnd_api.g_ret_sts_success
THEN
COMMIT;
DBMS_OUTPUT.put_line (‘Updation of Customer Account is Successful ‘);
DBMS_OUTPUT.put_line (‘Output information ….’);
DBMS_OUTPUT.put_line ( ‘Object Version Number =’
|| p_object_version_number
);
ELSE
DBMS_OUTPUT.put_line ( ‘Updation of Customer Account got failed:’
|| x_msg_data
);
ROLLBACK;
FOR i IN 1 .. x_msg_count
LOOP
x_msg_data := fnd_msg_pub.get (p_msg_index => i, p_encoded => ‘F’);
DBMS_OUTPUT.put_line (i || ‘) ‘ || x_msg_data);
END LOOP;
END IF;
DBMS_OUTPUT.put_line (‘Completion of API’);
END;
What we expect in the script.
This script helps us to comprehend how Update a Customer Account TCA into oracle through API. It also demonstrates the required validation taking place, and additional validation can be incorporated anytime in your package based on business requirements. Post validation correct records are being passed into APIs. Couple of APIs which is being used in the scripts are HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCOUNT etc.
Summary
This Post described the script update a Customer Account TCA into oracle through API in Oracle EBS R12.
Got any queries?
Do drop a note by writing us at doyen.ebiz@gmail.com or use the comment section below to ask your questions.