Tuesday, March 21, 2017

How to debug a Fast Formula

How to Debug the Fast Formula
There are many ways the Fast Formula can be debugged. The different teams that use Fast formula provided different method to debug the formula.  We try to go through the most commonly used methods to debug the Fast Formula.
Some of these methods may be obsolete or not available in your version. Please confirm with your support/document about the usage of these methods.

ESS_LOG_WRITE
Syntax:  l_var = ESS_LOG_WRITE(‘Test Fast Formula’)
This is the Most commonly used method to debug the fast formula. The output of this method is written in the ESS Log.  The limitation of this method is that the method is not useful unless the Fast Formula is processed by the ESS. In other word if the Fast Formula is executed from the UI, this method cannot create any logs.
How to see these logs:
Every team provides an option see the ESS progress (Monitor Page). The navigation path may differ for each team. We take the Compensation page as example to show how the ESS logs can be viewed.
In Compensation Home Page, chose the Run Batch Process.
In the Run Batch Process page, Click on Monitor Process button.
In the monitor page, we turn Hierarchy flag on, which is our preferred way of seeing the process but it is up to your preference. The Fast Formula are processed by Child Process in Compensation, it may be different in other process. Select the child process. You can see the details in the end of the screen; you may need to go to the end, in case if you have too many processes.  In the End you see the attachment as ESS_L_99999.
In some versions, you need to select the process and click the View Log button to see the log file.


HR_TRACE/HRTRACE:
Syntax:  l_var = HR_TRACE (‘Test Fast Formula’)    or l_var = HRTRACE (‘Test Fast Formula’)
HR_TRACE is the method name and HTRACE is the alias for the method. You can use either the name to execute this method.  This method works only if you have setup a PLSQL trace on. This will create an output File as you define in your debug setup. This debug setup also enables the debug for entire PL/SQL process.  This method returns ‘TRUE’ if the log is written otherwise ‘FALSE’. The limitation of this method is, you need to enable the PL/SQL debuger and needs to have DB structure access to retrieve the output file or you need to know someone who can do that for you.  If you do not know how to turn on the debugger please talk to your support to provide the document.

PAY_INTERNAL_LOG_WRITE:
Syntax:  l_var = PAY_INTERNAL_LOG_WRITE(;Test Fast Formula’).
This method is provided by Payroll, it is an alternative to ESS_LOG_WRITE. This is available only for payroll process. The payroll document describes the method as ‘If your formulas are executed from the Payroll Run you can set the F flag for Payroll debug and make PAY_INTERNAL_LOG_WRITE formula function calls to output the messages to the ESS log file.’
DEBUG:
Syntax:  l_var = debug(Test Fast Formula’).
This is a clone of HR_TRACE. 
US_FORMULA_LOGGING/CA_FORMULA_LOGGING:
Syntax:  l_var = XX_FORMULA_LOGGING (‘CODE’, ‘Test Fast Formula’).
These methods accepts two parameters, code and message. The code is expected to be more than three characters.
For Simple User, this is same as HR_TRACE,
ADD_RLOG:
Syntax:  l_num = ADD_RLOG (ff_id,rule_id, ‘Test Fast Formula’).
This method is provided by Oracle Time and Labor (OTL) Team. This method accepts three parameters, Formula Id, Rule ID and the message. The logs are written in to one of their table. The method returns the number 1.
You can get the ff_id and rule_id from the context HWM_FFS_ID, and HWM_RULE_ID
ADD_LOG
Syntax:  l_num = ADD_LOG (ff_id, ‘Test Fast Formula’).
This is a subset of ADD_RLOG method. The Rule_id is internally determined by this method. The functionality is same as ADD_RLOG.
 How to See OTL  Logs: 
 From Navigator, select 'Workforce Management' > 'Time Management'
From Time Management, select 'Analyze Rule Processing Details'
On search screen, select Rule set name, click search
On search results, click on Time card Processing Id to view detail
On Analyze Rule Processing Details page you can look at the  Rule processing log.

Hope this helps