DECLARE
p_api_version NUMBER;
p_init_msg_list VARCHAR2 (200);
p_commit VARCHAR2 (200);
p_validate_only VARCHAR2 (200);
p_validation_level NUMBER;
p_calling_module VARCHAR2 (200);
p_debug_mode VARCHAR2 (200);
p_max_msg_count NUMBER;
p_project_id NUMBER;
p_customer_id NUMBER;
p_bill_ship_customer_id NUMBER;
p_contact_id NUMBER;
p_contact_name VARCHAR2 (200);
p_project_contact_type_code VARCHAR2 (200);
p_project_contact_type_name VARCHAR2 (200);
x_return_status VARCHAR2 (200);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (200);
CURSOR c1
IS
SELECT ppa.project_id, ppcust.customer_id, ppa.project_type, ppcust.bill_to_customer_id, acv.contact_id,
acv.contact_name names
FROM pa_project_customers_v ppcust, pa_projects_all ppa, pa_customer_contact_names_v acv
WHERE 1 = 1
AND ppcust.project_id = ppa.project_id
AND acv.customer_id = ppcust.customer_id
AND (SELECT COUNT (contact_id)
FROM pa_customer_contact_names_v ppcn
WHERE ppcn.customer_id = ppcust.customer_id) = 1
AND NOT EXISTS (SELECT ppco.contact_id
FROM pa_project_contacts ppco
WHERE ppco.project_id = ppa.project_id);
BEGIN
-- fnd_global.apps_initialize (0,0 ,0);
mo_global.init ('AR');
FOR i IN c1
LOOP
BEGIN
p_api_version := 1.0;
p_init_msg_list := NULL;
p_commit := 'FND_API.G_FALSE';
p_validate_only := 'FND_API.G_TRUE';
p_validation_level := fnd_api.g_valid_level_full;
p_calling_module := 'SELF_SERVICE';
p_debug_mode := 'N';
p_max_msg_count := fnd_api.g_miss_num;
p_project_id := i.project_id;
p_customer_id := i.customer_id;
p_bill_ship_customer_id := i.bill_to_customer_id;
p_contact_id := i.contact_id;
p_contact_name := i.names;
p_project_contact_type_code := 'BILLING';
x_return_status := NULL;
x_msg_count := NULL;
x_msg_data := NULL;
apps.pa_customers_contacts_pub.create_customer_contact (p_api_version,
p_init_msg_list,
p_commit,
p_validate_only,
p_validation_level,
p_calling_module,
p_debug_mode,
p_max_msg_count,
p_project_id,
p_customer_id,
p_bill_ship_customer_id,
p_contact_id,
p_contact_name,
p_project_contact_type_code,
p_project_contact_type_name,
x_return_status,
x_msg_count,
x_msg_data
);
DBMS_OUTPUT.put_line ( 'Project ID :- '
|| p_project_id
|| ' x_return_status :- '
|| x_return_status
|| ' x_msg_count :- '
|| x_msg_count
|| ' x_msg_data :- '
|| x_msg_data
);
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ( 'Error : Project ID :- '
|| p_project_id
|| ' x_return_status :- '
|| x_return_status
|| ' x_msg_count :- '
|| x_msg_count
|| ' x_msg_data :- '
|| x_msg_data
);
END;
END LOOP;
END;
No comments:
Post a Comment