Skip to Content
Author's profile photo Parag Parikh

Updating CATSDB and HR Time Infotypes with leave request data

SAP leave request enables employees and managers to perform all the tasks they need to manage leave requests and other absences. SAP leave request data is stored in different transparent table and not in SAP time infotype tables  ( like PA2001, PA2002, PA2003 ) and CATS database table CATSDB.

In an application landscape where all three applications are running in parallel, this pauses some challenges in synchronizing all three databases. I describe here approach we took in recent implementation. I wish for more inputs on this scenario in form on limitations / advantages of method we adopted which will help community. 🙂

Transfer leave application data to HR time infotype tables.

Use program RPTARQPOST. This program reads leave request data and updates PA2001 accordingly. For example if the employee has approved leave from 1st July 2014 till 5th July 2014, the program will create one entry in PA2001 from 1st July 2014 till 5th July 2014. Scheduling this program on daily or periodic basis is not an ideal solution as in that case HR infotypes will not be updated in real time with leave data but rather will be updated after delays depending on program schedule. We called a SUBMIT statement in the method we used to define final step in leave approval workflow to update database.

*** Call report RPTARQPOST to transfer data to infotype PA2001 if any

  SUBMIT rptarqpost WITH ppernr = ls_leave_data-owner-pernr

                    WITH ign = ‘X’ AND RETURN.

In the above statement, IGN = ‘X’ instructs program to send approved leaves only to HR time infotypes.

Transfer leave application data to CATSDB.

Use BAPI_CATIMESHEETMGR_INSERT to update CATSDB. Key points to note here are,

1) Leave request data is not stored in leave tables daywise. Example, for a 5 days leave, there will not be a separate entry in leave tables ( one per day ). Whereas in CATSDB  table, the data is stored per day as it is time sheet data.

2) SAP application automatically corrects incorrect hours for multi-days leave applied. For example, if an employee’s work schedule for 8 consecutive days, starting from 1st March 2014 is 6, 12, 12, 10, 10, 10, 10, 10 hours, a leave applied by him/her from 1st March to 8 March will accumulate to a total of 80 hours of leave per work schedule. Leave ours less than or greater than 80 hours will be corrected back to 80 hours by SAP standard application. SAP leave application also takes into account substitutions ( PA2003 ) when performing above checks.

3) For a single day leave, employee can book either half day or full day of absence depending on company policy. However standard application will not stop employee to enter 6 hours of leave for an 8 hour working day.

4) Employee or his supervisor can edit or delete an already approved leave.  This includes scenario where employee may extend his leave, prepone his leave, increase or decrease number of days of leaves.

The logic to update CATSDB and distribute leave hours per day in CATSDB should be developed accordingly. In case of leave deletion scenario, BAPI_CATIMESHEETMGR_DELETE is useful. New entries in CATSDB should be created with status 30 ( Approved ). For any new changes to approved leave, first delete existing records ( no physical deletion but marking status of CATSDB entry to 60 using BAPI ) and then create new entries. When deleting existing entry, read existing entry ( specifically counter ) using BAPI_CATIMESHEETRECORD_GETLIST.

To read employee’s work schedule use FM HR_PERSONAL_WORK_SCHEDULE. This FM also takes into account substitutions when returning the work schedule. It is useful in determining how to distribute leave hours per day.

Above BAPIs can be called inside workflow step for data update.

Why not update CATSDB first and then run CAT6 to transfer CATSDB data to HR infotypes?

CAT6 is meant to move timesheet data to HR infotypes and not the leave data. As in the CATSDB table, entries are stored per day, taking this approach will create multiple entries in PA2001 for each day of leave and as a result employee will see multiple rows in leave request ( for example 5 rows for 5 days leave applied ). This is inconvenient and inaccurate as application will show each day as a separate leave.

What if there are some absences which are entered directly from CATS and not from leave application? Will running CAT6 in such scenario effect PA2001 entries?

