本文章讲述如何通过接口导入费用报表类型的AP Invoice实例。
前提条件:
1.定义员工供应商,该供应商的地点名称为办公室
2.定义费用报表模板:AP/Setup/Invoice/Expense Report Templates
快速参考:
参考点 | 内容 |
功能导航 | N:AP/Invoices/Entry/Expense Reports |
并发请求 | Expense Report Import(导入费用报表) |
接口表 | AP_EXPENSE_REPORT_HEADERS_ALL |
API | 无 |
错误信息表 | 无 |
接口Form | N:AP/Invoices/Entry/Expense Reports |
接口Report |
开发参考:
接口表信息
接口表 | 数据表 | 说明 |
AP_EXPENSE_REPORT_HEADERS_ALL | AP_INVOICES_ALL | |
AP_EXPENSE_REPORT_LINES_ALL | AP_INVOICE_DISTRIBUTIONS_ALL |
Table Relation:
Select *
From AP_EXPENSE_REPORT_HEADERS_ALL AERH, AP_EXPENSE_REPORT_LINES_ALL AERL
Where AERH.REPORT_HEADER_ID = AERL.REPORT_HEADER_ID --二个接口表联连条件
并发请求
N:View/Requests/Expense Report Import
Parameters | Description |
Batch Name | 批名称 |
Summarize Report | Yes/No本例子参数为No |
Source | 来源:Payables Expense Reports |
GL Date | 空 |
Purge Date | 空 |
Transfer Descriptive Flexfield | 是否传输入说明弹性域字段值 |
关键字段(参数)+最简单例子
关键字段
AP_EXPENSE_REPORT_HEADERS_ALL
Field | Description |
REPORT_HEADER_ID | 题头ID |
EMPLOYEE_ID | 员工标识ID |
WEEK_END_DATE | 日期 |
VOUCHNO | |
TOTAL | 金额 |
VENDOR_ID | 员工供应商标识ID |
VENDOR_SITE_ID | 员工供应商地点标识 |
EXPENSE_CHECK_ADDRESS_FLAG | 发送地点标识 |
INVOICE_NUM | 发票编号 |
EXPENSE_REPORT_ID | 费用模板标识ID |
SET_OF_BOOKS_ID | 帐本标识ID |
SOURCE | 来源说明 |
EMPLOYEE_CCID | 默认GL帐户标识ID |
DESCRIPTION | 发票说明 |
ATTRIBUTE_CATEGORY | |
ATTRIBUTE1 | |
ATTRIBUTE2 | |
ATTRIBUTE3 | |
ATTRIBUTE4 | |
ATTRIBUTE5 | |
ATTRIBUTE6 | |
ATTRIBUTE7 | |
ATTRIBUTE8 | |
ATTRIBUTE9 | |
ATTRIBUTE10 | |
ATTRIBUTE11 | |
ATTRIBUTE12 | |
ATTRIBUTE13 | |
ATTRIBUTE14 | |
ATTRIBUTE15 | |
DEFAULT_CURRENCY_CODE | 默认币种 |
DEFAULT_EXCHANGE_RATE_TYPE | 默认汇率类型 |
DEFAULT_EXCHANGE_RATE | 默认汇率 |
DEFAULT_EXCHANGE_DATE | 默认汇率日期 |
VOUCHER_NUM | 凭证单据 |
ORG_ID | 组织标识 |
PAYMENT_CROSS_RATE_TYPE | 付款汇率类型 |
PAYMENT_CROSS_RATE_DATE | 付款汇率日期 |
PAYMENT_CROSS_RATE | 付款汇率 |
PAYMENT_CURRENCY_CODE | 付款币种 |
AP_EXPENSE_REPORT_LINES_ALL
Field | Description |
REPORT_HEADER_ID | 题头ID |
CODE_COMBINATION_ID | 帐户ID |
ITEM_DESCRIPTION | 行说明 |
SET_OF_BOOKS_ID | 帐薄标识ID |
AMOUNT | 金额 |
ATTRIBUTE_CATEGORY | |
ATTRIBUTE1 | |
ATTRIBUTE2 | |
ATTRIBUTE3 | |
ATTRIBUTE4 | |
ATTRIBUTE5 | |
ATTRIBUTE6 | |
ATTRIBUTE7 | |
ATTRIBUTE8 | |
ATTRIBUTE9 | |
ATTRIBUTE10 | |
ATTRIBUTE11 | |
ATTRIBUTE12 | |
ATTRIBUTE13 | |
ATTRIBUTE14 | |
ATTRIBUTE15 | |
CURRENCY_CODE | 币种 |
VAT_CODE | 税率 |
LINE_TYPE_LOOKUP_CODE | 行类型(项目/税) |
DISTRIBUTION_LINE_NUMBER | 分配行 |
ORG_ID | OU ID |
START_EXPENSE_DATE | GL 日期 |
END_EXPENSE_DATE | |
RECEIPT_CURRENCY_CODE | |
RECEIPT_CONVERSION_RATE | |
DAILY_AMOUNT | |
RECEIPT_CURRENCY_AMOUNT | |
WEB_PARAMETER_ID | |
AMOUNT_INCLUDES_TAX_FLAG | 金额是否含税 |
Open Inerface最简单例子(AP Invoices 费用报表)(11.5.10.2)
Declare
l_iface_h AP_EXPENSE_REPORT_HEADERS_ALL%Rowtype;
l_iface_l AP_EXPENSE_REPORT_LINES_ALL%Rowtype;
v_SetOfBook := 1001; --帐薄ID
v_OrgId := 114; --OU ID
v_Source := 'XpenseXpress'; --来源代码
v_EmployeeCCID := 2339; --
v_CurrencyCode := 'CNY'; --币种
v_UserId Number := 0; --用户ID
v_ExpenseReportID Number; --模板ID
v_ChartOfAccountsID := 58802;
Begin
--获得费用报表板模ID
Begin
Select APER.EXPENSE_REPORT_ID
Into v_ExpenseReportID
From AP_EXPENSE_REPORTS_ALL APER
Where APER.ORG_ID = P_ORG_ID
And APER.REPORT_TYPE = 'CUX_EXPENSE';
Exception
When No_Data_Found Then
Null;
End;
v_ExpenseReportID := Nvl(v_ExpenseReportID, 0);
--题头
l_iface_h.creation_date := Sysdate;
l_iface_h.created_by := v_UserId;
l_iface_h.last_update_date := Sysdate;
l_iface_h.last_updated_by := v_UserId;
l_iface_h.Last_Update_Login := -1;
--行
l_iface_l.creation_date := Sysdate;
l_iface_l.created_by := v_UserId;
l_iface_l.last_update_date := Sysdate;
l_iface_l.last_updated_by := v_UserId;
l_iface_l.Last_Update_Login := -1;
--题头序
Select AP_EXPENSE_REPORT_HEADERS_S.NEXTVAL
Into l_iface_h.REPORT_HEADER_ID
From Dual;
l_iface_h.EMPLOYEE_ID := 94;
l_iface_h.WEEK_END_DATE := Trunc(Sysdate); --发票日期/GL日期
l_iface_h.VOUCHNO := 0;
l_iface_h.TOTAL := 541; --发票金额
l_iface_h.EXPENSE_CHECK_ADDRESS_FLAG := '0';
l_iface_h.INVOICE_NUM := '9530'; --发票编号
l_iface_h.EXPENSE_REPORT_ID := v_ExpenseReportID;
l_iface_h.SET_OF_BOOKS_ID := v_SetOfBook;
l_iface_h.SOURCE := v_Source;
l_iface_h.APPLY_ADVANCES_DEFAULT := 'N'; --
l_iface_h.EMPLOYEE_CCID := v_EmployeeCCID; --默认GL帐户标识ID
l_iface_h.ATTRIBUTE1 := 'DD';
l_iface_h.ATTRIBUTE2 := 'DD';
l_iface_h.DEFAULT_CURRENCY_CODE := v_CurrencyCode;
l_iface_h.ORG_ID := v_OrgId;
l_iface_h.PAYMENT_CROSS_RATE_DATE := Sysdate;
l_iface_h.PAYMENT_CROSS_RATE := 0;
l_iface_h.PAYMENT_CURRENCY_CODE := v_CurrencyCode;
l_iface_h.DESCRIPTION := '测试费用报表报销费用';
Insert Into AP_EXPENSE_REPORT_HEADERS_ALL Values l_iface_h;
--行
l_iface_l.REPORT_HEADER_ID := l_iface_h.REPORT_HEADER_ID;
l_iface_l.CODE_COMBINATION_ID := 3019; --GL帐户标识ID
l_iface_l.ITEM_DESCRIPTION := '报销费用XXXXXXXXXXXXX';
l_iface_l.SET_OF_BOOKS_ID := v_SetOfBook;
l_iface_l.AMOUNT := 541; --分配行金额
l_iface_l.CURRENCY_CODE := v_CurrencyCode;
l_iface_l.LINE_TYPE_LOOKUP_CODE := 'ITEM'; --分配类型:ITEM为项目,TAX为税
l_iface_l.DISTRIBUTION_LINE_NUMBER := 1;
l_iface_l.ORG_ID := v_OrgId;
l_iface_l.START_EXPENSE_DATE := Sysdate; --GL Date
l_iface_l.END_EXPENSE_DATE := Null;
l_iface_l.RECEIPT_CURRENCY_CODE := v_CurrencyCode;
l_iface_l.RECEIPT_CONVERSION_RATE := 0;
l_iface_l.DAILY_AMOUNT := 541;
l_iface_l.RECEIPT_CURRENCY_AMOUNT := 541;
l_iface_l.WEB_PARAMETER_ID := 0;
l_iface_l.TAX_CODE_OVERRIDE_FLAG := 'N';
l_iface_l.AMOUNT_INCLUDES_TAX_FLAG := 'Y'; --发票行金额是否:Y为含税/N为不含税
l_iface_l.Vat_Code := 'VAT17';
l_iface_l.ATTRIBUTE1 := 'DDAF';
Insert Into AP_EXPENSE_REPORT_LINES_ALL Values l_iface_l;
--调用并发请求:Expense Report Import()
fnd_global.apps_initialize(P_USER_ID, 50255, 700, 0); --初始化环境
v_request_id := FND_request.SUBMIT_request('SQLAP',
'APXXTR',
'',
'',
false,
'A', ----参数1
v_ChartOfAccountsID,
v_UserId,
'EXP130110', --产生AP Invoice 批的名称
v_SetOfBook,
'N', --CHR(0),
'XpenseXpress', --'',
'',
58,
'',
'',
'Y',
'N');
Commit;
End;
插入费用报表接口表以后,也可以手工提交请求: