Skip to Content
0
Jun 08, 2018 at 04:50 AM

Query to display Invoice rows with chart of account

94 Views

Hi Experts

I have written a query that gives the invoiced items by rows. This part works perfectly

But what i need is the chart of account for each row and i have joined the OACT table but i cant seem to get the correct account number, i even tried to add the segments but the number in the result vary to what is in the AR Invoice window

What do i need to do? Where am i going wrong? Below is the query i have written without the account details

SELECT 

T0.[DocNum], 

T1.[U_Prod_Order_No], 

T1.[ItemCode], 

T1.[Dscription], 

T1.[Quantity], 

T1.[PriceBefDi], 

T1.[DiscPrcnt], 

T1.[LineTotal] 

FROM OINV T0  INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OACT T2 ON T0.[CtlAccount] = T2.[AcctCode] 

WHERE T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]

Please help

Regards

Rahul