Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Query Help

Experts,

select T0.DocEntry, T0.DocNum, T1.ItemCode

,T1.Dscription, T1.Quantity,

T2.ItemCode, T2.Quantity

from OINV T0 inner join INV1 T1 on T0.DocEntry = T1.Docentry where

T0.DocNum = '12105744' inner join ODLN T2 on T1.BaseEntry = T2.

what condition to give to complete this query with "Return " too

Means details of one item in terms of AR invoice, Delivery and return

Plz help

Former Member
replied

--To follow the delivered goods you can start from this query:

Select         DD.DocNum'Delivery',D.DocDate,D.Quantity,
                  RR.DocNum'Return',R.DocDate,R.Quantity,
                  II.DocNum'Invoice',I.DocDate,I.Quantity,
		  CC.DocNum'Cred.N',C.DocDate,C.quantity
From  DLN1 D inner join ODLN DD on D.DocEntry=DD.DocEntry
   left outer join Inv1 I on (I.Basetype=15 and I.BaseEntry=D.DocEntry and I.BaseLine=D.LineNum)
   left outer join OINV II on I.DocEntry=II.DocEntry
   left outer join Rdn1 R on (R.Basetype=15 and R.BaseEntry=D.DocEntry and R.BaseLine=D.LineNum)
   left outer join ORDN RR on R.DocEntry=RR.DocEntry  
   left outer join RIN1 C on (C.Basetype=15 and C.BaseEntry=D.DocEntry and C.BaseLine=D.LineNum)
                          or (C.Basetype=13 and C.BaseEntry=I.DocEntry and C.BaseLine=I.LineNum)
   left outer join ORIN CC on CC.DocEntry=C.DocEntry

(This shows the credit notes too.)

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question