Flipkart.com

Tuesday, September 7, 2010

How to achieve Multiple levels of approval in CATS? SAP - Time Management

Hi Friends,

For Time sheets (CATS), SAP does not support multiple levels of approvals.

Custom solutions need to be designed for the same. This post explains one such custom design. This may not be an ideal design and if you have a better design please let me know.

Requirement: Once an ESS user releases his time sheet, a work item should go to his direct manager. Once the direct manager approves the time sheet, it should go to "HR approver" for approval. Once the HR approver approves the work item, work item should disappear, and in CATSDB the line should change to status '30' (Approved). The above requirement is valid only for Attendance type '0123'. For other attendance types the current single step task should get triggered.

Terminology
A “reports to” B “reports to” C ==> Employee “reports to” Direct Manager “reports to” One-up Manager

Solution Design: The solution can be broken down into three logical phases as below. Fourth one is a related and a required change based on your settings.

Part 1, Triggering of the multi-step workflow
SAP allows you to trigger a single step task at "Data Entry Profile" level. So before you set on this task you need to find out the "Data Entry Profile" the target ESS users are using. You can get this from Tcode SU01D

Let us see the single step task that is currently configured for the CATS. Our objective is to disable/stop this single step task and trigger our own multiple step workflow.

Go to SPRO--> Cross-Application Components --> Time Sheet --> Specific Settings for CATS regular --> CATS regular --> Record Working Time --> Set up Data entry Profiles. Select the Data Entry profile under consideration.


Data Entry Profile used by the user

Here you have to either remove "With SAP Business Workflow" or enter a dummy task for the field "Task" so that nothing happens with this task.

In this design we are going to trigger the CATS workflow from user exits.
Now you need to implement user exit CATS 0006-->FM EXIT_SAPLCATS_006-->Include ZXCATU05. Ensure that your workflow triggering code is at the end of this include program, so that all other time sheet validations are complete before you trigger the workflow.

Task to do in the above code: a) For “0123” call two level workflow. b) For ‘Others’ call the earlier single step task. You may use FM SWW_WI_START_SIMPLE to trigger workflow and single step task.

Other way to achieve the workflow triggering is to use the CATS business object and use the events in it to trigger the workflow.

Part 2, Custom screen for displaying the unapproved data once the work item is clicked upon.
A custom WebDynpro screen needs to be created for manager and one-up manager to see the time data to approve. In the UWL configuration XML file, you need to link that application with the workflow dialog task. You need to create an RFC that will populate the data for the above WebDynpro screen.

Pseudocode for the RFC

For the First Level approval (Direct manager)
Fetch all the records with AWART = ‘0123’ with status ‘20’ and work item id = balnk. Show these records for approval.

For the Second level approval (One-up manger)
Fetch all the records with AWART = ‘0123’ with status ‘20’ and work item id = top work item ID. Show these records for approval.

Part 3, Processing approvals and updating CATSDB
An RFC (to be called form portal application) needs to be created which will act according to the user decisions of direct manager and one-up manager. This will have two types of functions. One at the Direct manager level, other at the one-up manager level.

Pseudocode for the RFC

After First Level approval (Direct manager)
Update the CATSDB record with the Top Workitem ID of the workflow. If ‘Rejected’, update the CATSDB and workflow ends. If ‘Approved’, work item will be created for the second level approver.

After Second level approval (One-up manger)
If ‘Rejected’, update the CATSDB and workflow ends. If ‘Approved’, CATSDB record will be changed into ‘30’.

Part 4, Other related and important changes

Team --> Approval of working time (Standard application) will list all the attendance types which need approval, so that the manager can approve. Note that even after the first level of approval, out CATS record still has the status of ‘20’ hence will be available in “Approval of working time” application for the direct manager to approve (more-over he can approve the time as well). This is not right since the work item is now available at one-up manager.

To resolve this conflict I would suggest NOT to show the attendance type which needs two level approval in the Approval of working time application.

This can be easily achieved by a one line code at BADI HRCATS_APPR_CUST
IF_EX_HRCATS_APPR_CUST~EDIT_SELECTION

Sample code
DELETE XT_TIMESHEET_ITEMS where awart = ‘0123’.

Hope you find this blog useful. Enjoy!

12 comments:

  1. Good One,

    What if we did not go for workflow, and want to route or control the approving agents for an absence.

    ReplyDelete
  2. That would require a custom table to store the status of working times after intermediate approval steps.

    BADI HRCATS_APPR_CUST
    IF_EX_HRCATS_APPR_CUST~EDIT_SELECTION can be used to add/delete records to be shown for approval.

    ReplyDelete
  3. Just wondering if you ever came across a requirement to use unknown account assignment PO (infotype 0315)? Looks like we have to customize CATM transaction to make it work.

    ReplyDelete
  4. Hi KK,

    Interesting concept :) I'm looking into how we can add another level of approval (other than MSS) which will endorse the application before it get routed to MSS. I wonder how you customized the authorization for this additional steps?

    ReplyDelete
  5. I'm really enjoying the design and layout of your website. It's a very
    easy on the eyes which makes it much more enjoyable for me to come here and visit more often.
    Did you hire out a developer to create your theme? Outstanding
    work!

    Feel free to visit my web-site: cannabis
    my website :: 50599

    ReplyDelete
  6. What's up mates, pleasant article and fastidious arguments commented at this place, I am truly enjoying by these.

    My blog post ... Grecja miasto Thessaloniki

    ReplyDelete
  7. Every weekend i used to visit this website, as
    i want enjoyment, for the reason that this this web site conations really good funny information too.


    Also visit my blog post - 20167

    ReplyDelete
  8. Hey very nice blog!

    Feel free to surf to my site loss weight now

    ReplyDelete
  9. Greetings! Very useful advice within this article!
    It is the little changes that produce the most significant
    changes. Thanks a lot for sharing!

    Check out my web site ... Natural Cleanse Review

    ReplyDelete
  10. Many bodybuilders make this same mistake, and take the hard road.
    If you only lift ten pounds routinely, your muscles will
    grow to meet that need and no more. The reason is that too often people consume too much protein at one time and most of it goes
    to waste.

    Here is my web site: Buy Power Pump XL

    ReplyDelete
  11. Heya i'm for the first time here. I came across this board and I to find It really useful & it helped me out a lot. I am hoping to give something back and help others such as you helped me.

    Also visit my blog Adorna Breast Enhancement Supplement

    ReplyDelete