Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.

Saturday, December 5, 2015

Display the Custom Message When The Users Try To Enter More Than 8 Hours Per Day in Oracle Time and Labor (OTL)

Display the below custom message when user try to entering more than 8 hours per day


1) Compile the below function(APPS.XXAA_MORETHAN_8_HRS_FUNC) in apps schema.
-->======================================================================
CREATE OR REPLACE FUNCTION APPS.XXAA_MORETHAN_8_HRS_FUNC(P_RESOURCE_ID NUMBER)
RETURN NUMBER
/* *****************************************************************
Author       : Raju Chinthapatla
Description  : It returns the 1 value when person enters more than 8 hrs per day
***************************************************************** */
IS
    l_return_rule_status number := 0;
    l_timecard_info  hxc_self_service_time_deposit.timecard_info;
    l_tbb_array HXC_BLOCK_TABLE_TYPE;
BEGIN
l_timecard_info := hxc_self_service_time_deposit.get_building_blocks;
l_tbb_array := hxc_deposit_wrapper_utilities.blocks_to_array(p_blocks => l_timecard_info);

IF l_tbb_array.FIRST IS NOT NULL THEN
    FOR i IN l_tbb_array.FIRST .. l_tbb_array.LAST
    LOOP
        IF l_tbb_array(i).MEASURE > 8 and l_tbb_array(i).SCOPE = 'DETAIL'
        THEN
            l_return_rule_status := 1;
            return l_return_rule_status;
        END IF;
        END LOOP;
END IF;
RETURN l_return_rule_status;
END XXAA_MORETHAN_8_HRS_FUNC;
-->======================================================================


2) Create a custom message to display when the users enter more than 8 hours a day
Nav : Application Developer -->Application -->Messages


Name : XXAA_MORETHAN_8_HRS_MSG
Language : US
Application : Time and Labor Engine
Current Message text : Please Do Not Enter More Than 24 Hours Per a Day


3) Create a Formula Function
Nav : Global Super HRMS Manager -->Other Definitions -->Formula Functions


Name : XXAA_MORETHAN_8_HRS_FUNCTION
Data Type : Number
Class : External function
Alias Name : XXAA_MORETHAN_8_HRS_FUNC
Definition : XXAA_MORETHAN_8_HRS_FUNC

Click on Parameters button


Parameter Name : P_RESOURCE_ID
Type : Number
Class : Input Only


4) Create a Write Formulas
Nav : Global Super HRMS Manager -->Total Compensation -->Basic -->Write Formulas


Name : XXAA_MORETHAN_8_HRS
Type : OTL Time Entry Rules
Description : Do Not Enter More Than 8 Hours Per a Day

Save and re query the formula and click on Edit button


Enter the below code
/* *****************************************************************
Formula Name : XXAA_MORETHAN_8_HRS
Author       : Raju Chinthapatla
Description  : To Stop Users from Entering More Than 8 Hours in a Day
Contexts     : None
***************************************************************** */

/*     Initialise Variables which can be null
*****************************************************************
*/
default for db_pre_period_start is ' '
default for db_pre_period_end is ' '
default for db_post_period_start is ' '
default for db_post_period_end is ' '
default for db_ref_period_start is ' '
default for db_ref_period_end is ' '
default for timecard_hrs is 0
/* ******************************************************************
         READ IN INPUT VARIABLES
****************************************************************** */
INPUTS ARE resource_id     (number)
,    submission_date  (text)
,    db_pre_period_start (text)
,    db_pre_period_end (text)
,    db_post_period_start (text)
,    db_post_period_end (text)
,    db_ref_period_start (text)
,    db_ref_period_end   (text)
,    timecard_hrs     (number)

IF ( XXAA_MORETHAN_8_HRS_FUNC(resource_id) = 1 )
THEN
(rule_status = 'E'
    message1 = 'XXAA_MORETHAN_8_HRS_MSG'
    return rule_status,message1)
ELSE
    (rule_status = 'S'
    return rule_status)

/* ***************************************************************** */


Clink on Verify button and Save

5) Create a Time Entry Rule with custom formula
Nav : OTL Super Administrator -->Time Entry Rules -->Define Time Entry Rules


Name : Do Not Enter More Than 8 Hours Per a Day - Rule
Description : Do Not Enter More Than 8 Hours Per a Day
Usage : Submission / Resubmission
Formula : Do Not Enter More Than 8 Hours Per a Day
From : 20-DEC-2014(Note : From date should be after the formula date)


6) Create a Time Entry Rule Group with the TER you just created in it
Nav : OTL Super Administrator -->Time Entry Rules -->Define Time Entry Rule Group


Name : Do Not Enter More Than 8 Hours Per A Day
TER Name : Do Not Enter More Than 8 Hours Per A Day
From : 19-DEC-2014
Outcome : Error


7) Assign the Time Entry Rule Group to the employee(s) via the Time Entry Rule Group preference
Nav : OTL Super Administrator -->Preferences


-->Preferences
Right Click on any preference and click on New
Name in Tree : XXAA Exceeds Time Entry Hours Node


Right Click on XXAA Exceeds Time Entry Hours Node preference and click on New


Name in Tree : Do Not Enter More Than 8 Hours - Preference
Preference : Time Store Time Entry Rules
Preference Value -->Time Entry Rule : Do Not Enter More Than 8 Hours


Click on Eligibility Criteria Tab
Name of rule : Do Not Enter More Than 24 Hours - Eligibility Criteria
Name of Branch : XXAA Exceeds Time Entry Hours Node
Link by : All People
Precedence : 90(Max Number)
From : 01-JAN-2000


Click on People tab and Check the preference is assigned or not



Testing
Create a Time Card with more than 8 hours per day
Nav : Timecard - US --> Time -->Create Timecard

Scenario : Enter the time card with more than 8 hours per day and click on Continue


It will show the custom message

3 comments:

Unknown said...

nice it is helpful.. We cant use PAGCTX standard extension package or validation?

Unknown said...

Dear Team,
Instead of This there is an other way to achieve this scenario.
-- Define the Time categories (You need to select the required people / projects/ Expenditure Type ..ETC)
-- Define the Time entry rule by using the maximum & Min Hours formula (Here there are fields to validate Min and max Hours)
-- Define TER Groups
-- Attach to Preferences
-- Test Scenario now

Thanks,
SHANKAR

Sherif said...

How can I prevent zero timeentry in oracle cloud OTL?

Post a Comment

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Best Blogger TipsGet Flower Effect