--Organizations (Parties) and Customers (Accounts) accordingly. TCA provides hz_org_cust_bo_pub API uses
--object types as parameters and is called Business Object(BO) API.
--Following is an example of how to create and update TCA party, customer, customer site etc
--Declare HZ_ORG_CUST_BO business object type variable to pass the customer payload:-
DECLARE
l_hz_org_cust_bo hz_org_cust_bo;
x_payload XMLTYPE;
l_organization_id NUMBER;
l_orig_system VARCHAR2 (20);
l_orig_system_ref VARCHAR2 (100);
l_return_status VARCHAR2 (4000);
l_msg_count NUMBER;
l_org_id NUMBER;
l_msg_data VARCHAR2 (4000);
v_enqueue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
v_Message_Properties DBMS_AQ.MESSAGE_PROPERTIES_T;
v_message_handle RAW (16);
BEGIN
-- Initialize to set the context
--fnd_global.apps_initialize(<user_id>, <resp_id>, <resp_appl_id>);
-- This select statement to derive party and child entity details in HZ_ORG_CUST_BO xmltype payload
SELECT hp.party_id, hor.orig_system, hor.orig_system_references
INTO l_organization_id, l_orig_system, l_orig_system_reference
FROM hz_orig_sys_references hor, hz_parties hp
WHERE hor.owner_table_name = 'HZ_PARTIES'
AND hp.party_id = hor.owner_table_id;
-- Call API to Create/Update Party/Customer details using Business Object as parameter
hz_org_cust_bo_pub.get_org_cust_bo (
p_init_msg_list => fnd_api.g_true,
p_organization_id => l_organization_id,
p_organization_os => l_orig_system,
p_organization_osr => l_orig_system_reference,
x_org_cust_obj => l_hz_org_cust_bo,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data);
COMMIT;
DBMS_OUTPUT.put_line ('x' || l_return_status);
DBMS_OUTPUT.put_line ('x' || l_msg_data || l_msg_count);
DBMS_OUTPUT.put_line ('l_organization_id: ' || l_organization_id);
x_payload:=l_hz_org_cust_bo;
--Print any error/s
IF l_msg_count > 1
THEN
FOR i IN 1 .. l_msg_count
LOOP
DBMS_OUTPUT.put_line (
i
|| '. '
|| SUBSTR (fnd_msg_pub.get (p_encoded => fnd_api.g_false), 1, 255));
END LOOP;
ELSE
--Create AQ using DBMS_AQ.ENQUEUE standard API
v_message_properties.correlation := G_MESSAGE_NUMBER;
v_message_properties.EXPIRATION := DBMS_AQ.NEVER;
DBMS_AQ.ENQUEUE (Queue_Name => 'XX_ORG_CUST_ACC_Q',
Enqueue_Options => V_Enqueue_Options,
Message_Properties => V_Message_Properties,
Payload => X_Payload,
Msgid => V_Message_Handle);
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLERRM);
END;
No comments:
Post a Comment