Tuesday, September 28, 2010

Calling an API

An R12 customer wanted to update supplier contact email addresses so i found an API and needed to call it. Below is the written code for this customers need:

create or replace procedure apps.xxxt_vendor_email_update
is
l_vendor_site_id number;
l_commit varchar2(4000) := FND_API.G_TRUE;
l_validation_level number := FND_API.G_VALID_LEVEL_FULL;
x_return_status varchar2(4000);
x_msg_count number;
x_msg_data varchar2(4000);
cursor c_import
is
select *
from xxxt_tedarikci_mail
where 1=1
-- and tedarikci_no='11316';
begin
for r_import in c_import
loop
if (r_import.vendor_name!='ASDF')
then
begin
select vendor_site_id--, aps.vendor_name, vendor_site_code, aps.segment1, aps.vendor_id
into l_vendor_site_id
from ap.ap_suppliers aps , ap.ap_supplier_sites_all apss, xxxt_tedarikci_mail xtm
where aps.vendor_id=apss.vendor_id
and aps.segment1=xtm.tedarikci_no
and xtm.tedarikci_no = r_import.tedarikci_no
and apss.org_id=83
--and aps.vendor_id!=179005;
exception when others then
update xxxt_tedarikci_mail
set error_message = r_import.tedarikci_no
where tedarikci_no=r_import.tedarikci_no;
end;
else
begin
select apss.vendor_site_id
into l_vendor_site_id
from xxxt_tedarikci_mail xtm , ap.ap_supplier_sites_all apss
where 1=1
and APSS.VENDOR_SITE_CODE = xtm.vendor_site_code
and xtm.vendor_site_code=r_import.vendor_site_code
and XTM.E_MAIL is not null
and apss.org_id=83;
exception when others then
update xxxt_tedarikci_mail
set error_message = r_import.tedarikci_no
where tedarikci_no=r_import.tedarikci_no;
end;
end if;
AP_VENDOR_PUB_PKG_w.update_vendor_site(
p_api_version => 1.0
, p_init_msg_list => fnd_api.g_false
, p_commit => fnd_api.g_true
, p_validation_level => l_validation_level
, x_return_status => x_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data
, p7_a0 => null
, p7_a1 => null
, .
, .
, p7_a94 => r_import.e_mail
, .
, .
, p7_a154 => null
, p_vendor_site_id => l_vendor_site_id
);
end loop;
end;

No comments:

Post a Comment