码迷,mamicode.com
首页 > 其他好文 > 详细

供应商地点信息更新

时间:2014-11-09 14:00:33      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:blog   io   ar   sp   for   on   2014   log   line   

例:更新供应商地点可采购flag
DECLARE
   l_api_version CONSTANT NUMBER := 1;
   l_msg_data        VARCHAR2(2000);
   l_msg             VARCHAR2(4000);
   l_msg_count       NUMBER;
   l_return_status   VARCHAR2(1);
   l_method_code     VARCHAR2(50);
   l_vendor_site_rec ap_vendor_pub_pkg.r_vendor_site_rec_type;
   CURSOR cur_vendor IS
      SELECT vendor.vendor_id,
             vendor_site.vendor_site_id,
             vendor_site.org_id
        FROM ap_suppliers vendor, ap_supplier_sites_all vendor_site
       WHERE vendor.vendor_id = vendor_site.vendor_id
         AND vendor.vendor_type_lookup_code = 'EMPLOYEE';

BEGIN
   fnd_global.apps_initialize(user_id      => 1170,
                              resp_id      => 50717,
                              resp_appl_id => 20005);
   --mo_global.set_policy_context(p_access_mode => 'S', p_org_id => 83);
   --fnd_profile.PUT(NAME =>'MFG_ORGANIZATION_ID' ,VAL => 83);
   FOR rec_vendor IN cur_vendor LOOP
      mo_global.set_policy_context(p_access_mode => 'S',
                                   p_org_id      => rec_vendor.org_id);
      l_vendor_site_rec.purchasing_site_flag := 'N';
      l_vendor_site_rec.vendor_id            := rec_vendor.vendor_id;
      l_vendor_site_rec.vendor_site_id       := rec_vendor.vendor_site_id;
      BEGIN
         ap_vendor_pub_pkg.update_vendor_site(p_api_version      => l_api_version,
                                              p_init_msg_list    => fnd_api.g_false,
                                              p_commit           => fnd_api.g_false,
                                              p_validation_level => fnd_api.g_valid_level_full,
                                              x_return_status    => l_return_status,
                                              x_msg_count        => l_msg_count,
                                              x_msg_data         => l_msg_data,
                                              p_vendor_site_rec  => l_vendor_site_rec,
                                              p_vendor_site_id   => rec_vendor.vendor_site_id,
                                              p_calling_prog     => 'NOT ISETUP');
      
      EXCEPTION
         WHEN OTHERS THEN
            dbms_output.put_line('ERROR:' || SQLERRM);
      END;
      --COMMIT;
      --dbms_output.put_line('o_return_status:'||o_return_status);
      IF l_return_status <> fnd_api.g_ret_sts_success THEN
      
         FOR i IN 1 .. l_msg_count LOOP
            l_msg_data := fnd_msg_pub.get(p_msg_index => i,
                                          p_encoded   => 'F');
            dbms_output.put_line('l_msg_data:' || l_msg_data);
         END LOOP; --FOR i IN 1 .. x_msg_count LOOP    
         dbms_output.put_line('x_return_status:' || l_return_status);
      
         dbms_output.put_line('l_msg_data:' || l_msg_data);
         RAISE fnd_api.g_exc_unexpected_error;
         -- o_msg_data := l_msg_data;
      
      ELSE
         NULL;
         --dbms_output.put_line('S');
      END IF;
   
   END LOOP; -- FOR REC_VENDOR IN cur_vendor LOOP
END;

供应商地点信息更新

标签:blog   io   ar   sp   for   on   2014   log   line   

原文地址:http://blog.csdn.net/cai_xingyun/article/details/40948985

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!