Task:How to find a AP invoice is validated or not through a SQL queryScript:SELECT i.invoice_id, i.invoice_amount, DECODE(APPS.AP_INVOICES_PKG.GET_APPROVAL_STATUS(i.invoice_id, i.invoice_amount,i.payment_status_flag,i.invoice_type_lookup_code), 'NEVER APPROVED', 'Never Validated', ...
AP_INV_APRVL_HIST_ALL table will give you all the details related to approval of particular invoice.Query to get the latest transaction on particular invoice :select created_by from AP_INV_APRVL_HIST_ALLwhere invoice_id = &inv_idand approval_history_id =(select max(approval_history_id) from AP_INV_APRVL_HIST_ALL where invoice_id = &inv_id )Query to get the Initiator of particular invoice :select created_by from AP_INV_APRVL_HIST_ALLwhere ...