declare
lv_wait_req_id BOOLEAN;
ln_request_id NUMBER;
lv_phase VARCHAR2(100);
lv_status VARCHAR2(100);
lv_dev_phase VARCHAR2(100);
lv_dev_status VARCHAR2(100);
lv_msg VARCHAR2(1000);
p_batch_id NUMBER;
g_user_id NUMBER := 48866;
g_resp_id NUMBER := 50916;
g_resp_appl_id NUMBER := 200;
begin
insert into AP_INVOICES_INTERFACE (
invoice_id,
invoice_num,
vendor_id,
vendor_site_id,
invoice_amount,
INVOICE_CURRENCY_CODE,
invoice_date,
gl_date,
DESCRIPTION,
PAY_GROUP_LOOKUP_CODE,
source,
org_id
)
values (
AP_INVOICES_INTERFACE_S.NEXTVAL,
'test_inv2',
01,
46,
1200.00,
'USD',
'20-Nov-2014',
'20-Nov-2014',
'test Invoice',
'Supplier',
'MANUAL INVOICE ENTRY',
161
);
insert into AP_INVOICE_LINES_INTERFACE (
invoice_id,
invoice_line_id,
line_number,
line_type_lookup_code,
amount,
dist_code_combination_id
)
values (
AP_INVOICES_INTERFACE_S.CURRVAL,
AP_INVOICE_LINES_INTERFACE_S.NEXTVAL,
1,
'ITEM',
1200.00,
100010645
);
commit;
fnd_global.apps_initialize (user_id => g_user_id,
resp_id => g_resp_id,
resp_appl_id => g_resp_appl_id);
ln_request_id := fnd_request.submit_request (
application => 'SQLAP',
program => 'APXIIMPT',
description => NULL,
start_time => SYSDATE, -- , sub_request => TRUE
argument1 => NULL, -- OU
argument2 => 'MANUAL INVOICE ENTRY', -- Source
argument3 => p_batch_id, -- Group
argument4 => 'APINV' || '_' || p_batch_id, -- Batch Name
argument5 => NULL, -- Hold Name
argument6 => NULL, -- Hold Reason
argument7 => NULL, -- GL Date
argument8 => 'N',
argument9 => 'N',
argument10 => 'N',
argument11 => 'N');
COMMIT;
lv_wait_req_id :=
fnd_concurrent.wait_for_request (request_id => ln_request_id,
interval => 10,
max_wait => 0,
phase => lv_phase,
status => lv_status,
dev_phase => lv_dev_phase,
dev_status => lv_dev_status,
MESSAGE => lv_msg);
dbms_output.put_line('Request Id'|| ln_request_id);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Unknown Exception'|| SQLERRM);
END;
----Another Example----------
INSERT
INTO ap_invoices_interface
(
invoice_id,
invoice_num,
invoice_type_lookup_code,
invoice_date,
vendor_id,
vendor_site_id,
invoice_amount,
source,
org_id,
creation_date,
created_by,
last_update_date,
last_updated_by
)
VALUES
(
AP_INVOICES_INTERFACE_S.NEXTVAL,
'INV1002',
'STANDARD'
,SYSDATE --<invoice date>
,600 --<vendor_id validated against po_vendors.vendor_id>,
,1414 --<vendor_site_id validated against po_vendor_sites.vendor_site_id>,
,100 --<invoice_amount>
,'Manual Invoice Entry' -- It can be retrived by following query
--(select lookup_code
--from ap_lookup_codes
--where lookup_type='SOURCE')
,204
,sysdate
,-1
,sysdate
,-1
);
select *from ap_suppliers where vendor_name like '3%'--endor_id = 3003
select *from ap_supplier_sites_all where vendor_id = 600
<< Inserting into AP_INVOICE_LINES_INTERFACE>>
INSERT
INTO ap_invoice_lines_interface
(
invoice_id,
invoice_line_id,
line_number,
line_type_lookup_code,
amount,
accounting_date,
dist_code_combination_id,
creation_date,
created_by,
last_update_date,
last_updated_by
)
VALUES
(
AP_INVOICES_INTERFACE_S.CURRVAL
,AP_INVOICE_LINES_INTERFACE_S.NEXTVAL
,1 --<some unique_number>,
,'ITEM' --<ITEM>/<FREIGHT>/<TAX>
,100 --<line_amount> sum of line_amount should always be equal to invoice_amount,
,SYSDATE
,'16953' --'<account code>'
,sysdate
,-1
,sysdate
,-1
);
COMMIT;
select *from gl_code_combinations where code_combination_id = 16953;
update ap_invoices_interface set source = 'Manual Invoice Entry' where creation_date like sysdate
select * from ap_invoices_interface where creation_date like sysdate
select *from ap_interface_rejections where creation_date like sysdate;
select *from ap_invoices_all where creation_date like sysdate;
insert into AP_INVOICES_INTERFACE (
invoice_id,
invoice_num,
vendor_id,
vendor_site_id,
invoice_amount,
INVOICE_CURRENCY_CODE,
invoice_date,
DESCRIPTION,
--PAY_GROUP_LOOKUP_CODE,
source,
org_id,
creation_date,
created_by,
last_update_date,
last_updated_by
)
values (
AP_INVOICES_INTERFACE_S.nextval,
'INV100',
'600',
'1414',
1200.00,
'USD',
sysdate,
'This Invoice is created for test purpose',
--'WUFS SUPPLIER',
'Manual Invoice Entry',
204,
sysdate,-1,sysdate,-1
)
insert into AP_INVOICE_LINES_INTERFACE (
invoice_id,
invoice_line_id,
line_number,
line_type_lookup_code,
amount,
creation_date,
created_by,
last_update_date,
last_updated_by
)
values (
AP_INVOICES_INTERFACE_S.CURRVAL
,AP_INVOICE_LINES_INTERFACE_S.NEXTVAL,
1,
'ITEM',
1200.00,
sysdate,-1,sysdate,-1
);
No comments:
Post a Comment