Carry Over Leave Balance to Next Year Until Specific Date Automatically using Integration Center in new Time Account
2023-10-24 16:38:34 Author: blogs.sap.com(查看原文) 阅读量:10 收藏

Hello Everyone,

We have seen this requirement in most of the cases where business allow users to carry over specific number of leaves to the next year and employees can use those leaves only in first 3 months or maybe first 6 months.

There are multiple ways how this can be done using Interim rule or Business Rules but today I am going to show you the process which will take care of carrying balance over to next year automatically at the end of current year and will restrict users to take these leaves only for First 3 months in next year. All this will happen using custom Integration and no need to run Interim rules or rely on any another business rule.

Here is my business case

  1. Time Type – Annual Leave (Singapore)
  2. No of Leaves which can be carried over next year – Max up to 10 Days
  3. Leaves to be utilized next year before – 31st Mar of next year

Step 1 – Create Custom field on Time Account “Balance as of PEP” where we can store the balance which needs to be carried over to next year

Go%20to%20Configure%20Object%20Definition%2C%20Select%20Time%20Account%20as%20object%20and%20create%20a%20custom%20field

Go to Configure Object Definition, Select Time Account as object and create a custom field

The%20field%20should%20be%20of%20Decimal%20type%20which%20will%20allow%20us%20to%20store%20the%20balance%20from%20current%20year%20in%20this%20field

The field should be of Decimal type which will allow us to store the balance from current year in this field

Step 2 – Create Time Account Type “Annual Leave” which will be regular Time Account Type assigned to Leave and it will Post leaves on year to year basis.

Time%20Account%20Type%20Settings

Time Account Type Settings

Hire%20Rule%20-%20Here%20we%20are%20allotting%2025%20Laves%20to%20employee%20at%20the%20time%20of%20hiring%20without%20Proration

Hire Rule – Here we are allotting 25 Laves to employee at the time of hiring without Proration

Termination%20Rule%20-%20We%20are%20calculating%20balance%20as%20of%20Accruable%20End%20Date%20and%20posting%20it%20on%20Accruable%20End%20Date.%20It%20means%20that%20at%20the%20time%20of%20Termination%20there%20will%20be%20no%20Proration

Termination Rule – We are calculating balance as of Accruable End Date and posting it on Accruable End Date. It means that at the time of Termination there will be no Proration

Accrual%20Rule%20-%20We%20are%20giving%2025%20Leaves%20to%20employees%20at%20the%20start%20of%20the%20year

Accrual Rule – We are giving 25 Leaves to employees at the start of the year

PEP%20Rule%20-%20For%20this%20Time%20Account%20Type%20we%20are%20posting%20Minimum%20of%2010%20or%20Remaining%20Balance%20of%20old%20account%20into%20custom%20field.%20Then%20we%20are%20simply%20making%20balance%20zero%20on%20Time%20Account%20and%20closing%20the%20account

PEP Rule – For this Time Account Type we are posting Minimum of 10 or Remaining Balance of old account into custom field. Then we are simply making balance zero on Time Account and closing the account

Step 3 – Create Time Account Type “Annual Leave (Carried Over)” which will be created using Integration Center and account created using this rule will be only active for first 3 months of the year.

Time%20Account%20Type%20Settings%20for%20Second%20Time%20Account%20Type

Time Account Type Settings for Second Time Account Type

PEP%20Rule%20-%20In%20this%20PEP%20rule%20we%20will%20simply%20close%20the%20Time%20Account%20and%20balance%20will%20be%20made%20zero%20before%20closing%20the%20Time%20Account

PEP Rule – In this PEP rule we will simply close the Time Account and balance will be made zero before closing the Time Account

Step 4 – Create Time Type “Annual Leave” For Singapore and attach both the “Time Account Type” which will allow us to carry over balance on same “Time Type.”

Time%20Type%20Settings

Time Type Settings

Assignment%20of%20both%20Time%20Account%20Types%20to%20Time%20Type

Assignment of both Time Account Types to Time Type

Step 5 – Lets create Integration which will carry over Balance from Last year’s Time Account to next year’s Time Account.

Use%20Above%20settings%20to%20create%20Integration

Use Above settings to create Integration

Select%20Time%20Account%20as%20starting%20Entity

Select Time Account as starting Entity

This%20is%20how%20Configure%20Field%20should%20look%20like.%20On%20Left%20side%20we%20will%20select%20the%20Time%20Account%20From%20current%20year%20from%20which%20balance%20will%20be%20carried%20over.%20On%20Right%20side%20we%20will%20create%20Time%20Account%20for%20Next%20Year%20in%20which%20balance%20will%20be%20Carried%20over

This is how Configure Field should look like. On Left side we will select the Time Account From current year from which balance will be carried over. On Right side we will create Time Account for Next Year in which balance will be Carried over

Mapping can be done as below

