T1.[DocEntry] =$[$8.0.0]
I believe this is the problem. $[$8.0.0] returns the DocNum, it is not equal to DocEntry.
SELECT 'TRUE' FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.DocNum = $[$8.0.0]
HAVING SUM(T1.DiscPrcnt) > 20
Frank