Skip to Content
0
Former Member
Jan 21, 2011 at 02:21 PM

What field will report the true invoice value

20 Views

This script is giving me a figure that does not always match the 'Total AR Invoice' against a customer in SAP Sales Analysis, as far as I can see the reported figure is greater than the SAP figure - can nayone help me put this right please?

SELECT

t0.cardcode as 'Customer Code',

t0.cardname as 'Customer name',

t2.slpname as 'Sales Person',

sum(t0.doctotal-t0.vatsum) as 'Invoiced Value'

FROM

oinv t0

inner join ocrd t1 on t0.cardcode = t1.cardcode

inner join oslp t2 on t1.slpcode = t2.slpcode

WHERE

t0.docdate between [%1] and [%2]

GROUP BY

t0.cardcode,

t0.cardname,

t2.slpname

HAVING

sum(t0.doctotal-t0.vatsum) > 0

ORDER BY

t2.slpname,

t0.cardcode

Thanks,

Robin