A couple people asked for a E9 version of this BPM from this thread (Last date when BAQ was used - #4 by jhawt - ERP 9 - Epicor User Help Forum) so I threw one together quick. I have not tested this in production yet, use at your own risk.
This will actually end up being multiple BPM’s depending on what you want to capture. In E10 there are only two methods for DynamicQuery execution (Execute and ExecuteByID). In E9 there are 7 methods on the DynamicQuery BO (Execute, ExecuteByID, ExecuteByIDParametrized, ExecuteDashboardQuery, ExecuteDashboardQueryPaged, ExecuteFreeForm and ExecuteParameterized)
The code should be the same for all methods. For testing I’ve only setup this code on the ExecuteParameterized method as that is what’s called in the BAQ Designer and was easiest.
Starting off with the condition.
The condition is "Number of rows in the ‘IsNotSystem’ query is more than 0. The query just checks to see if the BAQ is a system BAQ or not. The query is;
for each ttDynamicQuery no-lock where ttDynamicQuery.Delivered = no
The action is executed ABL code
The code is as follows;
DEFINE variable sBAQID as character.
DEFINE variable sExecDate as character.
DEFINE variable sExecUser as character.
DEFINE variable sAssmName as character.
DEFINE variable sCompany as character.
DEFINE variable sCallMeth as character.
/* Change Key4 to match the BO method so you know how it was called */
sCallMeth = “EXECUTEPARAM”.
/* Set current date as string*/
sExecDate = string(DATETIME( TODAY, MTIME )).
/* Set calling assembly name and username*/
find first ttCallContextClient no-lock.
sAssmName = ttCallContextClient.AssemblyName.
sExecUser = ttCallContextClient.CurrentUserId.
sCompany = ttCallContextClient.CurrentCompany.
/* Set executing BAQ ID and Username */
find first ttDynamicQuery no-lock.
sBAQID = ttDynamicQuery.ExportID.
/* Create the UD25 row for this execution */
create UD25.
assign UD25.Company = sCompany.
assign UD25.Key1 = sBAQID.
assign UD25.Key2 = sExecUser.
assign UD25.Key3 = sExecDate.
assign UD25.Key4 = sCallMeth.
assign UD25.Key5 = “KEY5”.
assign UD25.Character01 = sAssmName.
assign UD25.Date01 = now.
I’ve set the key4 variable to be changed per BPM this code is added to, so you can see what BPM is firing it. The Character01 field is the assembly that is calling the execute method so you can see where it was called from.
Below is a quick BAQ showing the results.