If some A/A type is entered directly in CATS and subsequently CAT6 is run to update HR data, it will overwrite existing PA2001 entries created by RPTARQPOST. Unfortunately SAP has not provided a selection criteria on CAT6 to allow transfer of selective A/A types.

To avoid CAT6 from picking entries created using BAPI, in workflow method to update CATSDB, we changed status of entries created by BAPI to ‘1’ i.e. transferred. Updating staging table PTEX2000 in this manner ensured that CAT6 does not selects entries updated by BAPI from leave approval workflow.

ptex2000-statu2 = ‘1’.

ptex2000-statu3 = ‘1’.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thank you Parag, it is a very helpful blog!

      I have a small question here,

      "4) Employee or his supervisor can edit or delete an already approved leave."

      The Approved status will be changed to Booked status after the leave request is updated/posted in IT-2001.

      Can an Employee cancel a Booked leave request? If Yes, does the cancellation need to be approved by the supervisor?

      Author's profile photo Siva Prasad
      Siva Prasad

      Hi Moon ,

      Yes we can do by using CATS_APPR_LITE , use the processing status : 30 which is approved and execute , In next screen , select the time entries and click on delete.



      Author's profile photo Former Member
      Former Member

      Hi  Siva,

      Thank you for your reply.

      "we can do by using CATS_APPR_LITE , use the processing status : 30 which is approved and execute , In next screen , select the time entries and click on delete."

      Do you mean that when an employee cancels a booked leave request, the employee's manager need to do the operation you mentioned above to approve the employee's cancellation?



      Author's profile photo Jagan Gunja
      Jagan Gunja

      As per standard practice, a leave request

      a)should only be approved or rejected by the manager; the approver's security profile, work flow and screen attributes should be built as such.

      b)after the approver's action the feedback will be to the requester, who may cancel/modify the leave request - the modified request would go back to the approver.

      c)after approval the leave request is update the IT 2001 to unlocked.

      Author's profile photo Former Member
      Former Member

      Thank you Jagan for your reply.

      The approved leave request status will be changed to Booked after it is posted.

      Maybe that's what you mean by "c)after approval the leave request is update the IT 2001 to unlocked.", would you please tell me what you mean by "unlocked"?



      Author's profile photo Siva Prasad
      Siva Prasad

      Once the manager has approved the leave request / time approvals , employee cannot edit the manipulate the hours. but Manager can do the changes after his approvals I mean Once the manger has changed the hours , again he can modify the timesheet / leave request status that means it might be rejection or changes the hours ........ than approvals.

      Employee perspective - before approvals employee can change the leave request / number of hours....



      Author's profile photo Jagan Gunja
      Jagan Gunja

      Sorry for my typing error;  When the employee applies for leave, the IT 2001 record is in locked status, so that it is not processed in time eval or payroll; after leave is approved, the IT 2001 record is unlocked.

      For a future dated leave request, if the abs quota is insufficient, a IT 2013 is generated to debit the quota on the leave accrual/transfer date;  this also will be locked/unlocked similarly.

      Author's profile photo Former Member
      Former Member

      Hi All,

      I've a question. I am processing time data using 'BAPI_CATIMESHEETMGR_INSERT' record by record. Immediate transfer to HR option is checked for the CATS profile which I am using. However when I am creating absence records, it is not updating 2001 or 2006. If available quota for employee is 18 hours, then each time is going to check the hours from input file with 18 hours, so it is updating absences for all days in a week. It should not happen. When I enter time manually using CAT2, it is automatically updating time infotypes.

      Please advice, highly appreciate any kind of inputs.



      Author's profile photo Rejeesh Haridas
      Rejeesh Haridas

      Dear Parag Parikh ,

      i am using "BAPI_CATIMESHEETMGR_INSERT" using to update the time sheet booking from SF through the Custom RFC

      I have one scenario while booking Full day absence catsdb-beguz and catsdb-enduz is updating as 00:00:00 like below


      Any way to change this as time which pass to FM as it is

      Regards ,

      Rejeesh H