供应商地点信息更新

例:更新供应商地点可采购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;

转载于:https://www.cnblogs.com/wanghang/p/6299135.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值