Wednesday 20 October 2010

Credit memo and its Invoice

I had few difficulties in finding the corresponding invoice number for a credit memo, for one my issue in Oracle incentive compensation and googled for it, but have not found anything useful.

Finally i have drafted the below simple query with the help of my team mate.

select A.TRX_NUMBER CMNO,
A.TRX_DATE CMDATE,
O.TRX_NUMBER INVNO,
O.TRX_DATE INVDATE
FROM RA_CUSTOMER_TRX_ALL A,
RA_CUSTOMER_TRX_ALL O
where
O.CUSTOMER_TRX_ID = A.PREVIOUS_CUSTOMER_TRX_ID
and A.trx_number like &enter_the_invoice_number

the above gives the corressponding the invoice number for a credit memo with the creation date.