Hi,
Try this query for open GRPO that not posted to AP invoice:
SELECT T0.[DocNum], T0.[CardCode], T0.[CardName], T0.[DocDueDate] FROM OPDN T0 WHERE datediff(day, T0.[DocDueDate],getdate()) >=5 and T0.[DocStatus] ='o' and T0.[CardCode] = 'XXX'
Thanks & Regards,
Nagarajan