--Query to find Supplier Contact Directory in Oracle APPS R12
SELECT ASS.vendor_name,hpc.party_name Contact_Name,
hpc.person_first_name,
person_last_name,
HCP_PHONE.phone_area_code
||HCP_PHONE.phone_number,
HCP_EMAIL.email_address,
(SELECT asco.vendor_contact_id
FROM hz_org_contacts hoc,
ap_supplier_contacts asco
WHERE asco.relationship_id = hoc.party_relationship_id
AND hoc.party_relationship_id = hr.relationship_id)
vendor_contact_id,
(SELECT Listagg(DISTINCT assa.vendor_site_id, ',')
within GROUP (ORDER BY NULL)
FROM hz_org_contacts hoc,
ap_supplier_contacts asco,
ap_supplier_sites_all assa
WHERE asco.relationship_id = hoc.party_relationship_id
AND hoc.party_relationship_id = hr.relationship_id
AND assa.party_site_id = asco.org_party_site_id)
vendor_site_id
FROM hz_relationships HR,
hz_contact_points HCP_PHONE,
hz_contact_points HCP_EMAIL,
ap_suppliers ASS,
hz_parties hpc
WHERE 1 = 1
AND hr.object_id = hpc.party_id
AND HR.subject_type = 'ORGANIZATION'
AND HR.relationship_code = 'CONTACT'
AND HR.status = 'A'
AND HR.subject_id = ASS.party_id
AND HCP_PHONE.owner_table_name = 'HZ_PARTIES'
AND HCP_PHONE.owner_table_id = HR.party_id
AND HCP_PHONE.primary_flag = 'Y'
AND HCP_PHONE.status = 'A'
AND HCP_PHONE.contact_point_type = 'PHONE'
AND HCP_PHONE.phone_line_type = 'GEN'
AND HCP_EMAIL.owner_table_name = 'HZ_PARTIES'
AND HCP_EMAIL.owner_table_id = HR.party_id
AND HCP_EMAIL.primary_flag = 'Y'
AND HCP_EMAIL.status = 'A'
AND HCP_EMAIL.contact_point_type = 'EMAIL'
--AND ASS.VENDOR_NAME=:VENDOR_NAME
AND ass.vendor_id = 3879810;
--API to update supplier Contact Directory in Oracle APPS R12
DECLARE
lc_return_status VARCHAR2(2000);
ln_msg_count NUMBER;
ll_msg_data LONG;
ln_vendor_id NUMBER;
ln_vendor_site_id NUMBER;
ln_message_int NUMBER;
ln_party_id NUMBER;
lrec_vendor_contact_rec ap_vendor_pub_pkg.r_vendor_contact_rec_type;
BEGIN
lrec_vendor_contact_rec.vendor_id := 3879810;
--lrec_vendor_contact_rec.vendor_site_id := 196148;
lrec_vendor_contact_rec.vendor_contact_id := 2478320;
lrec_vendor_contact_rec.person_first_name := 'ABHISHEK'; --Make sure "HZ: Change Party Name" profile option is set to Yes for given USER
lrec_vendor_contact_rec.person_last_name := 'BAJPAI';
--lrec_vendor_contact_rec.person_title := 'Senior Manager';
--lrec_vendor_contact_rec.department := 'Sales';
--lrec_vendor_contact_rec.per_party_id := 301789;
--lrec_vendor_contact_rec.RELATIONSHIP_ID := 118326;
--lrec_vendor_contact_rec.REL_PARTY_ID := 302311;
--lrec_vendor_contact_rec.PARTY_SITE_ID := 175754;
--lrec_vendor_contact_rec.ORG_CONTACT_ID := 117364;
--lrec_vendor_contact_rec.ORG_PARTY_SITE_ID := 174989;
--lrec_vendor_contact_rec.area_code := 4040;
--lrec_vendor_contact_rec.phone := 696-1256-10;
--lrec_vendor_contact_rec.alt_area_code := 505;
--lrec_vendor_contact_rec.alt_phone := 145-678-430;
--lrec_vendor_contact_rec.fax_phone := 1234567;
--lrec_vendor_contact_rec.email_address := 'dummy@email.com';
--lrec_vendor_contact_rec.url := 'http://dummy.com';
fnd_global.Apps_initialize (0, 52088, 201);
mo_global.Init ('S');
ap_vendor_pub_pkg.Update_vendor_contact_public (p_api_version => 1,
p_validation_level => fnd_api.g_valid_level_full,
x_return_status => lc_return_status, x_msg_count => ln_msg_count,
x_msg_data => ll_msg_data, p_vendor_contact_rec => lrec_vendor_contact_rec);
COMMIT;
IF ( lc_return_status <> 'S' ) THEN
IF ln_msg_count >= 1 THEN
FOR v_index IN 1..ln_msg_count LOOP
fnd_msg_pub.Get (p_msg_index => v_index, p_encoded => 'F',
p_data => ll_msg_data
, p_msg_index_out => ln_message_int);
ll_msg_data := 'UPDATE_VENDOR_CONTACT_PUBLIC '
||Substr(ll_msg_data, 1, 3900);
dbms_output.Put_line('Ll_Msg_Data - '
||ll_msg_data);
END LOOP;
END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN
dbms_output.Put_line('SQLERRM - '
||SQLERRM);
END;
No comments:
Post a Comment