Skip to Content
avatar image
Former Member

Need Last RunDate for Queries

Hello - I am trying to reduce the number of open queries I have in SAP B1. Trying to create a query/report that shows Last RUN DATE of the queries from OUQR but the Date is NULL. How can I get the last RUN date for all queries

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 31, 2017 at 10:17 AM

    Hi Daniel,

    Basically its works as per standard design, but if you required to update the Last Run date time then you have to modified your queries.

    Please find the below format.

    Lets you have one query For example query

    SELECT Top 5 DocDate,DocNum,CardName,DocTotal from OINV order by Doctotal desc

    I used this query:

    DECLARE @UserQuery nvarchar(max) = 'SELECT Top 5 DocDate,DocNum,CardName,DocTotal from OINV order by Doctotal desc'

    EXEC sp_executesql @UserQuery

    UPDATE OUQR SET QLastDate = GetDate() where cast(QString as nvarchar(max)) like '%'+@UserQuery +'%'

    When user executed query In OUQR table field QLastDate will be updated.

    Its Hope helpful answer.

    Rgds,

    Kamlesh Naware

    Add comment
    10|10000 characters needed characters exceeded