AP導入問題

[复制链接]
查看11 | 回复8 | 2015-5-19 15:40:00 | 显示全部楼层 |阅读模式
公司需要导入AP Invoice,我写了段程式将资料insert 到接口表,然后直接运行程式Payables Open Interface Import,程式不報錯,可也沒有生成Invoice,请大家指点,程式代码如下:
背景程式的参数如图:


aaa.jpg (52.77 KB, 下载次数: 19)
下载附件
2015-5-19 15:39 上传

DECLARE
l_iface_rec ap_invoices_interface%ROWTYPE;
l_iface_lines_rec ap_invoice_lines_interface%ROWTYPE;
BEGIN
--Header
SELECT ap_invoices_interface_s.NEXTVAL
INTO l_iface_rec.invoice_id
FROM dual;
l_iface_rec.invoice_num
:= 'AP0001';
l_iface_rec.invoice_type_lookup_code := 'STANDARD';
l_iface_rec.invoice_date
:= SYSDATE;
l_iface_rec.vendor_id
:= 36767;
l_iface_rec.vendor_site_id := 49236;
l_iface_rec.invoice_amount := 29603.28;
l_iface_rec.invoice_currency_code:= 'USD';
l_iface_rec.exchange_rate_type := NULL;
l_iface_rec.exchange_date
:= NULL;
l_iface_rec.exchange_rate
:= NULL;
l_iface_rec.SOURCE
:= 'Manual Invoice Entry'; --Lookup type SOURCE
l_iface_rec.group_id
:= l_iface_rec.invoice_id;
l_iface_rec.org_id
:= 1620;
l_iface_rec.last_update_date:= SYSDATE;
l_iface_rec.last_updated_by := 0;
l_iface_rec.creation_date := SYSDATE;
l_iface_rec.created_by
:= 0;
l_iface_rec.last_update_login := -1;
INSERT INTO ap_invoices_interface VALUES l_iface_rec;
--Line
SELECT ap_invoice_lines_interface_s.NEXTVAL
INTO l_iface_lines_rec.invoice_line_id
FROM dual;
l_iface_lines_rec.org_id
:= 1620;
l_iface_lines_rec.invoice_id
:= l_iface_rec.invoice_id;
l_iface_lines_rec.accounting_date
:= SYSDATE;
l_iface_lines_rec.line_number
:= 1;
l_iface_lines_rec.line_type_lookup_code:= 'ITEM';
l_iface_lines_rec.amount
:= 29603.28;
l_iface_lines_rec.dist_code_combination_id := 115934;
l_iface_lines_rec.last_update_date:= SYSDATE;
l_iface_lines_rec.last_updated_by := 0;
l_iface_lines_rec.creation_date := SYSDATE;
l_iface_lines_rec.created_by:= 0;
l_iface_lines_rec.last_update_login := -1;
INSERT INTO ap_invoice_lines_interface VALUES l_iface_lines_rec;
END;

回复

使用道具 举报

千问 | 2015-5-19 15:40:00 | 显示全部楼层
LZ能贴下Log和output么
回复

使用道具 举报

千问 | 2015-5-19 15:40:00 | 显示全部楼层
LZ先看下两个接口表的status字段是不是reject了,如果是的查询ap_interface_rejections表查看错误信息。
或者在ap -> invoices -> entry -> quick invoices界面查询
回复

使用道具 举报

千问 | 2015-5-19 15:40:00 | 显示全部楼层
fangz0615 发表于 2015-5-20 10:34
LZ先看下两个接口表的status字段是不是reject了,如果是的查询ap_interface_rejections表查看错误信息。
或 ...

接口表的status字段為空,
GBM Factory 0B9
Report Date: 21-MAY-2015 12:35

Payables Open Interface Import Report
Page:
1
Source:
Manual Invoice Entry
Hold Name:
Group: 80672
Hold Reason:
Batch Name:MAP1503001
GL Date:

Purge:
Yes

Summarize Report:No



Payables Open Interface Audit Report

SupplierSupplier
Invoice Invoice Invoice
InvoiceDist
Dist Accounting
NumberName
NumberDateCurrency
AmountNumber
Amount Date
--------- ------------------------ ------------- ------------------- ---------------- --------- --------------- ----------


