The following lines contain the word 'select', 'insert', 'update' or 'delete':
PROCEDURE delete_tb_entries ( p_event_id IN NUMBER
,p_application_id IN NUMBER);
SELECT transaction_number
FROM xla_transaction_entities
WHERE entity_id = p_entity_id
AND application_id = p_application_id;
'SELECT $transaction_entity_columns$
FROM xla_transaction_entities ent
WHERE ent.application_id = :1
AND ent.entity_id = :2 ';
( SELECT xid.transaction_id_col_name_1 trx_col_1
,xid.transaction_id_col_name_2 trx_col_2
,xid.transaction_id_col_name_3 trx_col_3
,xid.transaction_id_col_name_4 trx_col_4
,xid.source_id_col_name_1 src_col_1
,xid.source_id_col_name_2 src_col_2
,xid.source_id_col_name_3 src_col_3
,xid.source_id_col_name_4 src_col_4
FROM xla_entity_id_mappings xid
WHERE xid.application_id = p_application_id -- input to the procedure
AND xid.entity_code = p_entity_code
)
LOOP
IF i.trx_col_1 IS NOT NULL THEN
l_join_string := l_join_string || ''''|| lower(i.TRX_COL_1) || ': '|| '''' || ' '|| '||' ||
'ENT.'|| i.src_col_1 || ' TRX_COL_1' || ',';
PROCEDURE delete_journal_entries
(p_api_version IN NUMBER
,p_init_msg_list IN VARCHAR2
,p_application_id IN INTEGER
,p_event_id IN INTEGER
,x_return_status OUT NOCOPY VARCHAR2
,x_msg_count OUT NOCOPY NUMBER
,x_msg_data OUT NOCOPY VARCHAR2
) IS
l_api_name CONSTANT VARCHAR2(30) := 'delete_journal_entries';
l_log_module := C_DEFAULT_MODULE||'.delete_journal_entries';
trace(p_msg => 'BEGIN of procedure delete_journal_entries',
p_module => l_log_module,
p_level => C_LEVEL_PROCEDURE);
select count(1)
into l_count
from xla_events xe
,xla_transaction_entities xte
where xe.application_id=p_application_id
and xe.event_id=p_event_id
and xe.entity_id=xte.entity_id
and xte.application_id=xe.application_id;
trace(p_msg => 'Journal entries cannot be deleted because either MO Security is not set for this session or Entity does not exist for this event',
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
,p_error_msg => 'Journal entries cannot be deleted because either MO Security is not set for this session or Entity does not exist for this event');
SELECT MAX(NVL(gl_transfer_status_code,'N')) -- N, NT, S, Y
INTO l_gl_transfer_status_code
FROM xla_ae_headers xah
WHERE application_id = p_application_id
AND event_id = p_event_id
-- added bug#8344908
AND NOT EXISTS
( SELECT 1
FROM xla_ae_lines xal, gl_import_references gir
WHERE xah.ae_header_id = xal.ae_header_id
AND xah.application_id = xal.application_id
AND xal.gl_sl_link_id = gir.gl_sl_link_id
AND xal.gl_sl_link_table = gir.gl_sl_link_table
);
trace(p_msg => 'No such journal entry or the journal entries are transferred to gl and cannot be deleted.',
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
,p_error_msg => 'No such journal entry or the journal entries are transferred to gl and cannot be deleted.');
'Journal entries cannot be deleted because it has either been Transferred or set to Not Transferred or gl_transfer_status_flag has an incorrect status as the journal entries are not transferred to General Ledger.',
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
,p_error_msg => 'Journal entries cannot be deleted because it has either been Transferred or set to Not Transferred or gl_transfer_status_flag has an incorrect status as the journal entries are not transferred to General Ledger.');
trace(p_msg => 'Calling xla_journal_entries_pkg.delete_journal_entries.',
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
xla_journal_entries_pkg.delete_journal_entries
(p_application_id => p_application_id
,p_event_id => p_event_id);
trace(p_msg => 'Update xla_events event_id'||p_event_id||' to Unprocessed.',
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
UPDATE XLA_EVENTS
SET EVENT_STATUS_CODE = xla_events_pub_pkg.C_EVENT_UNPROCESSED
,PROCESS_STATUS_CODE = xla_events_pkg.C_INTERNAL_UNPROCESSED
WHERE application_id = p_application_id
AND event_id = p_event_id;
trace(p_msg => 'END of procedure delete_journal_entries',
p_module => l_log_module,
p_level => C_LEVEL_PROCEDURE);
END delete_journal_entries;
a) delete the incomplete MPA
b) calls Create_Reversal_Entry of the ae_header_id to create the reversal of
the original entry, returning the new rev_ae_header_id and rev_event_id
i) calls Complete_Journal_Entry with rev_ae_header_id, p_event_id and
p_rev_flag = 'Y' to validate the reversal entry rev_ae_header_id and on
success,
-> calls Create_MRC_Reversal_Entry to create reversal of all other
ledgers and entries related to the original entry p_event_id.
c) Create a new event and entity, and map the original entry to the new
event id and entity id.
==============================================================================*/
PROCEDURE reverse_journal_entries
(p_api_version IN NUMBER
,p_init_msg_list IN VARCHAR2
,p_application_id IN INTEGER
,p_event_id IN INTEGER
,p_reversal_method IN VARCHAR2
,p_gl_date IN DATE
,p_post_to_gl_flag IN VARCHAR2
,x_return_status OUT NOCOPY VARCHAR2
,x_msg_count OUT NOCOPY NUMBER
,x_msg_data OUT NOCOPY VARCHAR2
,x_rev_ae_header_id OUT NOCOPY INTEGER
,x_rev_event_id OUT NOCOPY INTEGER
,x_rev_entity_id OUT NOCOPY INTEGER
,x_new_event_id OUT NOCOPY INTEGER
,x_new_entity_id OUT NOCOPY INTEGER
) IS
l_api_name CONSTANT VARCHAR2(30) := 'reverse_journal_entries';
SELECT /*+ leading(xah) */
gl.currency_code, xsu.je_source_name,
xah.entity_id, xah.accounting_date,
-- commented bug 11883762
-- xah.ledger_id,
--added bug 11883762
xte.ledger_id,
xte.legal_entity_id, xah.accrual_reversal_flag,
xle.budgetary_control_flag
FROM XLA_LEDGER_OPTIONS opt,
XLA_LEDGER_RELATIONSHIPS_V rs,
xla_gl_ledgers_v gl,
xla_ae_headers xah,
xla_subledgers xsu,
xla_events xle,
xla_transaction_entities xte
WHERE opt.LEDGER_ID = xah.ledger_id
AND opt.APPLICATION_ID = xah.application_id
AND xsu.application_id = xah.application_id
AND xah.event_id = p_event_id -- input parameters
AND xah.application_id = p_application_id -- input parameters
AND xah.event_id = xle.event_id
AND xah.application_id = xle.application_id
AND xah.entity_id = xte.entity_id
AND xah.application_id = xte.application_id
AND xah.parent_ae_header_id IS NULL
AND xah.accounting_entry_status_code = C_STATUS_FINAL_CODE
AND opt.ENABLED_FLAG = 'Y'
AND rs.LEDGER_ID = opt.LEDGER_ID
AND ( rs.LEDGER_CATEGORY_CODE = 'PRIMARY'
OR (rs.LEDGER_CATEGORY_CODE = 'SECONDARY'
AND xsu.valuation_method_flag = 'Y'
AND opt.CAPTURE_EVENT_FLAG = 'Y')
--added bug 11883762
OR (rs.LEDGER_CATEGORY_CODE = 'SECONDARY' AND rownum=1
AND not exists(select 1 from xla_ae_headers xah1 where xah1.entity_id=xah.entity_id
AND xah1.application_id=p_application_id
AND xah1.event_id=xah.event_id
AND xah1.ledger_id=rs.primary_ledger_id)))
--end bug 11883762
AND rs.RELATIONSHIP_ENABLED_FLAG = 'Y'
AND rs.ledger_id = gl.ledger_id
AND rs.SLA_ACCOUNTING_METHOD_CODE IS NOT NULL
AND NOT EXISTS (SELECT 1
FROM xla_ae_headers xah2
WHERE xah2.application_id = p_application_id
AND xah2.event_id = p_event_id
AND xah2.accounting_entry_status_code = C_STATUS_FINAL_CODE
AND NVL(xah2.gl_transfer_status_code,'N') IN ('N','NT')) -- can be reversed only if it is transferred
--Added bug#8344908
AND EXISTS
( SELECT 1
FROM xla_ae_lines xal, gl_import_references gir
WHERE xah.ae_header_id = xal.ae_header_id
AND xah.application_id = xal.application_id
AND xal.gl_sl_link_id = gir.gl_sl_link_id
AND xal.gl_sl_link_table = gir.gl_sl_link_table
);
SELECT entity_code
FROM xla_transaction_entities
WHERE application_id = p_application_id
AND entity_id = p_orig_entity_id;
select count(1)
into l_count
from xla_events xe
,xla_transaction_entities xte
where xe.application_id=p_application_id
and xe.event_id=p_event_id
and xe.entity_id=xte.entity_id
and xte.application_id=xe.application_id;
trace(p_msg => 'Journal entries cannot be deleted because either MO Security is not set for this session or Entity does not exist for this event',
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
,p_error_msg => 'Journal entries cannot be deleted because either MO Security is not set for this session or Entity does not exist for this event');
trace(p_msg => 'Delete entries from xla_trial_balances',
p_module => l_log_module,
p_level => C_LEVEL_PROCEDURE);
delete_tb_entries( p_event_id
,p_application_id);
SELECT /*+ leading(xah) */
xah.ae_header_id
BULK COLLECT INTO l_array_je_header_id
FROM XLA_LEDGER_OPTIONS opt,
XLA_LEDGER_RELATIONSHIPS_V rs,
xla_gl_ledgers_v gl,
xla_ae_headers xah,
xla_subledgers xsu,
xla_events xle,
xla_transaction_entities xte
WHERE opt.LEDGER_ID = xah.ledger_id
AND opt.APPLICATION_ID = xah.application_id
AND xsu.application_id = xah.application_id
AND xah.event_id = p_event_id -- input parameters
AND xah.application_id = p_application_id -- input parameters
AND xah.event_id = xle.event_id
AND xah.application_id = xle.application_id
AND xah.entity_id = xte.entity_id
AND xah.application_id = xte.application_id
AND xah.parent_ae_header_id IS NULL
AND xah.accounting_entry_status_code = C_STATUS_FINAL_CODE
AND opt.ENABLED_FLAG = 'Y'
AND rs.LEDGER_ID = opt.LEDGER_ID
AND ( rs.LEDGER_CATEGORY_CODE = 'PRIMARY'
OR (rs.LEDGER_CATEGORY_CODE = 'SECONDARY'
AND xsu.valuation_method_flag = 'Y'
AND opt.CAPTURE_EVENT_FLAG = 'Y')
--added bug 11883762
OR (rs.LEDGER_CATEGORY_CODE = 'SECONDARY' AND rownum=1
AND not exists(select 1 from xla_ae_headers xah1 where xah1.entity_id=xah.entity_id
AND xah1.application_id=p_application_id
AND xah1.event_id=xah.event_id
AND xah1.ledger_id=rs.primary_ledger_id)))
--end bug 11883762
AND rs.RELATIONSHIP_ENABLED_FLAG = 'Y'
AND rs.ledger_id = gl.ledger_id
AND NOT EXISTS (SELECT 1
FROM xla_ae_headers xah2
WHERE xah2.application_id = p_application_id
AND xah2.event_id = p_event_id
AND xah2.accounting_entry_status_code = C_STATUS_FINAL_CODE
AND NVL(xah2.gl_transfer_status_code,'N') IN ('N','NT')
) -- can be reversed only if it is transferred
AND rs.SLA_ACCOUNTING_METHOD_CODE IS NOT NULL;
SELECT MAX(NVL(MPA_ACCRUAL_ENTRY_FLAG,'N'))
INTO l_mpa_acc_rev_flag
FROM xla_ae_lines
WHERE application_id = p_application_id
AND ae_header_id in (SELECT ae_header_id
FROM xla_ae_headers
WHERE event_id = p_event_id
AND application_id = p_application_id);
FOR i in (SELECT ae_header_id
FROM xla_ae_headers
WHERE application_id = p_application_id
AND event_id = p_event_id
AND parent_ae_header_id IS NOT NULL
AND accounting_entry_status_code <> C_STATUS_FINAL_CODE ) LOOP
IF (C_LEVEL_STATEMENT >= g_log_level) THEN
trace(p_msg => 'Delete journal entry = '||i.ae_header_id,
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
DELETE xla_ae_lines
WHERE application_id = p_application_id
AND ae_header_id = i.ae_header_id;
DELETE xla_distribution_links
WHERE application_id = p_application_id
AND ae_header_id = i.ae_header_id;
DELETE xla_ae_headers
WHERE application_id = p_application_id
AND ae_header_id = i.ae_header_id;
update xla_ae_headers
set accounting_entry_type_code = 'MANUAL'
where application_id = p_application_id
and event_id = p_event_id;
SELECT entity_id
INTO x_rev_entity_id
FROM xla_events
WHERE application_id = p_application_id
AND event_id = x_rev_event_id
AND rownum = 1;
UPDATE xla_transaction_entities
SET (entity_code
, source_id_int_1
, source_id_char_1
, security_id_int_1
, security_id_int_2
, security_id_int_3
, security_id_char_1
, security_id_char_2
, security_id_char_3
, source_id_int_2
, source_id_char_2
, source_id_int_3
, source_id_char_3
, source_id_int_4
, source_id_char_4
, valuation_method
, source_application_id
, upg_batch_id
, upg_source_application_id
, upg_valid_flag
, transaction_number
-- legal_entity_id
-- ledger_id
, creation_date
, created_by
, last_update_date
, last_updated_by
, last_update_login) = (SELECT 'MANUAL' -- entity_code This also prevents transaction to be used in bflow.
,source_id_int_1
,source_id_char_1
,security_id_int_1
,security_id_int_2
,security_id_int_3
,security_id_char_1
,security_id_char_2
,security_id_char_3
,source_id_int_2
,source_id_char_2
,source_id_int_3
,source_id_char_3
,source_id_int_4
,source_id_char_4
,valuation_method
,source_application_id
,upg_batch_id
,upg_source_application_id
,upg_valid_flag
,transaction_number --bug#8279661
-- legal_entity_id
-- ledger_id
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.user_id
FROM xla_transaction_entities
WHERE application_id = p_application_id
AND entity_id = l_entity_id)
WHERE application_id = p_application_id
AND entity_id = x_rev_entity_id;
UPDATE xla_events
SET event_status_code = xla_events_pub_pkg.C_EVENT_PROCESSED
, process_status_code = xla_events_pub_pkg.C_EVENT_PROCESSED
,(event_type_code
, event_date
, reference_num_1
, reference_num_2
, reference_num_3
, reference_num_4
, reference_char_1
, reference_char_2
, reference_char_3
, reference_char_4
, reference_date_1
, reference_date_2
, reference_date_3
, reference_date_4
, on_hold_flag
, upg_batch_id
, upg_source_application_id
, upg_valid_flag
, transaction_date
, budgetary_control_flag
, merge_event_set_id
-- event_number
, creation_date
, created_by
, last_update_date
, last_updated_by
, last_update_login
, program_update_date
, program_application_id
, program_id
, request_id) = (SELECT 'MANUAL' -- event_type_code
, event_date
, reference_num_1
, reference_num_2
, reference_num_3
, reference_num_4
, reference_char_1
, reference_char_2
, reference_char_3
, reference_char_4
, reference_date_1
, reference_date_2
, reference_date_3
, reference_date_4
, on_hold_flag
, upg_batch_id
, upg_source_application_id
, upg_valid_flag
, transaction_date
, budgetary_control_flag
, merge_event_set_id
-- event_number
, sysdate
, fnd_global.user_id
, sysdate
, fnd_global.user_id
, fnd_global.user_id
, sysdate
, -1
, -1
, -1
FROM xla_events
WHERE application_id = p_application_id
AND event_id = p_event_id)
WHERE application_id = p_application_id
AND event_id = x_new_event_id
RETURNING entity_id INTO x_new_entity_id;
UPDATE xla_transaction_entities
SET (entity_code
, source_id_int_1
, source_id_char_1
, security_id_int_1
, security_id_int_2
, security_id_int_3
, security_id_char_1
, security_id_char_2
, security_id_char_3
, source_id_int_2
, source_id_char_2
, source_id_int_3
, source_id_char_3
, source_id_int_4
, source_id_char_4
, valuation_method
, source_application_id
, upg_batch_id
, upg_source_application_id
, upg_valid_flag
, transaction_number
-- legal_entity_id
-- ledger_id
, creation_date
, created_by
, last_update_date
, last_updated_by
, last_update_login) = (SELECT 'MANUAL' -- entity_code This also prevents transaction to be used in bflow.
,source_id_int_1
,source_id_char_1
,security_id_int_1
,security_id_int_2
,security_id_int_3
,security_id_char_1
,security_id_char_2
,security_id_char_3
,source_id_int_2
,source_id_char_2
,source_id_int_3
,source_id_char_3
,source_id_int_4
,source_id_char_4
,valuation_method
,source_application_id
,upg_batch_id
,upg_source_application_id
,upg_valid_flag
,transaction_number -- bug#8279661
-- legal_entity_id
-- ledger_id
,sysdate
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,fnd_global.user_id
FROM xla_transaction_entities
WHERE application_id = p_application_id
AND entity_id = l_entity_id)
WHERE application_id = p_application_id
AND entity_id = x_new_entity_id;
trace(p_msg => 'Update xla_ae_headers',
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
UPDATE xla_ae_headers
SET entity_id = x_new_entity_id
,event_id = x_new_event_id
,event_type_code = 'MANUAL'
,description = l_new_description -- 'Data fix entry: event_id of '||p_event_id
WHERE application_id = p_application_id
AND event_id = p_event_id
RETURNING ae_header_id BULK COLLECT INTO l_array_ae_header_id;
trace(p_msg => 'Update xla_ae_lines',
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
UPDATE xla_ae_lines
SET description = l_new_description --'Data fix entry: event_id of '||p_event_id
-- business_class_code = NULL -- This is not needed to prevent use by bflow since the entity_code is now 'MANUAL'
WHERE application_id = p_application_id
AND ae_header_id = l_array_ae_header_id(i);
trace(p_msg => 'Update xla_distribution_links',
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
UPDATE xla_distribution_links
SET event_id = x_new_event_id,
temp_line_num = abs(temp_line_num) -- added for RCA bug#8421688
WHERE application_id = p_application_id
AND ae_header_id = l_array_ae_header_id(i);
is resulting in accounting error as the NOT EXISTS of the following select fails in xla_ae_lines_pkg
accounting_reversal procedure.
SELECT 1 FROM xla_distribution_links xdl
WHERE ref_ae_header_id = xdl.ae_header_id
AND temp_line_num = xdl.temp_line_num * -1
AND application_id = xdl.application_id
Fix is to make the E3 event temp_line_num +ve for a cancelled event in xla_distribution_links table
using abs(temp_line_num).
*/
IF (C_LEVEL_STATEMENT >= g_log_level) THEN
trace(p_msg => 'Update xla_events',
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
UPDATE XLA_EVENTS
SET EVENT_STATUS_CODE = xla_events_pub_pkg.C_EVENT_UNPROCESSED
,PROCESS_STATUS_CODE = xla_events_pkg.C_INTERNAL_UNPROCESSED
WHERE application_id = p_application_id
AND event_id = p_event_id;
trace(p_msg => 'Update descriptions',
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
UPDATE xla_ae_headers
SET description = l_new_description --'Data fix reversal entry: event_id of '||x_new_event_id
WHERE application_id = p_application_id
AND event_id = x_rev_event_id
RETURNING ae_header_id BULK COLLECT INTO l_array_ae_header_id;
UPDATE xla_ae_lines
SET description = l_new_description -- 'Data fix reversal entry: event_id of '||x_new_event_id
WHERE application_id = p_application_id
AND ae_header_id = l_array_ae_header_id(i);
SELECT DECODE(NVL(budgetary_control_flag,'N'),'Y', C_STATUS_FUNDS_RESERVE, C_STATUS_FINAL),process_status_code
INTO l_accounting_mode, l_process_status
FROM xla_events
WHERE application_id = p_application_id
AND event_id = p_event_id;
INSERT INTO xla_acct_prog_events_gt (event_id, ledger_id)
VALUES (p_event_id, null);
SELECT process_status_code
INTO l_process_status
FROM xla_events
WHERE application_id = p_application_id
AND event_id = p_event_id;
global_accounting_errors.DELETE;
UPDATE xla_ae_headers
SET gl_transfer_status_code = 'NT'
WHERE application_id = p_application_id
AND ae_header_id = p_ae_header_id
AND accounting_entry_status_code = C_STATUS_FINAL_CODE
AND gl_transfer_status_code = 'N'; -- if already transferred, S or Y, then do not set to NT.
trace(p_msg => 'Rows updated = '||l_dummy,
p_module => l_log_module,
p_level => C_LEVEL_STATEMENT);
PROCEDURE delete_tb_entries( p_event_id IN NUMBER
,p_application_id IN NUMBER)
IS
l_log_module VARCHAR2(240);
l_log_module := C_DEFAULT_MODULE||'.delete_tb_entries';
trace(p_msg => 'BEGIN of procedure delete tb entries',
p_module => l_log_module,
p_level => C_LEVEL_PROCEDURE);
FOR i in ( SELECT xah.ae_header_id
,xah.accounting_date
,xah.ledger_id
,xah.entity_id
,xtb.definition_code
FROM xla_ae_headers xah
,xla_tb_defn_je_sources xtbje
,xla_tb_definitions_vl xtb
,xla_subledgers xsl
WHERE xah.application_id = p_application_id
AND xah.event_id = p_event_id
AND xtb.ledger_id = xah.ledger_id
AND xtb.definition_code = xtbje.definition_code
AND xsl.application_id = xah.application_id
AND xsl.je_source_name = xtbje.je_source_name
AND xtb.enabled_flag = 'Y'
)
LOOP
DELETE FROM xla_trial_balances
WHERE definition_code = i.definition_code
AND ae_header_id = i.ae_header_id
AND gl_date between (i.accounting_date-2) and (i.accounting_date+2)
AND ledger_id = i.ledger_id
AND source_entity_id = i.entity_id
AND source_application_id = p_application_id;
trace(p_msg => 'END of procedure delete tb entries',
p_module => l_log_module,
p_level => C_LEVEL_PROCEDURE);
SELECT count(*)
INTO l_dummy
FROM xla_ae_headers
WHERE application_id = p_application_id
AND ae_header_id = p_ae_header_id
AND accounting_entry_status_code = C_STATUS_FINAL_CODE;
FOR i IN (SELECT error_message_name
FROM xla_upg_errors
WHERE application_id = p_application_id
AND ae_header_id = p_ae_header_id) LOOP
Log_error(p_error_name => i.ERROR_MESSAGE_NAME);
UPDATE XLA_AE_HEADERS
SET LAST_UPDATE_DATE = sysdate
,UPG_BATCH_ID = -9999
WHERE application_id = p_application_id
AND ae_header_id = p_ae_header_id;
UPDATE XLA_AE_LINES
SET LAST_UPDATE_DATE = sysdate
,UPG_BATCH_ID = -9999
WHERE application_id = p_application_id
AND ae_header_id = p_ae_header_id
AND ae_line_num = p_ae_line_num;
UPDATE XLA_EVENTS
SET LAST_UPDATE_DATE = sysdate
,UPG_BATCH_ID = -9999
WHERE application_id = p_application_id
AND event_id = p_event_id;
UPDATE XLA_AE_HEADERS
SET LAST_UPDATE_DATE = sysdate
,UPG_BATCH_ID = -9999
WHERE application_id = p_application_id
AND event_id = p_event_id
RETURNING ae_header_id BULK COLLECT INTO l_array_ae_header_id;
UPDATE XLA_AE_LINES
SET LAST_UPDATE_DATE = sysdate
,UPG_BATCH_ID = -9999
WHERE application_id = p_application_id
AND ae_header_id = l_array_ae_header_id(i);