I want to find the outgoing excise invoice no. for goods return.For this I have used following query,
SELECT OOEI.DocNum FROM OOEI INNER JOIN OEI1 ON OOEI.DocEntry = OEI1.DocEntry
inner join orpd on orpd.docnum=OEI1.BaseRef
where orpd.docnum=20
In the above query 20 is the docnum of goods return.
The above query returned two values i.e 8,150. 150 is the correct value of outgoing excise invoice. The other value i.e 8 is created for delivery.
In the table OOEI, I am not able to differentiate delivery and goods return.