供应商默认发运地和开票地更新
最近在导采购订单时发现供应商发运地和开票地为空,发现是我们导入供应商时供应商发运地和开票地都需要默认,但是系统这个设置没有设好,导入时程序也没提供,所以这两个字段为空,导致导入采购订单时报错,所以我们就需要单独更新供应商的发运地和开票地点。
1.先模拟登陆看一下后台有没有设置默认发运地和开票地
模拟登陆
begin fnd_global.APPS_INITIALIZE(user_id =>1113 ,resp_id =>50638 ,resp_appl_id => 200); end;
查看后台有没有设置默认
SELECT ROWID, org_id, set_of_books_id, future_period_limit, accts_pay_code_combination_id, prepay_code_combination_id, future_dated_payment_ccid, disc_taken_code_combination_id, rate_var_gain_ccid, rate_var_loss_ccid, expense_clearing_ccid, misc_charge_ccid, retainage_code_combination_id, pay_date_basis_lookup_code, terms_date_basis, rfq_only_site_flag, ship_to_location_id, bill_to_location_id, fob_lookup_code, ship_via_lookup_code, inventory_organization_id, freight_terms_lookup_code, reserve_at_completion_flag, purch_encumbrance_flag, vat_country_code, vat_registration_num, req_encumbrance_flag, business_group_id, expense_check_address_flag, use_positions_flag, last_update_date, last_updated_by, last_update_login, creation_date, created_by, global_attribute_category, global_attribute20, global_attribute19, global_attribute18, global_attribute17, global_attribute16, global_attribute15, global_attribute14, global_attribute13, global_attribute12, global_attribute11, global_attribute10, global_attribute9, global_attribute8, global_attribute7, global_attribute6, global_attribute5, global_attribute4, global_attribute3, global_attribute2, global_attribute1 FROM financials_system_parameters;
如果没有,调用API更新
DECLARE l_location_rec hz_location_v2pub.location_rec_type; l_vendor_site_rec ap_vendor_pub_pkg.r_vendor_site_rec_type; l_msg_data VARCHAR2(2000); l_msg VARCHAR2(4000); l_msg_count NUMBER; o_return_status VARCHAR2(30); o_msg_data VARCHAR2(300); --循环所有供应商地点 CURSOR cur_vendor_site IS SELECT a.vendor_site_id, a.org_id FROM ap_supplier_sites_all a; --获取每个OU对应的默认收单和发运地 CURSOR cur_vendor_sys(p_org_id IN NUMBER) IS SELECT t.org_id, t.ship_to_location_id, t.bill_to_location_id FROM financials_system_parameters t WHERE t.org_id = p_org_id; BEGIN fnd_global.apps_initialize(user_id => 1113, resp_id => 50638, resp_appl_id => 200); FOR rec_vendor_site IN cur_vendor_site LOOP FOR rec_vendor_sys IN cur_vendor_sys(p_org_id => rec_vendor_site.org_id) LOOP l_vendor_site_rec.vendor_site_id := rec_vendor_site.vendor_site_id; l_vendor_site_rec.org_id := rec_vendor_site.org_id; l_vendor_site_rec.ship_to_location_id := rec_vendor_sys.ship_to_location_id; l_vendor_site_rec.bill_to_location_id := rec_vendor_sys.bill_to_location_id; pos_vendor_pub_pkg.update_vendor_site(x_return_status => o_return_status, x_msg_count => l_msg_count, x_msg_data => l_msg_data, p_vendor_site_rec => l_vendor_site_rec); IF o_return_status <> fnd_api.g_ret_sts_success THEN IF l_msg_data IS NULL THEN l_msg_data := fnd_msg_pub.get(p_msg_index => fnd_msg_pub.g_last, p_encoded => 'F'); dbms_output.put_line('----' || l_msg_data); END IF; -- o_msg_data := l_msg_data; END IF; END LOOP; --for rec_vendor_sys in cur_vendor_sys (p_org_id => REC_VENDOR_SITE.ORG_ID) loop END LOOP; --FOR REC_VENDOR_SITE IN CUR_VENDOR_SITE LOOP END;