Current Year Time Account (Left Side) Future Year Time Account (Right Side) Mapping Type Comments
External Code Calculated Field Use any logic to create custom external code for Time Account. I have used logic as “Employee Number + Bookable End Date From last year”
Closed Default Value False
Time Account Type Default Value

SGP_ANNUAL_LEAVE_CO

This can be different for each country and then we can use calculated field in that case

Booking Possible Until Booking Possible Until Calculated Field Booking Possible Until + 3 Months
Booking Possible Until Booking Possible From Calculated Field Booking Possible Until + 1 day
Booking Possible Until Account Valid Until Calculated Field Booking Possible Until + 3 Months
Booking Possible Until Account Valid From Calculated Field Booking Possible Until + 1 day
User User Direct Mapping
Time Account_External Code Calculated Field Use any logic to create custom external code for Time Account. I have used logic as “Employee Number + Bookable End Date From last year”
External Code Calculated Field Use any logic to create custom external code for Time Account. I have used logic as “Employee Number + Bookable End Date From last year”
Balance as of PEP Amount Posted Direct Mapping
Booking Possible Until Posting Date Calculated Field Booking Possible Until + 1 day
Posting Type Default Value MANUAL_ADJUSTMENT
Posting Unit Default Value DAYS
Comment Default Value Carried over Balance From Last Year

We%20need%20to%20use%20filter%20combination%20as%20above

We need to use filter combination as above. This will only select the Time Account Types which are of code “SGP_ANNUAL_LEAVE” and they are closed also Balance as of PEP is not equal to blank. Also Time Based Filter will allow to only pick records which are modified since last successful run.

Integration%20is%20scheduled%20to%20run%20only%20once%20a%20year%20on%201st%20Jan%20of%20every%20year

Integration is scheduled to run only once a year on 1st Jan of every year

Step 6 – Time to Test Solution

Step 6.1 – Assign Time Profile to any Singapore Employee to see if the correct Leaves are assigned are not

For%20Demo%20Purpose%20I%20am%20using%20above%20Time%20Profile

For Demo Purpose I am using above Time Profile

My%20Test%20Employee%20is%20hired%20in%202023%20and%20I%20have%20assigned%20newly%20create%20Time%20Profile%20to%20Employee%20to%20check%20if%20regular%20Leave%20Balance%20is%20getting%20assigned%20Properly

My Test Employee is hired in 2023 and I have assigned newly create Time Profile to Employee to check if regular Leave Balance is getting assigned Properly

As%20expected%20Correct%20Number%20of%20Leaves%20are%20assigned%20to%20Employee

As expected Correct Number of Leaves are assigned to Employee

Step 6.2 – Run Period End Processing manually to Check status of Time Account

Time%20Account%20Before%20Period%20End%20Processing

Time Account Before Period End Processing

Period%20End%20Processing%20Calendar

Period End Processing Calendar

Time%20Account%20After%20Period%20End%20Processing.%20Here%20you%20can%20see%20the%20custom%20field%20now%20has%20value%20as%2010%20and%20account%20is%20closed.

Time Account After Period End Processing. Here you can see the custom field now has value as 10 and account is closed.

Details%20of%20PEP%20which%20shows%20complete%20Balance%20is%20lapsed%20and%20made%200

Details of PEP which shows complete Balance is lapsed and made 0

Step 6.3 – Running Integration Manually for Test Purpose

Integration%20Picked%20up%20this%20record%20as%20it%20matches%20all%20the%20condition

Integration Picked up this record as it matches all the condition

After%20Successful%20run%20of%20Integration%20you%20can%20see%20that%20new%20Time%20Account%20got%20created%20for%20employee

After Successful run of Integration you can see that new Time Account got created for employee. This time account will get closed automatically now after 3 months of next year and because of PEP rule the leaves will get lapsed

Details%20of%20Time%20Account%20showing%20Balance%20which%20got%20carried%20over%20from%20Last%20Year

Details of Time Account showing Balance which got carried over from Last Year

Here%20we%20can%20see%20old%20Time%20Account%20getting%20closed%20with%20Period%20End%20Processing

Here we can see old Time Account getting closed with Period End Processing

We%20can%20also%20see%20the%20New%20Time%20Account%20has%20future%20posting%20on%201st%20Jan%20which%20means%20leaves%20will%20get%20carried%20over%20on%20that%20day%20and%20will%20be%20usable%20for%203%20months

We can also see the New Time Account has future posting on 1st Jan which means leaves will get carried over on that day and will be usable for 3 months

Hope this solution will help you to achieve your specific requirement

Benefits of using above solution

  • Complete Automated Process
  • No complex business rule
  • Logic can be made very flexible for each Country and each Time Type
  • Validity period can be easily customized for each Time Type and Country

Thank you for taking time and going through my blog!


文章来源: https://blogs.sap.com/2023/10/24/carry-over-leave-balance-to-next-year-until-specific-date-automatically-using-integration-center-in-new-time-account/
如有侵权请联系:admin#unsafe.sh