供應商默認發運地和開票地更新

最近在導採購訂單時發現供應商發運地和開票地爲空,發現是咱們導入供應商時供應商發運地和開票地都須要默認,可是系統這個設置沒有設好,導入時程序也沒提供,因此這兩個字段爲空,致使導入採購訂單時報錯,因此咱們就須要單獨更新供應商的發運地和開票地點。html

1.先模擬登錄看一下後臺有沒有設置默認發運地和開票地api

模擬登錄app

begin
fnd_global.APPS_INITIALIZE(user_id =>1113 ,resp_id =>50638 ,resp_appl_id => 200);
end;

查看後臺有沒有設置默認oop

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更新code

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;
相關文章
相關標籤/搜索