The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT POD.po_header_id,
POL.po_line_id,
POD.po_distribution_id,
POD.destination_type_code,
POLL.line_location_id,
sysdate,
POL.item_id,
APID.quantity_invoiced,
POLL.unit_meas_lookup_code,
POH.currency_code
INTO l_rcv_event.po_header_id,
l_rcv_event.po_line_id,
l_rcv_event.po_distribution_id,
l_rcv_event.destination_type_code,
l_rcv_event.po_line_location_id,
l_rcv_event.transaction_date,
l_rcv_event.item_id,
l_rcv_event.source_doc_quantity,
l_rcv_event.source_doc_uom,
l_rcv_event.currency_code
FROM ap_invoice_distributions APID,
po_distributions POD,
po_line_locations POLL,
po_lines POL,
po_headers POH
WHERE APID.invoice_distribution_id = p_inv_distribution_id
AND POD.po_distribution_id = APID.po_distribution_id
AND POD.line_location_id = POLL.line_location_id
AND POL.po_line_id = POLL.po_line_id
AND POH.po_header_id = POD.po_header_id;
SELECT RT.po_header_id,
RT.po_release_id,
RT.po_line_id,
RT.po_line_location_id,
RT.transaction_date,
POL.item_id,
POLL.ship_to_organization_id,
RT.unit_of_measure,
RT.source_doc_unit_of_measure,
POH.currency_code,
POD.destination_type_code,
/* Support for Landed Cost Management */
rt.unit_landed_cost
INTO l_rcv_event.po_header_id,
l_rcv_event.po_release_id,
l_rcv_event.po_line_id,
l_rcv_event.po_line_location_id,
l_rcv_event.transaction_date,
l_rcv_event.item_id,
l_dest_org_id,
l_rcv_event.transaction_uom,
l_rcv_event.source_doc_uom,
l_rcv_event.currency_code,
l_rcv_event.destination_type_code,
/* Support for Landed Cost Management */
l_rcv_event.unit_landed_cost
FROM rcv_transactions RT,
po_lines POL,
po_line_locations POLL,
po_headers POH,
po_distributions POD
WHERE RT.transaction_id = p_rcv_transaction_id
AND POH.po_header_id = RT.po_header_id
AND POL.po_line_id = RT.po_line_id
AND POLL.line_location_id = RT.po_line_location_id
AND POD.po_distribution_id = p_po_distribution_id;
SELECT ledger_id
INTO l_rcv_event.set_of_books_id
FROM cst_acct_info_v
WHERE organization_id = p_organization_id;
SELECT decode(POLL.matching_basis, 'AMOUNT', 'Y', 'N')
INTO l_rcv_event.service_flag
FROM po_line_locations POLL
WHERE POLL.line_location_id = l_rcv_event.po_line_location_id;
SELECT decode(RT.po_distribution_id, NULL,
RT.amount * (POD.amount_ordered/POLL.amount),
RT.amount)
INTO l_transaction_amount
FROM rcv_transactions RT,
po_distributions POD,
po_line_locations POLL
WHERE RT.transaction_id = p_rcv_event.rcv_transaction_id
AND POD.po_distribution_id = p_rcv_event.po_distribution_id
AND POLL.line_location_id = p_rcv_event.po_line_location_id;
SELECT APID.amount
INTO l_transaction_amount
FROM ap_invoice_distributions APID
WHERE APID.invoice_distribution_id = p_rcv_event.inv_distribution_id;
SELECT RT.transaction_type, RT.parent_transaction_id
INTO l_rcv_txn_type, l_parent_txn_id
FROM rcv_transactions RT
WHERE RT.transaction_id = p_rcv_event.rcv_transaction_id;
SELECT PARENT.transaction_type
INTO l_par_rcv_txn_type
FROM rcv_transactions PARENT
WHERE PARENT.transaction_id =l_parent_txn_id;
SELECT POD.amount_ordered, POD.amount_delivered
INTO l_po_amount_ordered, l_po_amount_delivered
FROM po_distributions POD
WHERE po_distribution_id = p_rcv_event.po_distribution_id;
SELECT decode(RT.po_distribution_id, NULL,
RT.source_doc_quantity * POD.quantity_ordered/POLL.quantity,
RT.source_doc_quantity)
INTO l_source_doc_quantity
FROM rcv_transactions RT,
po_line_locations POLL,
po_distributions POD
WHERE RT.transaction_id = p_rcv_event.rcv_transaction_id
AND POLL.line_location_id = p_rcv_event.po_line_location_id
AND POD.po_distribution_id = p_rcv_event.po_distribution_id;
SELECT decode(RT.po_distribution_id, NULL,
l_source_doc_quantity * POD.quantity_ordered/POLL.quantity,
l_source_doc_quantity)
INTO l_source_doc_quantity
FROM rcv_transactions RT,
po_line_locations POLL,
po_distributions POD
WHERE RT.transaction_id = p_rcv_event.rcv_transaction_id
AND POLL.line_location_id = p_rcv_event.po_line_location_id
AND POD.po_distribution_id = p_rcv_event.po_distribution_id;
SELECT RT.transaction_type, RT.parent_transaction_id
INTO l_rcv_txn_type, l_parent_txn_id
FROM rcv_transactions RT
WHERE RT.transaction_id = p_rcv_event.rcv_transaction_id;
SELECT PARENT.transaction_type
INTO l_par_rcv_txn_type
FROM rcv_transactions PARENT
WHERE PARENT.transaction_id =l_parent_txn_id;
SELECT POD.quantity_ordered, POD.quantity_delivered
INTO l_po_quantity_ordered, l_po_quantity_delivered
FROM po_distributions POD
WHERE POD.po_distribution_id = p_rcv_event.po_distribution_id;
/* Bug #3333610. Receiving updates quantity delivered prior to calling the events API.
Consequently, we should subtract the current quantity from the quantity delivered to
get the quantity that has been delivered previously. */
l_stmt_num := 90;
SELECT count(*)
INTO l_item_exists
FROM mtl_system_items MSI
WHERE MSI.inventory_item_id = p_rcv_event.item_id
AND MSI.organization_id = p_rcv_event.organization_id;
SELECT MSI.inventory_asset_flag
INTO l_asset_flag
FROM mtl_system_items MSI,
po_line_locations POLL
WHERE MSI.inventory_item_id = p_rcv_event.item_id
AND MSI.organization_id = POLL.ship_to_organization_id
AND POLL.line_location_id = p_rcv_event.po_line_location_id;
SELECT MUOM.uom_code
INTO l_transaction_uom
FROM rcv_transactions RT, mtl_units_of_measure MUOM
WHERE RT.transaction_id = p_rcv_event.rcv_transaction_id
AND MUOM.unit_of_measure = RT.source_doc_unit_of_measure;
SELECT POLL.price_override
INTO l_unit_price
FROM po_line_locations POLL
WHERE POLL.line_location_id = p_rcv_event.po_line_location_id;
SELECT unit_landed_cost
INTO x_unit_landed_cost
FROM rcv_transactions
WHERE transaction_id = p_rcv_event.rcv_transaction_id;
SELECT APID.unit_price
INTO l_unit_price
FROM ap_invoice_distributions APID
WHERE APID.invoice_distribution_id = p_rcv_event.inv_distribution_id;
SELECT l_non_recoverable_tax/POD.amount_ordered,
l_recoverable_tax/POD.amount_ordered
INTO l_unit_nr_tax,
l_unit_rec_tax
FROM po_distributions POD
WHERE POD.po_distribution_id = p_rcv_event.po_distribution_id;
SELECT l_non_recoverable_tax/POD.quantity_ordered,
l_recoverable_tax/POD.quantity_ordered
INTO l_unit_nr_tax,
l_unit_rec_tax
FROM po_distributions POD
WHERE POD.po_distribution_id = p_rcv_event.po_distribution_id;
SELECT l_old_non_recoverable_tax/POD.quantity_ordered,
l_old_recoverable_tax/POD.quantity_ordered
INTO l_prior_nr_tax,
l_prior_rec_tax
FROM po_distributions POD
WHERE po_distribution_id = p_rcv_event.po_distribution_id;
SELECT uom_code
INTO l_source_doc_uom_code
FROM mtl_units_of_measure
WHERE unit_of_measure = p_event_rec.source_doc_uom;
SELECT uom_code
INTO l_trx_uom_code
FROM mtl_units_of_measure
WHERE unit_of_measure = p_event_rec.transaction_uom;
SELECT PUOM.uom_code, PUOM.unit_of_measure
INTO l_primary_uom_code, l_primary_uom
FROM mtl_units_of_measure TUOM,
mtl_units_of_measure PUOM
WHERE TUOM.unit_of_measure = p_event_rec.source_doc_uom
AND TUOM.uom_class = PUOM.uom_class
AND PUOM.base_uom_flag = 'Y';
SELECT primary_uom_code
INTO l_primary_uom_code
FROM mtl_system_items
WHERE organization_id = p_event_rec.organization_id
AND inventory_item_id = l_item_id;
SELECT unit_of_measure
INTO l_primary_uom
FROM mtl_units_of_measure
WHERE uom_code = l_primary_uom_code;
SELECT line_location_id
INTO l_po_line_location_id
FROM po_distributions
WHERE po_distribution_id = p_rcv_event.po_distribution_id;
SELECT match_option
INTO l_match_option
FROM po_line_locations
WHERE line_location_id = l_po_line_location_id;
SELECT nvl(POD.rate,1),
POH.rate_type,
POD.rate_date
INTO l_currency_conversion_rate,
l_currency_conversion_type,
l_currency_conversion_date
FROM po_distributions POD,
po_headers POH
WHERE POD.po_distribution_id = p_rcv_event.po_distribution_id
AND POH.po_header_id = POD.po_header_id;
SELECT RT.currency_conversion_rate,
RT.currency_conversion_type,
RT.currency_conversion_date
INTO l_currency_conversion_rate,
l_currency_conversion_type,
l_currency_conversion_date
FROM rcv_transactions RT
WHERE RT.transaction_id = p_rcv_event.rcv_transaction_id;
SELECT POD.accrual_account_id,
POD.code_combination_id,
NVL(POD.dest_charge_account_id,POD.code_combination_id),
POD.budget_account_id
INTO l_pod_accrual_acct_id,
l_pod_ccid,
l_dest_pod_ccid,
l_pod_budget_acct_id
FROM po_distributions POD
WHERE POD.po_distribution_id = p_rcv_event.po_distribution_id;
SELECT receiving_account_id,
clearing_account_id,
retroprice_adj_account_id,
/* Support for Landed Cost Management */
DECODE(p_lcm_flag, 'Y', lcm_account_id, NULL)
INTO l_receiving_insp_acct_id,
l_clearing_acct_id,
l_retroprice_adj_acct_id,
/* Support for Landed Cost Management */
l_lcm_acct_id
FROM RCV_PARAMETERS
WHERE organization_id = p_rcv_event.organization_id;
SELECT PARENT_TRX.transaction_type
INTO l_parent_trx_type
FROM rcv_transactions TRX,
rcv_transactions PARENT_TRX
WHERE TRX.transaction_id = p_rcv_event.rcv_transaction_id
AND TRX.parent_transaction_id = PARENT_TRX.transaction_id;
SELECT cost_of_sales_account
INTO l_ic_coss_acct_id
FROM mtl_parameters MP
WHERE MP.organization_id = p_rcv_event.organization_id;
SELECT cost_of_sales_account
INTO l_ic_coss_acct_id
FROM mtl_parameters MP
WHERE MP.organization_id = p_rcv_event.organization_id;
SELECT RT.transaction_type, RT.parent_transaction_id
INTO l_trx_type, l_parent_trx_id
FROM rcv_transactions RT
WHERE RT.transaction_id = p_rcv_event.rcv_transaction_id;
SELECT PARENT_TRX.transaction_type
INTO l_parent_trx_type
FROM rcv_transactions PARENT_TRX
WHERE PARENT_TRX.transaction_id = l_parent_trx_id;
SELECT count(*)
INTO l_account_flag
FROM gl_code_combinations GCC,
cst_organization_definitions COD
WHERE COD.operating_unit = p_org_id
AND COD.chart_of_accounts_id = GCC.chart_of_accounts_id
AND GCC.code_combination_id = l_dist_acct_id;
PROCEDURE Insert_RAEEvents(
p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2,
p_commit IN VARCHAR2,
p_validation_level IN NUMBER,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
p_rcv_events_tbl IN RCV_SeedEvents_PVT.rcv_event_tbl_type,
/* Support for Landed Cost Management */
p_lcm_flag IN VARCHAR2
) IS
l_api_name CONSTANT VARCHAR2(30) := 'Insert_RAEEvents';
SAVEPOINT Insert_RAEEvents_PVT;
,'Insert_RAEEvents <<');
l_api_message := 'Inserting '||p_rcv_events_tbl.count||' events into RAE';
SELECT nvl(poll.accrue_on_receipt_flag, 'N')
INTO l_accrue_on_receipt_flag
FROM po_line_locations POLL
WHERE POLL.line_location_id = p_rcv_events_tbl(l_ctr_first).po_line_location_id;
SELECT rcv_accounting_event_s.nextval
INTO l_accounting_event_id
FROM dual;
INSERT into RCV_ACCOUNTING_EVENTS(
accounting_event_id,
last_update_date,
last_updated_by,
last_update_login,
creation_date,
created_by,
request_id,
program_application_id,
program_id,
program_udpate_date,
rcv_transaction_id,
event_type_id,
event_source,
event_source_id,
set_of_books_id,
org_id,
transfer_org_id,
organization_id,
transfer_organization_id,
debit_account_id,
credit_account_id,
/* Support for Landed Cost Management */
lcm_account_id,
transaction_date,
source_doc_quantity,
transaction_quantity,
primary_quantity,
source_doc_unit_of_measure,
transaction_unit_of_measure,
primary_unit_of_measure,
po_header_id,
po_release_id,
po_line_id,
po_line_location_id,
po_distribution_id,
inventory_item_id,
unit_price,
prior_unit_price,
intercompany_pricing_option,
transaction_amount,
nr_tax,
rec_tax,
nr_tax_amount,
rec_tax_amount,
prior_nr_tax,
prior_rec_tax,
currency_code,
currency_conversion_type,
currency_conversion_rate,
currency_conversion_date,
accounted_flag,
procurement_org_flag,
cross_ou_flag,
trx_flow_header_id,
invoiced_flag,
pa_addition_flag,
/* Support for Landed Cost Management */
unit_landed_cost)
(SELECT
l_accounting_event_id,
sysdate,
fnd_global.user_id,
fnd_global.login_id,
sysdate,
fnd_global.user_id,
fnd_global.conc_request_id,
fnd_global.prog_appl_id,
fnd_global.conc_program_id,
sysdate,
p_rcv_events_tbl(i).rcv_transaction_id,
p_rcv_events_tbl(i).event_type_id,
p_rcv_events_tbl(i).event_source,
decode(p_rcv_events_tbl(i).event_source,
'INVOICEMATCH', p_rcv_events_tbl(i).inv_distribution_id,
p_rcv_events_tbl(i).rcv_transaction_id),
p_rcv_events_tbl(i).set_of_books_id,
p_rcv_events_tbl(i).org_id,
p_rcv_events_tbl(i).transfer_org_id,
p_rcv_events_tbl(i).organization_id,
p_rcv_events_tbl(i).transfer_organization_id,
p_rcv_events_tbl(i).debit_account_id,
p_rcv_events_tbl(i).credit_account_id,
/* Support for Landed Cost Management */
p_rcv_events_tbl(i).lcm_account_id,
p_rcv_events_tbl(i).transaction_date,
decode(p_rcv_events_tbl(i).service_flag, 'N',
p_rcv_events_tbl(i).source_doc_quantity , NULL) source_doc_quantity,
decode(p_rcv_events_tbl(i).service_flag, 'N',
p_rcv_events_tbl(i).transaction_quantity , NULL) transaction_quantity,
decode(p_rcv_events_tbl(i).service_flag, 'N',
p_rcv_events_tbl(i).primary_quantity , NULL) primary_quantity,
p_rcv_events_tbl(i).source_doc_uom,
p_rcv_events_tbl(i).transaction_uom,
p_rcv_events_tbl(i).primary_uom,
p_rcv_events_tbl(i).po_header_id,
p_rcv_events_tbl(i).po_release_id,
p_rcv_events_tbl(i).po_line_id,
p_rcv_events_tbl(i).po_line_location_id,
p_rcv_events_tbl(i).po_distribution_id,
p_rcv_events_tbl(i).item_id,
decode(p_rcv_events_tbl(i).service_flag, 'N',
p_rcv_events_tbl(i).unit_price + p_rcv_events_tbl(i).unit_nr_tax, NULL) unit_price,
decode(p_rcv_events_tbl(i).event_source,'RETROPRICE',
p_rcv_events_tbl(i).prior_unit_price + p_rcv_events_tbl(i).prior_nr_tax,NULL),
p_rcv_events_tbl(i).intercompany_pricing_option,
decode(p_rcv_events_tbl(i).service_flag,'Y',
p_rcv_events_tbl(i).transaction_amount+
p_rcv_events_tbl(i).transaction_amount * p_rcv_events_tbl(i).unit_nr_tax, NULL),
decode(p_rcv_events_tbl(i).service_flag, 'N',
p_rcv_events_tbl(i).unit_nr_tax,NULL),
decode(p_rcv_events_tbl(i).service_flag, 'N',
p_rcv_events_tbl(i).unit_rec_tax,NULL),
decode(p_rcv_events_tbl(i).service_flag, 'Y',
p_rcv_events_tbl(i).transaction_amount*p_rcv_events_tbl(i).unit_nr_tax,NULL),
decode(p_rcv_events_tbl(i).service_flag, 'Y',
p_rcv_events_tbl(i).transaction_amount*p_rcv_events_tbl(i).unit_rec_tax,NULL),
decode(p_rcv_events_tbl(i).event_source,'RETROPRICE',
p_rcv_events_tbl(i).prior_nr_tax,NULL),
decode(p_rcv_events_tbl(i).event_source,'RETROPRICE',
p_rcv_events_tbl(i).prior_rec_tax,NULL),
p_rcv_events_tbl(i).Currency_code,
p_rcv_events_tbl(i).Currency_conversion_type,
p_rcv_events_tbl(i).Currency_conversion_rate,
p_rcv_events_tbl(i).Currency_conversion_date,
'N',
p_rcv_events_tbl(i).procurement_org_flag,
p_rcv_events_tbl(i).Cross_ou_flag,
p_rcv_events_tbl(i).trx_flow_header_id,
decode(p_rcv_events_tbl(i).event_type_id,
RCV_SeedEvents_PVT.INTERCOMPANY_INVOICE,'N',
RCV_SeedEvents_PVT.INTERCOMPANY_REVERSAL,'N',NULL),
'N', -- Will be changed by PA process
/* Support for Landed Cost Management */
p_rcv_events_tbl(i).unit_landed_cost
FROM DUAL);
l_api_message := 'Inserted '||SQL%ROWCOUNT||
'rows in RAE for org '||p_rcv_events_tbl(i).org_id;
,'Insert_RAEEvents : '||l_stmt_num||' : '||l_api_message);
l_api_message := 'Calling PA_PO_INTEGRATION_UTILS.Update_PA_Addition_Flg with '
|| 'p_api_version = '|| '1.0'
|| 'p_rcv_transaction_id = ' || p_rcv_events_tbl(i).rcv_transaction_id
|| 'p_po_distribution_id = ' || p_rcv_events_tbl(i).po_distribution_id
|| 'p_accounting_event_id = ' || l_accounting_event_id;
,'Insert_RAEEvents : '||l_stmt_num||' : '||l_api_message);
PA_PO_INTEGRATION_UTILS.Update_PA_Addition_Flg (
p_api_version => 1.0,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_rcv_transaction_id => p_rcv_events_tbl(i).rcv_transaction_id,
p_po_distribution_id => p_rcv_events_tbl(i).po_distribution_id,
p_accounting_event_id => l_accounting_event_id);
l_api_message := 'PA_PO_INTEGRATION_UTILS.Update_PA_Addition_Flg returned with '
|| 'x_return_status = '|| l_return_status
|| 'x_msg_count = ' || l_msg_count
|| 'x_msg_data = ' || l_msg_data;
,'Insert_RAEEvents : '||l_stmt_num||' : '||l_api_message);
l_api_message := 'Error in PA_PO_INTEGRATION_UTILS.Update_PA_Addition_Flg API';
,'Insert_RAEEvents : '||l_stmt_num||' : '||l_api_message);
,'Insert_RAEEvents >>');
ROLLBACK TO Insert_RAEEvents_PVT;
ROLLBACK TO Insert_RAEEvents_PVT;
ROLLBACK TO Insert_RAEEvents_PVT;
,'Insert_RAEEvents : '||l_stmt_num||' : '||substr(SQLERRM,1,200));
END Insert_RAEEvents;
SELECT nvl(FSP.purch_encumbrance_flag, 'N')
INTO l_encumbrance_flag
FROM financials_system_parameters FSP
WHERE FSP.set_of_books_id = p_rcv_sob_id;
PROCEDURE Insert_MMTEvents (
P_API_VERSION IN NUMBER,
P_INIT_MSG_LIST IN VARCHAR2,
P_COMMIT IN VARCHAR2,
P_VALIDATION_LEVEL IN NUMBER,
X_RETURN_STATUS OUT NOCOPY VARCHAR2,
X_MSG_COUNT OUT NOCOPY NUMBER,
X_MSG_DATA OUT NOCOPY VARCHAR2,
P_RCV_EVENTS_TBL IN RCV_SeedEvents_PVT.rcv_event_tbl_type
) IS
l_api_name CONSTANT VARCHAR2(30) := 'Insert_MMTEvents';
SAVEPOINT Insert_MMTEvents_PVT;
,'Insert_MMTEvents <<');
SELECT transaction_type
INTO l_rcv_txn_type
FROM rcv_transactions
WHERE transaction_id = p_rcv_events_tbl(l_ctr).rcv_transaction_id;
l_parent_txn_flag := 0; -- the first transaction inserted will be the parent, all others
,'Insert_MMTEvents >>');
ROLLBACK TO Insert_MMTEvents_PVT;
ROLLBACK TO Insert_MMTEvents_PVT;
ROLLBACK TO Insert_MMTEvents_PVT;
ROLLBACK TO Insert_MMTEvents_PVT;
END Insert_MMTEvents;
SELECT
p_rcv_event.organization_id,
p_rcv_event.item_id,
p_txn_type_id,
rt.po_header_id,
P_SIGN * ABS(p_rcv_event.transaction_quantity),
p_rcv_event.trx_uom_code,
P_SIGN * ABS(p_rcv_event.primary_quantity),
rt.transaction_date,
decode(nvl(fc.minimum_accountable_unit,0), 0,
round(l_unit_price*p_rcv_event.primary_quantity,fc.precision)*
p_rcv_event.currency_conversion_rate/p_rcv_event.primary_quantity,
round(l_unit_price*
p_rcv_event.primary_quantity/fc.minimum_accountable_unit) *
fc.minimum_accountable_unit*p_rcv_event.currency_conversion_rate/p_rcv_event.primary_quantity),
'RCV',
rt.transaction_id,
rt.transaction_id,
p_transfer_organization_id,
NULL, --pod.project_id, remove these 2 because projects will cause failure in inv's create_logical_txns
NULL, --pod.task_id, since they are only expected values in the org that does the deliver
poll.ship_to_location_id,
1,
p_rcv_event.trx_flow_header_id,
decode(nvl(fc.minimum_accountable_unit,0), 0,
round(p_intercompany_price*p_rcv_event.primary_quantity,fc.precision)
/p_rcv_event.primary_quantity,
round(p_intercompany_price*
p_rcv_event.primary_quantity/fc.minimum_accountable_unit) *
fc.minimum_accountable_unit
/p_rcv_event.primary_quantity),
p_intercompany_curr_code,
p_acct_id,
'N',
NULL,
NULL,
p_parent_txn_flag,
NULL
INTO
l_inv_trx.organization_id,
l_inv_trx.inventory_item_id,
l_inv_trx.transaction_type_id,
l_inv_trx.transaction_source_id,
l_inv_trx.transaction_quantity,
l_inv_trx.transaction_uom,
l_inv_trx.primary_quantity,
l_inv_trx.transaction_date,
l_inv_trx.transaction_cost,
l_inv_trx.source_code,
l_inv_trx.source_line_id,
l_inv_trx.rcv_transaction_id,
l_inv_trx.transfer_organization_id,
l_inv_trx.project_id,
l_inv_trx.task_id,
l_inv_trx.ship_to_location_id,
l_inv_trx.transaction_mode,
l_inv_trx.trx_flow_header_id,
l_inv_trx.intercompany_cost,
l_inv_trx.intercompany_currency_code,
l_inv_trx.distribution_account_id,
l_inv_trx.costed_flag,
l_inv_trx.subinventory_code,
l_inv_trx.locator_id,
l_inv_trx.parent_transaction_flag,
l_inv_trx.trx_source_line_id
FROM rcv_transactions RT,
po_lines POL,
po_line_locations POLL,
po_distributions POD,
fnd_currencies FC
WHERE RT.transaction_id = p_rcv_event.rcv_transaction_id
AND POL.po_line_id = p_rcv_event.po_line_id
AND POLL.line_location_id = p_rcv_event.po_line_location_id
AND POD.po_distribution_id = p_rcv_event.po_distribution_id
AND FC.currency_code = p_rcv_event.currency_code;
SELECT to_number(org_information2)
INTO l_le_id
FROM hr_organization_information
WHERE organization_id = p_rcv_event.organization_id
AND org_information_context = 'Accounting Information';
SELECT acct_period_id
INTO l_inv_trx.acct_period_id
FROM org_acct_periods
WHERE organization_id = p_rcv_event.organization_id
AND l_le_txn_date BETWEEN period_start_date AND schedule_close_date
AND open_flag = 'Y';