Thursday, December 12, 2013

VENDOR OR SUPPLIER UPDATE SCRIPT IN R12

ap_suppliers update script :


procedure update_api
is
l_msg_data                   varchar2 (20000);
l_return_status              varchar2 (100);
l_msg_count                  number;
l_party_id  number;
l_vendor_rec                 ap_vendor_pub_pkg.r_vendor_rec_type;
cursor c_ven_l
is
select vendor_id from ap_suppliers where last_updated_by='-1';
/*
select av.vendor_id, aa.group_id,av.segment1 from ap_awt_groups aa,xxmb_ven_stg_bk1 xvs,ap_suppliers av
where aa.name=xvs.awt_group_name
and xvs.awt_group_name is not null
and av.segment1=xvs.vendor_number
and error_code='processed';
*/
/*select av.vendor_id, aa.group_id,av.segment1 from ap_awt_groups aa,xxmb_ven_stg xvs,ap_suppliers av
where aa.name=xvs.awt_group_name
and xvs.awt_group_name is not null
and av.segment1=xvs.vendor_number
and error_code='processed';
*/

begin



for cv_ven_l in c_ven_l
loop
l_return_status := null;
l_msg_count := null;
l_msg_data := null;
--  l_vendor_id := null;

l_party_id := null;
l_vendor_rec := null;
--dbms_output.put_line('updating vendor  ' || cv_ven_l.segment1);
--dbms_output.put_line('updating vendor  ' || cv_ven_l.segment1);
--l_vendor_rec.segment1 := cv_ven_l.segment1;
l_vendor_rec.vendor_id := cv_ven_l.vendor_id;
--l_vendor_rec.awt_group_id :=cv_ven_l.group_id;
--l_vendor_rec.vendor_name := cv_ven_l.vendor_name;
--l_vendor_rec.start_date_active := sysdate;
fnd_global.apps_initialize(user_id => fnd_global.user_id,resp_id => fnd_global.resp_id,resp_appl_id => fnd_global.resp_appl_id);
fnd_msg_pub.initialize;
ap_vendor_pub_pkg.update_vendor (p_api_version      => 1.0,
p_init_msg_list    => 'f',
p_commit           => 'f',
x_return_status    => l_return_status,
p_validation_level     =>fnd_api.g_valid_level_full,
x_msg_count        => l_msg_count,
x_msg_data         => l_msg_data,
p_vendor_rec       => l_vendor_rec,
p_vendor_id        => cv_ven_l.vendor_id

);
dbms_output.put_line('cv_ven_l.vendor_id'||cv_ven_l.vendor_id);
dbms_output.put_line('l_msg_count'||l_msg_count);
dbms_output.put_line('l_msg_data'||l_msg_data);
dbms_output.put_line('l_return_status'||l_return_status);
commit;
end loop;
end update_api;


procedure update_main (
errbuf         out      varchar2,
retcode        out      varchar2
)
is
begin
update_api;
end update_main;

No comments:

Post a Comment