Total Invoices Imported
:
0

Total Functional Currency Invoice Amount:
0.00



*** No Data Exists for this Report ***
GBM Factory 0B9
Report Date: 21-MAY-2015 12:35

Payables Open Interface Import Report
Page:
2
Source:
Manual Invoice Entry
Hold Name:
Group: 80672
Hold Reason:
Batch Name:MAP1503001
GL Date:

Purge:
Yes

Summarize Report:No



Payables Open Interface Rejections Report

Supplier Supplier InvoiceInvoiceInvoice
Invoice Line
Number Name Number Date Currency
Amount Number Reason
Description
-------- -------- -------------- -------- -------- ------------------ ------ ----------------- ----------------------------------

Total Invoices Rejected :0


*** No Data Exists for this Report ***

LOG文件
+---------------------------------------------------------------------------+
Payables: Version : 11.5.0 - Development
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
APXIIMPT module: Payables Open Interface Import
+---------------------------------------------------------------------------+
Current system time is 21-MAY-2015 12:35:05
+---------------------------------------------------------------------------+

+-----------------------------
| Starting concurrent program execution...
+-----------------------------
Arguments
------------
p_source='MANUAL INVOICE ENTRY'
p_group_id='80672'
p_batch_name='MAP1503001'
p_purge_flag='Y'
p_trace_switch='Y'
p_debug_switch='Y'
p_summary_flag='N'
------------

-- Start of Reports Command --
ar60run
P_CONC_REQUEST_ID=51463957
p_source='MANUAL INVOICE ENTRY'
p_group_id='80672'
p_batch_name='MAP1503001'
p_purge_flag='Y'
p_trace_switch='Y'
p_debug_switch='Y'
p_summary_flag='N'
report=/data/u04/prodappl/ap/11.5.0/reports/US/APXIIMPT.rdf
batch=yes
destype=file
desname=/data/u04/prodcomn/admin/out/PROD_erpap2/o51463957.out
desformat=/data/u04/prodappl/fnd/11.5.0/reports/HPL
pagesize=132x66
-- End of Reports Command --

Request language is :
AMERICAN

Request territory is :
AMERICA

APPLLCSP Environment Variable set to :
XML_REPORTS_XENVIRONMENT is :
/data/u04/new_ap/prodora/8.0.6/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb
XENVIRONMENT is set to:/data/u04/new_ap/prodora/8.0.6/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb

