cancel
Showing results for 
Search instead for 
Did you mean: 

Timesheet rejection workflow

Former Member
0 Kudos

Hi experts

I'm trying to develop a workflow that sends out email(outlook) to creator of timesheet in case his timesheet gets rejected.

Following are the steps that I did

Custom business object ZCATS which is subtype of CATS.

In ZCATS I've a background method called STATUS with reads status field in table CATSDB.

Workflow gets triggered with 'completed' event. Since 'completed' event is the only event that generates for both approval and rejection, I check using background method STATUS if field 'status' in catsdb holds value '40'(rejected). In that case I sends out a email.

Now my problem is Key field in business object CATS is different from that in CATSDB. Key field of CATSDb is COUNTER while that of business object CATS is workitem id.

I'm able to trigger my workflow but fails when it reaches the background method

How do I proceed? Any better ideas? I will make sure that I award points to any useful hints

Thanks

Jomy Joseph

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Here you have the workitem Id. as the key fields now try to retrieve the Personnel number from it you can retrieve this by reading the Workflow Container using FM

SAP_WAPI_READ_CONTAINER

From the PERNR you get Counter I feel.

I also found a standard Wflow Template WS40001001 but it seems to have some issue. Make use of attribute coding in Custom Business Object to get the Counters.

Thanks

Arghadip

Former Member
0 Kudos

Thanks Arghadip. But the function module is not returning any speci information about the timesheet. It has info about when workitem created who created...

Former Member
0 Kudos

Check this link

http://help.sap.com/saphelp_erp2005vp/helpdata/en/04/928adf46f311d189470000e829fbbd/content.htm

It might be of help

make use of the Created event of CATS Business Object it passes all the Personnel number that is required in your devt.

May be youi can use SHWEHR3 to trigger this event. Also try to search the forum U will get ur answer.

Thanks

Arghadip

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Jomy

The key field for CATSDB is the same as the WI number, you can confirm this by either checking for an entry in CATSDB for the workitem number or through SWO1 tring to instantiate your BO.

Let me know how you go.

Regards

Ravi

KKilhavn
Active Contributor
0 Kudos

> The key field for CATSDB is the same as the WI number, you can confirm this by either checking for an entry in CATSDB for the workitem number or through SWO1 tring to instantiate your BO.

>

I think your memory is fooling you this time, Ravi. The work item number is found in the field WORKITEMID in CATSDB - which allows the solution to reference several timewriting entries in the same approval.

If it weren't so (if the work item ID was the same as the CATS counter) the managers would be overloaded.

<i>Message was edited by Kjetil Kilhavn:</i>

Jomy, I have never set up the standard solution for approval of timewriting - so I don't know if a rejection is for all timewriting entries, or if it is possible to reject only some of those you receive for approval.

In any case, the foolproof solution is to check all the entries. You can even count the number of approved and rejected entries, and send a message to the person with specific information.

SELECT *
      INTO l_catsdb
      FROM catsdb
      WHERE workitemid = l_cats_object_key.
* count rejections and approvals by checking l_catsdb-status
ENDSELECT.

IF l_count_rejections > 0.
  PERFORM send_email
          USING some_data.
ENDIF.

Former Member
0 Kudos

Thank you Ravi and Kjetil Kilhavn .

Former Member
0 Kudos

Thanks for the correction KK! I am sure I wasn't drunk!!!

Regards

Ravi

Former Member
0 Kudos

I've resolved it myself through a different approach. Thanks again for everyones help.

martin_nooteboom
Active Contributor
0 Kudos

Please be a nice forum member who follows the rules and give us some insight in your solution. This will benefit others also when they search.

Regards,

Martin