1.将发票头插入ap_invoices_interface中
2.将发票行插入ap_invoice_lines_interface中
3.运行发票导入请求 APXIIMPT
具体示例:
1.往接口表中插入数据
DECLARE
l_iface_rec ap_invoices_interface%ROWTYPE;
l_iface_lines_rec ap_invoice_lines_interface%ROWTYPE;
TYPE l_invoice_tbl_type IS TABLE OF cur_invoice%ROWTYPE INDEX BY BINARY_INTEGER;
l_invoice_tbl l_invoice_tbl_type;
CURSOR cur_invoice IS
--1. 支付类型:非纯支付 收款方式:单收
SELECT temp.record_flag,
temp.org_id,
temp.req_number,
temp.req_header_id,
temp.vendor_id,
temp.vendor_site_id,
temp.req_coa_reg_code,
temp.group_type_code,
temp.doc_type_id,
temp.req_apply_date,
temp.req_emp_dept_code,
temp.req_employee_id,
temp.ebs_type_key,
temp.doc_type_name,
temp.src_system_id,
temp.short_code,
temp.src_system_name,
temp.ap_terms_id,
temp.terms_start_date,
temp.currency_code,
temp.comments,
temp.payment_method_code,
temp.pay_group_code,
temp.payment_flag,
temp.accts_pay_code_combination_id,
temp.invoice_amount
FROM (** ** 此处略去n行代码 ** **) temp
ORDER BY temp.req_employee_id ASC;
BEGIN
OPEN cur_invoice;
LOOP
FETCH cur_invoice BULK COLLECT
INTO l_invoice_tbl LIMIT 5000;
EXIT WHEN l_invoice_tbl.count = 0;
FOR k IN l_invoice_tbl.first .. l_invoice_tbl.last
LOOP
--头
l_iface_rec.org_id := l_invoice_tbl(k).org_id;
l_iface_rec.invoice_type_lookup_code := l_invoice_type_lookup_code; --发票类型(CREDIT/STANDARD/PREPAYMENT/MIXED)
l_iface_rec.invoice_date := l_invoice_tbl(k)