Previous NLS_LANG Environment Variable was :
_AMERICA.UTF8

Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
_AMERICA.UTF8
'.,'
Spawned Process 1307
MSG-00001: (Before Report) After SRWINIT
MSG-01104: (Before Report) Modified file
MSG-00002: (Before Report) After Get_Company_Name
MSG-00003: (Before Report) After Get_NLS_Strings
MSG-00000: p_purge_flag :Y
MSG-00000: c_nls_yes:Yes
MSG-00000: c_nls_no :No
MSG-00000: p_summary_flag :N
MSG-00000: p_nls_summary :No
MSG-00000: p_nls_purge :Yes
MSG-00001: (Get Base Curr data 1) Get the Base Currency Information
MSG-00004: (Before Report) After Get_Base_Curr_Data
MSG-00001: (Before Report Trigger 1) Import Invoices.
MSG-00000: ------------------> l_batch_error_flag = N
MSG-00013: (Before Report Trigger 4) Commit.
MSG-00000: 0 invoice(s) were created during the process run
MSG-00000: 0 invoice(s) were fetched during the process run
MSG-00000:summarize flagN
MSG-00002: (After report trigger 2) Delete records in ap_invoices_interface
MSG-00003: (After report 3) Delete record in ap_interface_controls
MSG-00004: (After Report Trigger 4) Commit.
MSG-00005: (After Report Trigger 5) After SRWEXIT
Report Builder: Release 6.0.8.25.0 - Production on Thu May 21 12:35:06 2015
(c) Copyright 1999 Oracle Corporation.All rights reserved.
Enter Username:
Reset original NLS_LANG in environment as :
_AMERICA.UTF8
+---------------------------------------------------------------------------+
Start of log messages from FND_FILE
+---------------------------------------------------------------------------+
(Import_invoice 1) Check control table for the import batch
(Check_control_table 1) Lock the control table
(Check_control_table) Open import_requests cursor
(Check_control_table 2) Fetch import_requests
(Check_control_table) CLOSE import_requests cursor
(Check_control_table 5) Insert record into control table
(Check_control_table 6) Commit
(Import_invoice 2) Call get_info to get required info
(Get_info 1) Read from ap_system_parameters
(Get_info 2) p_last_updated_by
(Get_info 3) Get minimum_accountable_unit
(Get_info 4) Get p_sequence_numbering
(Get_info 5) Get p_allow_tax_code_override
(Get_info 6) Get p_allow_recovery_rate_override
(Get_info 5) GL Date is Sysdate
(Get_info 7) Check if PA is installed
------------------> l_status = I l_industry
= C p_pa_installed
= Y
(Get_info 8) Get chart_of_accounts_id from p_set_of_books_id
------------------> l_set_of_books_id = 1242 l_multi_currency_flag= Y l_make_r
ate_mandatory_flag= N l_default_exchange_rate_type= 1104 l_base_currency_cod
e= USD l_batch_control_flag= Y l_payment_cross_rate=l_invoice_currency_c
ode=l_payment_currency_code=l_default_last_updated_by= 0 l_default_las
t_update_login= -1 l_base_min_acct_unit=l_base_precision= 2 l_sequence_n
umbering= P l_awt_include_tax_amt= N l_gl_date_from_get_info= 20-MAY-15 l_
ussgl_transcation_code=l_trnasfer_po_desc_flex_flag= Y l_gl_date_from_rece
ipt_flag= S l_purch_encumbrance_flag
= N l_chart_of_accounts_id= 50181 l_pa_
installed
= Y l_positive_price_tolerance=l_negative_price_tolerance=l_qt
y_tolerance=l_max_qty_ord_tolerance=l_asp_auto_tax_calc_flag= Y l_asp_
amt_incl_tax_override= N l_asp_auto_tax_calc_override= Y l_inv_doc_cat_overr
ide= Y
(Import_invoice 3) Get batch_id if batch_control is on
(Get_batch_id 1) Get old batch id
(Get_batch_id 2) Get New batch_id
------------------> l_batch_id = 354049 l_batch_type = NEW BATCH
p_sourceMANUAL INVOICE ENTRY
(Check_lines 4a) Delete invoices from ap_interface_rejections
(Check_lines 4b) Select all the invoices into enums
(Import_invoice) Open import_invoices cursor
(Import_invoice 5) Fetch import_invoices
(Import_invoice) CLOSE import_invoices
(Import_invoice 9) Do Not create batch
(Import_invoice 10) COMMIT to the database
(Import_purge 11) Check if there is still any record left
------------------> l_continue_flag = N
(Import_invoice 12) Update temporary status
(Update_temp_invoice_status 1) Change PROCESSING to PROCESSED
(Update_temp_invoice_status 2) Change REJECTING to REJECTED
(Import_invoice 13) Return No of invoices fetched during process
(Import_purge ) Deleting records in interface tables...
(Import_purge 1) Open purge_invoices cursor
(Import_puege 2) Fetch purge_invoices
(Import_purge ) Close purge_invoices cursor
(Import_purge 5) Commit to the database
(Import_purge 6) Check if there is still any record left
------------------> l_continue_flag = N
+---------------------------------------------------------------------------+
End of log messages from FND_FILE
+---------------------------------------------------------------------------+

+---------------------------------------------------------------------------+
Executing request completion options...
+------------- 1) PRINT -------------+

Printing output file.

Request ID : 51463957

Number of copies : 0


Printer : noprint

回复

使用道具 举报

千问 | 2015-5-19 15:40:00 | 显示全部楼层
xiaozr123 发表于 2015-5-20 10:39
接口表的status字段為空,
GBM Factory 0B9
...

