Almost all companies using ERP Systems such as SAP Business One are wanted to restrict and analyze their sales through correct data submitted by their sales admin. Company management wants to know if their customers have outstanding invoices before they open another new sales order document. This will lead management to decide if these customers can buy products from them through the approval process in SAP Business One.
You can use the query below in Approval Templates menu so the approval process can be done in SAP Business One Hana version or SAP Business One SQL version:
/*HANA Query Version*/ SELECT DISTINCT 'True' FROM "OINV" T0 WHERE T0."CardCode"=$[$4.0.0] AND T0."DocStatus" ='O' AND T0."CANCELED"='N' AND T0."DocDueDate" < CURRENT_DATE
/*SQL Server Query Version*/ SELECT DISTINCT 'True' FROM dbo.[OINV] T0 WHERE T0.[CardCode]=$[$4.0.0] AND T0.[DocStatus] ='O' AND T0.[CANCELED]='N' AND T0.[DocDueDate] < GETDATE()