|
|
发表于 2012/10/15 16:26:08
|
显示全部楼层
银行信息导入,分几种情况,比较常用的就是供应商层银行信息,和地点层银行信息;
1、导入供应商层银行信息比较简单:
v_bank_tbl iby_temp_ext_bank_accts%ROWTYPE;
SELECT iby_temp_ext_bank_accts_s.nextval
INTO v_temp_ext_bank_acct_id
FROM dual;
必须信息是:
v_bank_tbl.temp_ext_bank_acct_id := v_temp_ext_bank_acct_id;
v_bank_tbl.country_code := rec_suppliers.country_code; --国家
v_bank_tbl.bank_account_num := rec_suppliers.bank_account_num; --银行帐户号
v_bank_tbl.object_version_number := 1;
v_bank_tbl.status := 'NEW';
直接INSERT INTO iby.iby_temp_ext_bank_accts VALUES v_bank_tbl;
2、导入供应地点层,无法直接导入,需要在导入供应商层的情况下,有一个标准的过程可以调用,进行分配
--assign_site_bank_account,将供应商层的银行帐户分配到地点层
PROCEDURE assign_site_bank_account IS
rec_payee iby_disbursement_setup_pub.payeecontext_rec_type;
rec_assignment_attribs iby_fndcpt_setup_pub.pmtinstrassignment_rec_type;
l_return_status VARCHAR2(100);
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
l_assign_id NUMBER;
l_response iby_fndcpt_common_pub.result_rec_type;
CURSOR cur_temp IS
SELECT ieba.bank_account_num
,ieba.ext_bank_account_id
,apss.vendor_site_id
,apss.party_site_id
,apss.org_id
,aps.vendor_id
,aps.party_id
FROM ap.ap_suppliers aps
,iby_account_owners iao
,iby_ext_bank_accounts ieba
,ap.ap_supplier_sites_all apss
WHERE aps.party_id = iao.account_owner_party_id
AND iao.ext_bank_account_id = ieba.ext_bank_account_id
AND apss.vendor_id = aps.vendor_id
AND EXISTS
(SELECT 1
FROM cux_vendor_import_temp temp
WHERE nvl2(temp.vendor_name, temp.vendor_name, temp.segment1) =
nvl2(temp.vendor_name, aps.vendor_name, aps.segment1)
AND temp.import_flag = 'Y'
AND temp.bank_account_assignment_level = 'SITE');--具体过滤条件看你临时表怎么设计!
BEGIN
FOR rec_temp IN cur_temp LOOP
rec_assignment_attribs.instrument.instrument_type := 'BANKACCOUNT';
rec_assignment_attribs.instrument.instrument_id := rec_temp.ext_bank_account_id; --<external bank account id returned after creating the bank account>
rec_payee.party_id := rec_temp.party_id; --<account owner party id>
rec_payee.payment_function := 'PAYABLES_DISB';
rec_payee.party_site_id := rec_temp.party_site_id;
rec_payee.supplier_site_id := rec_temp.vendor_site_id;
rec_payee.org_id := rec_temp.org_id;
rec_payee.org_type := 'OPERATING_UNIT';
--p_api_version IN NUMBER,
--p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
--p_commit IN VARCHAR2 := FND_API.G_TRUE,
--x_return_status OUT NOCOPY VARCHAR2,
--x_msg_count OUT NOCOPY NUMBER,
--x_msg_data OUT NOCOPY VARCHAR2,
--p_payee IN PayeeContext_rec_type,
--p_assignment_attribs IN IBY_FNDCPT_SETUP_PUB.PmtInstrAssignment_rec_type,
--x_assign_id OUT NOCOPY NUMBER,
--x_response OUT NOCOPY IBY_FNDCPT_COMMON_PUB.Result_rec_type
iby_disbursement_setup_pub.set_payee_instr_assignment(p_api_version => 1.0,
p_init_msg_list => fnd_api.g_false,
p_commit => fnd_api.g_true,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_payee => rec_payee,
p_assignment_attribs => rec_assignment_attribs,
x_assign_id => l_assign_id,
x_response => l_response);
COMMIT;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Exception at assign_site_bank_account:' ||
SQLERRM);
ROLLBACK;
END assign_site_bank_account;
|
|