因为不清楚LZ系统的具体情况。借用你的代码改了一下,在测试系统试了一下,是可以导入成功的(ebs 11.5.10.2)。
DECLARE
l_iface_rec ap_invoices_interface%ROWTYPE;
l_iface_lines_rec ap_invoice_lines_interface%ROWTYPE;
BEGIN
--Header
SELECT ap_invoices_interface_s.nextval
INTO l_iface_rec.invoice_id
FROM dual;
l_iface_rec.invoice_num
:= 'TEST001';
l_iface_rec.invoice_type_lookup_code := 'STANDARD';
l_iface_rec.invoice_date
:= SYSDATE;
l_iface_rec.vendor_id
:= 5001;
l_iface_rec.vendor_site_id := 45909;
l_iface_rec.invoice_amount := 29603.28;
l_iface_rec.invoice_currency_code:= 'CNY';
l_iface_rec.exchange_rate_type := NULL;
l_iface_rec.exchange_date
:= NULL;
l_iface_rec.exchange_rate
:= NULL;
l_iface_rec.source
:= 'INVOICE GATEWAY'; --Lookup type SOURCE
l_iface_rec.group_id
:= l_iface_rec.invoice_id;
l_iface_rec.org_id
:= 127;
l_iface_rec.last_update_date:= SYSDATE;
l_iface_rec.last_updated_by := 0;
l_iface_rec.creation_date := SYSDATE;
l_iface_rec.created_by:= 0;
l_iface_rec.last_update_login := -1;
INSERT INTO ap_invoices_interface
VALUES l_iface_rec;
--Line
SELECT ap_invoice_lines_interface_s.nextval
INTO l_iface_lines_rec.invoice_line_id
FROM dual;
l_iface_lines_rec.org_id
:= 127;
l_iface_lines_rec.invoice_id
:= l_iface_rec.invoice_id;
l_iface_lines_rec.accounting_date
:= SYSDATE - 30;
l_iface_lines_rec.line_number
:= 1;
l_iface_lines_rec.line_type_lookup_code:= 'ITEM';
l_iface_lines_rec.amount
:= 29603.28;
l_iface_lines_rec.dist_code_combination_id := 1004;
l_iface_lines_rec.last_update_date:= SYSDATE;
l_iface_lines_rec.last_updated_by := 0;
l_iface_lines_rec.creation_date := SYSDATE;
l_iface_lines_rec.created_by:= 0;
l_iface_lines_rec.last_update_login := -1;
INSERT INTO ap_invoice_lines_interface
VALUES l_iface_lines_rec;
dbms_output.put_line('group_id ' || l_iface_rec.invoice_id);
END;
LZ可以看看reject表里是没有错误信息。
以前我也遇到过这个问题,原因是accouting_DAte对应的期间未开。。
回复

使用道具 举报

千问 | 2015-5-19 15:40:00 | 显示全部楼层
fangz0615 发表于 2015-5-20 10:54
因为不清楚LZ系统的具体情况。借用你的代码改了一下,在测试系统试了一下,是可以导入成功的(ebs 11.5.1 ...

这就很奇怪了,我的GL,AP,AR,的期间都已开了,但导入就是不成功,你运行的背景程式和我参数应该是一样的吧?
回复

使用道具 举报

千问 | 2015-5-19 15:40:00 | 显示全部楼层
xiaozr123 发表于 2015-5-20 13:09
这就很奇怪了,我的GL,AP,AR,的期间都已开了,但导入就是不成功,你运行的背景程式和我参数应该是一样 ...

除了是否清除以外其他都一样的。
按照你的说法status为空,是不是没有处理这条数据。
回复

使用道具 举报

千问 | 2015-5-19 15:40:00 | 显示全部楼层
xiaozr123 发表于 2015-5-20 13:09
这就很奇怪了,我的GL,AP,AR,的期间都已开了,但导入就是不成功,你运行的背景程式和我参数应该是一样 ...

可以看下通过quick invoice界面是否能查到写入接口表的数据
回复

使用道具 举报

千问 | 2015-5-19 15:40:00 | 显示全部楼层
fangz0615 发表于 2015-5-20 13:31
可以看下通过quick invoice界面是否能查到写入接口表的数据

谢谢,现在已成功了,是source的值给的有问题,接问表中的source的值应该要给lookup_code的值。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行