How to Drilldown GL journal lines to Sub ledger transaction via SLA
Drill down from GL journal lines to Actual transaction can be done through sub ledger accounting (SLA).
XLA header, line number, and event id is a key to drill down from GL to source transaction via SLA
Bank account transfer (Cash management)
To get sub ledger document reference
SELECT pt.trxn_reference_number
INTO l_doc_no
FROM ce_cashflows cf
,ce_payment_transactions pt
, xla_distribution_links dl
WHERE cf.cashflow_id = dl.source_distribution_id_num_1
AND pt.trxn_reference_number = cf.trxn_reference_number
AND dl.ae_header_id = p_xla_header_id
AND dl.ae_line_num = p_xla_line_num
AND dl.event_id = p_event_id;
To get sub ledger document details
SELECT pt.trxn_reference_number
, pt.transaction_description
, pt.payment_currency_code
, pt.payment_amount
, pt.source_party_id
, pt.source_bank_account_id
, pt.destination_party_id
, pt.destination_bank_account_id
, pt.payment_reason_comments
, get_bank_details('BNAME',pt.destination_bank_account_id) bank_name
, get_bank_details('BBNAME',pt.destination_bank_account_id) branch_name
, get_bank_details('BACCNO',pt.destination_bank_account_id) bank_account_num
, get_bank_details('BACCNAME',pt.destination_bank_account_id) bank_account_name
INTO l_cash_management_rec
FROM ce_cashflows cf
, ce_payment_transactions pt
, xla_distribution_links dl
WHERE cf.cashflow_id = dl.source_distribution_id_num_1
AND pt.trxn_reference_number = cf.trxn_reference_number
AND dl.ae_header_id = p_xla_header_id
AND dl.ae_line_num = p_xla_line_num
AND dl.event_id = p_event_id;
Asset Additions
SELECT ad.asset_id
, ad.asset_number
, ad.asset_type
, ad.attribute_category_code
, ad.description
INTO l_asset_additions_rec
FROM fa_transaction_headers th
, xla_distribution_links xdl
, fa_additions ad
WHERE th.event_id = xdl.event_id
AND ad.asset_id = th.asset_id
AND xdl.ae_header_id = p_xla_header_id --11282906 --ref7
AND xdl.ae_line_num = p_xla_line_num --2 --ref8
AND th.event_id = p_event_id
AND transaction_type_code = 'ADDITION'; --11484663 -- distribution
Asset Depreciation
SELECT ad.asset_id
, ad.asset_number
, ad.asset_type
, ad.attribute_category_code
, ad.description
INTO l_depreciation_rec
FROM fa_deprn_detail d
, xla_distribution_links xdl
, fa_additions ad
WHERE d.event_id = xdl.event_id
AND ad.asset_id = d.asset_id
AND xdl.ae_header_id = p_xla_header_id --11282906 --ref7
AND xdl.ae_line_num = p_xla_line_num --2 --ref8
AND d.event_id = p_event_id ;
Asset Retirements
SELECT ad.asset_id
, ad.asset_number
, ad.asset_type
, ad.attribute_category_code
, ad.description
INTO l_asset_additions_rec
FROM fa_transaction_headers th
, xla_distribution_links xdl
, fa_additions ad
WHERE th.event_id = xdl.event_id
AND ad.asset_id = th.asset_id
AND xdl.ae_header_id = p_xla_header_id --11282906 --ref7
AND xdl.ae_line_num = p_xla_line_num --2 --ref8
AND th.event_id = p_event_id
AND transaction_type_code = 'FULL RETIREMENT'; --11484663 -- distribution
Comments
Post a Comment