Wednesday, 24 August 2011

Single Insert Script for AP Invoices in 11.5.10 Oracle Applications

Single Insertion scripts for AP Invoices

This Document provides the guidance to the user with the necessary information for creating invoices through Single Insert in accurate way.
The Interface table used here is:

AP_INVOICES_INTERFACE.

AP_INVOICE_DISTRIBUTIONS_INTERFACE

 Insertion steps

Following are the steps that must be followed, in order, to perform the Single insertions for Invoices:

Execution Step
Description
Step 1
select * from AP_INVOICES_ALL where invoice_num='XX_INV_102’;
--No rows selected.
Hence we can create an Item with ‘XX_INV_002’
Step 2
select DISTINCT master_organization_id from MTL_PARAMETERS;

--select one record from the above query

For Example choose

MASTER_ORGANIZATION_ID=204
Step 3

INSERT INTO ap_invoices_interface

(invoice_id, invoice_num, invoice_amount, invoice_date,

invoice_type_lookup_code, payment_method_lookup_code, gl_date,

vendor_id, vendor_site_id, source, invoice_currency_code,

payment_currency_code, terms_id, org_id, terms_date,

creation_date, created_by, last_update_date, last_updated_by

)

VALUES (ap_invoices_interface_s.NEXTVAL, 'XX_INV_007', 2000,

SYSDATE,

'STANDARD', 'CHECK', SYSDATE,

29925, 5064, 'External', 'USD',

'USD', 10003, 204, SYSDATE,

SYSDATE, 1008480, SYSDATE, 1008480
);
Step 4
INSERT INTO ap_invoice_lines_interface

(invoice_id,

invoice_line_id, dist_code_combination_id, line_number,

line_type_lookup_code, amount, accounting_date, creation_date,

created_by, last_update_date, last_updated_by

)

VALUES (ap_invoices_interface_s.CURRVAL,

ap_invoice_lines_interface_s.NEXTVAL, 17347, 1,

'ITEM', 2000, SYSDATE, SYSDATE,

1008480, SYSDATE, 1008480

);

Step 5
COMMIT;
Step 6
Select * from ap_invoices_interface where trunc(creation_date)=trunc
(sysdate);
Step 7
Select * from ap_invoice_lines_interface where trunc(creation_date)
=trunc(sysdate);
Step 8
Then Login to Applications and switch to Payables, Vision Operations
(USA)

Responsibility: Payables, Vision Operations (USA)

Navigation: Others -->   Requests -->  Run

Run Payables Open Import Program

Parameters:

Source → External

Group → Null

Batch Name → N/A

Hold Name → Null

Hold Reason → Null

GL Date → Null

Purge → No

Summarize Report → No


Then submit the request. After successful completion of the request
please follow the next step.
Step 9
Select * from ap_invoices_all where invoice_num like ‘XX_INV_102’
Step 10
Select * from ap_invoices_distributions_all where invoice_id=64210





Pre-Requisitions


Execution Step
Description
Step 1
Organization should already exist.
Step 2
Template should already exist.
Step 3
Item to be created should not exist before.
Step 4
Accounting period must be in Open status.






Code Attachments

single_insert_invoices.sql
The above sql file has the code to perform single insert into Interface tables for Invoices.
INSERT INTO ap_invoices_interface
(invoice_id, invoice_num, invoice_amount, invoice_date,
invoice_type_lookup_code, payment_method_lookup_code, gl_date,
vendor_id, vendor_site_id, source, invoice_currency_code,
payment_currency_code, terms_id, org_id, terms_date,
creation_date, created_by, last_update_date, last_updated_by
)
VALUES (ap_invoices_interface_s.NEXTVAL, 'XX_INV_007', 2000, SYSDATE,
'STANDARD', 'CHECK', SYSDATE,
29925, 5064, 'External', 'USD',
'USD', 10003, 204, SYSDATE,
SYSDATE, 1008480, SYSDATE, 1008480
);

INSERT INTO ap_invoice_lines_interface
(invoice_id,
invoice_line_id, dist_code_combination_id, line_number,
line_type_lookup_code, amount, accounting_date, creation_date,
created_by, last_update_date, last_updated_by
)
VALUES (ap_invoices_interface_s.CURRVAL,
ap_invoice_lines_interface_s.NEXTVAL, 17347, 1,
'ITEM', 2000, SYSDATE, SYSDATE,
1008480, SYSDATE, 1008480
);
COMMIT;

Tuesday, 28 June 2011

To submit concurrent program from BackEnd.

PROCEDURE call_concurrent
/*=======================================================================
OBJECT NAME: CALL_CONCURRENT
OBJECT TYPE: Public Procedure
DESCRIPTION: This procedure calls the standard import program 'Receiving Transactions Interface' to load the Receipts
PARAMETERS:
<<Name>> << Type >> <<Data Type>> <<Description>>
=====================================================================*/
IS
l_request_id NUMBER;
l_errbuf VARCHAR2 (3000);
l_phase VARCHAR2 (20);
l_status VARCHAR2 (20);
l_dev_phase VARCHAR2 (20);
l_dev_status VARCHAR2 (20);
l_message VARCHAR2 (2000);
l_flag BOOLEAN;
BEGIN
g_object_name := 'om';
g_procedure_name := 'CALL_CONCURRENT';
g_package_name := 'jk_package';
DBMS_OUTPUT.put_line ('IN call_concurrent');

BEGIN
fnd_global.apps_initialize (fnd_global.user_id,
fnd_global.resp_id,
fnd_global.resp_appl_id
);
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;

--fnd_global.apps_initialize (8038, 50175, 700);
l_request_id :=
fnd_request.submit_request ('om', 'rvctp', NULL,
--'Transaction processing module for Integrated Receiving',
NULL,
--TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI'),
FALSE, 'BATCH', 0);
COMMIT;
DBMS_OUTPUT.put_line ('l_request_id IS ' || l_request_id);

IF l_request_id = 0
THEN
g_progress := '6002';
l_errbuf := fnd_message.get;
g_log :=
' Unexpected error occurred In Call concurrent Procedure ->'
|| SQLERRM
|| ' '
|| l_errbuf;
DBMS_OUTPUT.put_line (g_log);
g_error_message := g_log;
error_log_write;
ELSE
g_progress := '6004';
COMMIT;
l_flag :=
fnd_concurrent.wait_for_request (l_request_id,
30,
86400,
l_phase,
l_status,
l_dev_phase,
l_dev_status,
l_message
);
COMMIT;
END IF;
END call_concurrent;

Monday, 27 June 2011

Query to Find the Request Group,Responsibility name by concurrent program

SELECT fcpt.user_concurrent_program_name, frg.request_group_name,
fcp.concurrent_program_name, frt.responsibility_name
FROM fnd_request_group_units frgu,
fnd_concurrent_programs fcp,
fnd_concurrent_programs_tl fcpt,
fnd_request_groups frg,
fnd_executables fe,
fnd_responsibility fr,
fnd_responsibility_tl frt
WHERE frgu.request_unit_id = fcp.concurrent_program_id
AND frgu.request_group_id = frg.request_group_id
AND fe.executable_id = fcp.executable_id
AND fcp.concurrent_program_id = fcpt.concurrent_program_id
AND fcpt.user_concurrent_program_name LIKE :Concurrent_program_name
AND frg.request_group_id = fr.request_group_id
AND fr.responsibility_id = frt.responsibility_id