With Query Manager on SAP Business One, not just a select syntax, you can also use a selection criteria, and added to your custom query. Here is a simple query sample with a date criteria parameter.
With a [Date From] – [Date To] on OINV Table
declare @FromDate date
declare @ToDate date
set @FromDate = ‘2019-01-01’
set @ToDate =’2019-01-31’
SELECT * FROM OINV
WHERE DocDate >= @FromDate
AND DocDate <= @ToDate
So, you need to change that query, to be like query below:
/*SELECT * FROM OINV TO*/
declare @FromDate date
declare @ToDate date
/* WHERE */
set @FromDate = /* T0.DocDate */‘[%0]’
set @ToDate =/* T0.DocDate */ ‘[%1]’
SELECT * FROM OINV
WHERE DocDate >= @FromDate
AND DocDate <= @ToDate
That’s it, you can try to use that basic composition for declare the variable and use selection criteria on your custom query on Query Manager feature.
Is Your SAP Business One Query Still Static?
Static queries make data retrieval less efficient and often require repeated editing. If you need dynamic queries tailored to your business requirements, our team is ready to help analyze and implement the right solution.








