SELECT ad.asset_number Asset_Number,
ai.description Description,
ve.segment1||' - '||ve.vendor_name Vendor,
ai.invoice_number Invoice_Number,
ai.invoice_line_number||' - '||ai.ap_distribution_line_number Line,
&ACCT_FLEX_ACCT_SEG Payable_Account,
cb.asset_cost_acct Assets_Account,
ai.payables_cost Payable_Cost,
books.cost Assets_Cost,
--ADDED
fnd_flex_xml_publisher_apis.process_kff_combination_1('d_payable_account', 'SQLGL', 'GL#', glcc.CHART_OF_ACCOUNTS_ID, NULL, glcc.CODE_COMBINATION_ID, 'GL_ACCOUNT', 'Y', 'VALUE') D_PAYABLE_ACCOUNT
FROM
fa_system_controls sc,
fa_transaction_headers th,
fa_asset_invoices ai,
fa_additions ad,
fa_books books,
fa_asset_history ah,
fa_category_books cb,
po_vendors ve,
gl_code_combinations glcc
WHERE
th.date_effective >= :PERIOD1_POD AND
th.date_effective <= :PERIOD1_PCD AND
th.book_type_code = :P_BOOK AND
th.transaction_type_code in ('ADDITION', 'CIP ADDITION')
AND
ai.asset_id = th.asset_id AND
ai.split_code = 'SC'
AND
ad.asset_id = ai.asset_id
AND
books.transaction_header_id_in = th.transaction_header_id
AND
ve.vendor_id = ai.po_vendor_id
AND
ah.asset_id = ai.asset_id AND
ah.date_effective <= :PERIOD1_PCD AND
nvl(ah.date_ineffective, sysdate) >= :PERIOD1_PCD
AND
cb.category_id = ah.category_id AND
cb.book_type_code = th.book_type_code
AND
ai.payables_code_combination_id = glcc.code_combination_id
ORDER BY
ad.asset_number,
ai.invoice_number,
ai.invoice_Line_number||' - '||ai.ap_distribution_line_number |