Tuesday 18 September 2012

AutoInvoice in Oracle Apps R12

Oracle Receivables uses three interface tables for AutoInvoice:


RA_INTERFACE_LINES


This table contains information relating to all transactions to be processed by AutoInvoice.
Transactions include invoices, debit memos, credit memos, and on-account credits.
Each record contains line, tax, freight, or finance charges information.
The Line_Type field identifies the type of information contained in the record.
A record can be a parent record: Line, Header Freight, or Charges; or a child record: Tax or linelevel Freight.
A child record is linked to the parent record using the Link-To Transaction flexfield.




BEGIN
INSERT INTO RA_INTERFACE_LINES_ALL (Amount,
batch_source_name,
conversion_rate,
conversion_type,
created_by,
creation_date,
last_updated_by,
last_update_date,
last_update_login,
currency_code,
cust_trx_type_id,
description,
gl_date,
trx_number,
trx_date,
line_number,
interface_line_attribute1,
interface_line_attribute2,
interface_line_attribute3,
interface_line_context,
line_type,
org_id,
quantity,
unit_selling_price,
ship_date_actual,
sales_order,
sales_order_date,
purchase_order,
inventory_item_id,
uom_code,
orig_system_bill_customer_id,
orig_system_bill_address_id,
orig_system_ship_customer_id,
orig_system_ship_address_id,
primary_salesrep_id,
set_of_books_id,
term_id,
tax_code,
header_attribute11,territory_id
)
VALUES ((crec_inv_lines.quantity*crec_inv_lines.net_rate),
g_batch_source_name1,
l_xxemig_distinvs_tbl(j).inv_conversion_rate,
'User',
FND_GLOBAL.USER_ID,
SYSDATE,
FND_GLOBAL.USER_ID,
SYSDATE,
FND_GLOBAL.USER_ID,
l_currency_code,
l_trx_type_id,
l_item_description,
SYSDATE,
g_prefix2l_xxemig_distinvs_tbl(j).inv_reference_number,
l_xxemig_distinvs_tbl(j).inv_date,
l_tot_line_count_rev,
l_sales_order_no,
g_prefix2l_xxemig_distinvs_tbl(j).inv_reference_number,
l_tot_line_count_rev,
g_interface_line_context,
'LINE',
g_org_id,
crec_inv_lines.quantity,
crec_inv_lines.net_rate,
l_ship_date_actual,
l_sales_order_no,
l_sales_order_date,
l_xxemig_distinvs_tbl(j).inv_po_number,
g_inventory_item_id,
g_uom_code,
l_cust_account_id,----org bill to customer----
l_orig_bill_address_id,---customer bill to address----,
l_cust_account_id,----org ship to customer----
l_orig_ship_address_id,---customer ship to address----
l_primary_salesrep_id,
g_set_of_books_id,
l_term_id,
g_tax_code,
'S/P' ,l_territory_id
);


---------------------------------------


RA_INTERFACE_DISTRIBUTIONS
This table contains accounting distributions to be used by the transactions defined in RA_INTERFACE_LINES.
Accounts defined in this table override any accounts created using AutoAccounting.
You can choose to pass some or all account information to AutoInvoice. Any accounts that are not passed will be derived using AutoAccounting.
Records in this table are linked to records in the RA_INTERFACE_LINES table using the Transaction flexfield.
Not required if AutoAccounting determines GL distributions.


If Auto Accounting Set Up enabled then no need to populate the data.


---------------------------------------
RA_INTERFACE_SALESCREDITS


This table contains all sales credit information for the transactions in the RA_INTERFACE_LINES table.
The two tables are linked using the Transaction flexfield.
Not required if not tracking sales credit




BEGIN
INSERT INTO RA_INTERFACE_SALESCREDITS_ALL (interface_line_context,
interface_line_attribute1,
interface_line_attribute2,
interface_line_attribute3,
sales_credit_percent_split,
sales_credit_type_id,
salesrep_id,
org_id,
created_by,
last_updated_by,
last_update_date,
last_update_login
)
VALUES (g_interface_line_context,
l_sales_order_no,
g_prefix2l_xxemig_distinvs_tbl(j).inv_reference_number,
l_tot_line_count_rev,
'100',
l_sales_credit_type_id,
l_primary_salesrep_id,
g_org_id,
FND_GLOBAL.USER_ID,
FND_GLOBAL.USER_ID,
SYSDATE,
FND_GLOBAL.USER_ID
);

AutoInvoice transfers transaction data from the above three interface tables into the following Receivables tables:
RA_BATCHES_ALL
RA_CUSTOMER_TRX _ALL
RA_CUSTOMER_TRX_LINES _ALL
RA_CUST_TRX_LINE_GL_DIST_ALL
RA_CUST_TRX_LINE_SALESREPS_ALL
AR_PAYMENT_SCHEDULES_ALL
AR_RECEIVABLE_APPLICATIONS_ALL
AR_ADJUSTMENTS_ALL


AutoInvoice is a tool consists of 3 main programs. Each program will have unique nature of work to do and they are called internally except Purge program whose execution is derived on the setup otherwise ready to execute stand alone.
Master (RAXMTR)
Import (RAXTRX)
Purge (RAXDEL)
1] Auto Invoice Master program:
Selects and marks records in the interface tables to be processed based on the parameters the user entered and then calls the AutoInvoice Import program. Auto Invoice Master program has no report output.
Gathers statistics, it means it gathers the stats on interface tables and set the stats on certain indices on interface tables.
Marks interface records for processing by marking request_id.
Submits multiple workers for Parallel Processing by creating instances for request.
2] Auto Invoice Import Program:
Validates the selected record and creates transaction if it passes validation. Any record that fails validation is left in the interface table with an error code. Depending on the setup, related records may be rejected as well. This program has an output file called Auto Invoice Execution report, which you can view by clicking the View Report button in the Requests window.
Workhorse of Auto invoice
Validates data
Inserts records
Deletes interface data
Only when system option purge set to ‘Y’
3] Auto Invoice Purge Program:
Deletes records from the interface tables. If you set the Purge Interface Table system option to No in Define System Option window, Auto Invoice does not delete processed records from the interface tables after each run, and we must submit Auto Invoice Purge Program periodically to clean up the interface tables. This program only deletes transaction lines that have been successfully imported.
AutoInvoice Exception Handling:
Records that fail validation are called ‘Exceptions’
Exceptions stay in Interface Tables which is RA_INTERFACE_ERRORS_ALL.
Errors can be corrected in the Exception Handling window.
Once corrections are made, Auto invoice must be resubmitted.
Records that pass validation get transferred to Receivables tables.

No comments:

Post a Comment