GET_PLAN_BALANCE and GET_ACCRUAL_BALANCE
GET_PLAN_BALANCE gives you the plan balance of the last accrual run prior to effective date while GET_ACCRUAL_BALANCE gets you the balance value as of balance calculation date. So if you have already ran your accruals till a future date say 31-DEC-2021 and you try to fetch a plan balance value as of today say 25-Feb-2021 then GET_PLAN_BALANCE will give you the value as of 31-JAN-2021 (last accrual period date prior to 25-FEB-2021) while GET_ACCRUAL_BALANCE will give you the value of 31-DEC-2021 (which is the balance stored on last accrual period till which accruals have been run).
GET_PLAN_BALANCE Example:
/*****
FORMULA NAME: BCT_IN_EL_DISBURSEMENT
FORMULA TYPE: Global Absence Discretionary Disbursement Rule
DESCRIPTION: This formula dictates what minimum / maximum / increments are allowed
Change History:
Name Date Version Comments
-------------------------------------------------------------------------------
Dinesh.N 09-Feb-2021 DRAFT 1A Initial Version
*******************************************************************************/
INPUTS ARE IV_PERSON_ID
DEFAULT FOR IV_PERSON_ID IS 0
L_Person_Id = IV_PERSON_ID
l_assignment_id=GET_CONTEXT(HR_ASSIGNMENT_ID,0)
L_EFF_DATE = get_context(effective_date,'4712/12/31 00:00:00' (date))
L_Accrual_Plan_ID = 300000082209385
L_LEGISLATIVE_DATA_GROUP = 300000009608814
L_Leave_Balance = 0
MIN =1
MAX = 40
INCREMENT = 1
l_log = ESS_LOG_WRITE('Initial Max Value' + TO_CHAR(Max))
CHANGE_CONTEXTS(ACCRUAL_PLAN_ID = L_Accrual_Plan_ID, HR_ASSIGNMENT_ID = l_assignment_id, PERSON_ID = L_Person_Id, EFFECTIVE_DATE =L_EFF_DATE,LEGISLATIVE_DATA_GROUP_ID=L_LEGISLATIVE_DATA_GROUP )
(
L_Leave_Balance = GET_PLAN_BALANCE('Test EL')
l_log = ESS_LOG_WRITE('Leave Balance' + TO_CHAR(L_Leave_Balance))
)
IF GET_PLAN_BALANCE('Test EL') > 30 THEN
(
MAX = (GET_PLAN_BALANCE('Test EL')-30)
l_log = ESS_LOG_WRITE('If Condition Max Value' + TO_CHAR(Max))
)
RETURN MIN,MAX,INCREMENT
0 Comments