cancel
Showing results for 
Search instead for 
Did you mean: 

Customization Done for 2 level approval of leave in ESS but Facing Problems

TusharShinde
Active Participant
0 Kudos

Hi Friends,

In our ESS Project we have customized our workflow to work for 2-Level Approver, but the problem we are facing is

1. When the Leave Request is created by say for eg:- INITIATOR1 user, it goes for 1st Level Approver i.e APPROVER1.

2. When APPROVER1, logs in and checks the UWL, a Workitem is there in the UWL for Approval, When APPROVER1 opens the workitem, he can see all the accumulated request in the Show Worklist. When he selects the INITIATOR1 request and clicks on Approve, the request status changes to Sent, and also the UWL Workitem also gets removed from the APPROVER1 UWL and a workitem is gone to 2nd Level Approver i.e APPROVER2, but the Problem is if some other workitem related to Leave is there in APPROVER1 UWL, in that case he can still see the INITIATOR1 request with status SENT and if he clicks the request and Approve/Reject its, then it is actually the action of the 2nd Level Approver, i.e. APPROVER2, so it gets approved on behalf of APPROVER2, which should practically not happen.

3. If the APPROVER1 approves and does nothing, and if APPROVER2 logins and opens the request and Approves it, then the entry gets POSTED and the workflow gets completed successfully.

Please guys correct me, if any mistakes we had done in our Leave Request Customisation. Please do give any inputs for the same. Is there anything extra needs to be done in standard Leave Application if the Workflow is customised for 2-Level Approval. Is there anything missing in SPRO Configuration to make the Standard Application behave for 2-level Approvers.

Hope, the points I mentioned gives a clear idea of my problems, may be I am closed to Solution but because of some bad configurations mistakes i had done, the application might be misbehaving.

If any more explanation is required, please do let me know.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

*Hi TusharShinde,

1. After first Level Approved leave request, we have to create a method to change status.

i think this code solve for your issue...

DATA : lv_guid TYPE guid_32.

DATA:ex_request TYPE REF TO if_pt_req_request,

event TYPE tim_req_xfer_event VALUE cl_pt_req_const=>c_reqtrans_send,

status TYPE tim_req_status.

CALL FUNCTION 'ENQUEUE_EPTREQ'

EXPORTING

MODE_PTREQ_HEADER = 'S'

MANDT = SY-MANDT

REQUEST_ID = im_req_id

  • X_REQUEST_ID = ' '

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = ' '

  • EXCEPTIONS

  • FOREIGN_LOCK = 1

  • SYSTEM_FAILURE = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL METHOD cl_pt_req_badi=>get_request

EXPORTING

im_req_id = lv_guid

IMPORTING

ex_request = ex_request.

CALL METHOD cl_pt_req_badi=>initiate_state_transition

EXPORTING

im_request = ex_request

im_event = event

im_ret_value = 0

IMPORTING

ex_new_status = status.

IF sy-subrc = 0.

COMMIT WORK.

ENDIF.

CALL FUNCTION 'DEQUEUE_EPTREQ'

EXPORTING

MODE_PTREQ_HEADER = 'S'

MANDT = SY-MANDT

REQUEST_ID = lv_guid

  • X_REQUEST_ID = ' '

  • _SCOPE = '3'

  • _SYNCHRON = ' '

  • _COLLECT = ' '

.

Best regards,

Kumaran Duraiswamy.

Answers (6)

Answers (6)

siddharthrajora
Product and Topic Expert
Product and Topic Expert
0 Kudos

Answered

Former Member
0 Kudos

HI Tushar,

We are also in phase of implementing LMS through ESS into ecc 5 version now we got stuck into the Process after approval/rejection by the immediate reporting manager.we are using standard workflow 12300111 in this process yet we are not gettigng any notification from the boss.

In a nutshell: when an employee submits the request for leave it is succesfully sent into the rep manager's inbox and when boss approves/rejects this request it is neither updating into Boss's Outbox nor into employee's Inbox with a status either rejected or approved.

kindly guide us for more updation/modification.

Regrds,

TusharShinde
Active Participant
0 Kudos

Hi Priyanka,

Please open a New Thread, so that everyone can answer and in fact you can get answers more quickly.

For now, Let me know the ESS Package Version as well as NetWeaver Portal Version used. I am asking this, because in our case, the problems started all because of Stack Mismatch issues. Anyway, let us know the Versions.

Regarding, using everything Standard, then I am sure that It will work fine, check with ESS consultant & Workflow , if any configuration had missed in SPRO transaction.

Once the approval/reject action is submitted check whether PTREQ_HEADER is getting updated or not for the particular requestId.

Also, there is background program that needs to be scheduled for Posting all the Approved Leave Requests.

NOTE:- Create a New Thread to continue conversation.

Regards,

Tushar Shinde.

siddharthrajora
Product and Topic Expert
Product and Topic Expert
0 Kudos

Yes we can disable this

there is a note for this

Symptom

In LeaveRequestApprover application, a higher level manager can

approve/reject a leave though he/she is not the owner of the approval

workitem (TS12300097). It happens when a higher level manager clicks on

the leave in the TeamCalendar launched from the LeaveRequestApprover

application.

Other terms

LeaveRequestApprover, TS12300097, prepare_select, WorkList,

LPT_ARQ_REQUEST_UIAF07

Reason and Prerequisites

Reason:- This is caused because the approve/reject button were not

restricted based on the logged in user.

Prerequisites:- IT105 entries for the backend PERNRs should be correctly

maintained.

You can check here

Object REPS LPT_ARQ_REQUEST_UIAF07

Object Header FUGR PT_ARQ_REQUEST_UIA

FORM PREPARE_SELECT

the note is meant for few customers only

TusharShinde
Active Participant
0 Kudos

Hi,

I tried to search for the Note to disable the Approve Functionality via Team Calendar, but didnt get any relevant document, also in the standard Leave Req app the Note for Approver is duplicating, once the requester had sent the request and when the approver opens the Workitem, the Note is duplicating.

If possible the Note Number is available with you, please do let us know.

Regarding the Duplication of Notes, I found some Notes and for which the corrections suggested are already applied but still the problem persist.

Regards,

Tushar Shinde

siddharthrajora
Product and Topic Expert
Product and Topic Expert
0 Kudos

Note duplication occurs due to the modification done

check here

CL_PT_REQ_NOTICE

methods to retrieve the notice text being incorrectly (perhaps)

reassembled by method CL_PT_REQ_WF_ATTRIBS->SET_WF_ATTRIBS.

note 1316777

note this

In PTREQ_NOTICE you have two entries created for same request this

is incorrect, this shouldnt occur especially for WF-BATCH

wf-batch is the agent for the workflow background processes

Please advise what background processes you use in your WF

that note is meant for few customers you wont be able to see it, raise a message for SAP for that

TusharShinde
Active Participant
0 Kudos

Hi,

I checked and gone thru Note and all necessary corrections are already there, but I found that in PTREQ_NOTICE there is a line item for WF-BATCH also, I think it should not appear in normal scenario. Please suggest for any inputs and I will check with my Workflow Team to know what Background Processes they are using.

Sir, regarding disabling Team Calendar in Leave Request Approver screen for responding to User Action, I didnt found any SAP Note for the same. Please suggest on how to disable it or may be How can we control the Team Calendar at First Approver Level to not show the Leave Details which are for the Second Level Approval.

Thanks

Regards

Tushar Shinde

siddharthrajora
Product and Topic Expert
Product and Topic Expert
0 Kudos

i said there should be only one entry in PTREQ_NOTICE, so you have probably two entries.

This is the note 1484853 but as i said you cant see it unless you raise a Message for SAP , We have to add yout company to the note.

Edited by: Siddharth Rajora on May 26, 2011 3:46 PM

siddharthrajora
Product and Topic Expert
Product and Topic Expert
0 Kudos

did you check with the standard WF? I want to see what causes this error

badi ensures that approver is correctly returned all the time

TusharShinde
Active Participant
0 Kudos

Hi ,

We managed to resolve the issue partially.

The issue still persists in the Leave Request application in team calender approval.

The issue has been resolved by modifying the PTREQ_HEADER table of respective GUI ID having field TIM_REQ_VERSION (Document Version) having value 3. This change was carried out inside a method of custom BO delegated from standard BO called "EMPLOYEET", that we are changing to update the PTREQ_HEADER table for updating the status to give Multi-Level approval in workflow .

the below code was implemented to resolve the issue.

SELECT SINGLE * FROM PTREQ_HEADER INTO wa_header


SELECT  SINGLE * FROM PTREQ_HEADER INTO wa_header
	WHERE request_id = im_req_id
	AND version_no = lc_version.
 
IF sy-subrc EQ 0.
	wa_header-next_processor_i = '  '.
	MODIFY ptreq_header FROM wa_header.
	
	IF sy-subrc EQ 0.
		COMMIT WORK.
		CLEAR: wa_header.
	ENDIF.
ENDIF.

Now the problem we are facing is, We have successfully channalelized the behavior of application in accordance with multilevel workflow only for "Show Worklist" Table in Approval Screen, but the Team Calendar is still showing the SENT item which is supposed to be approved by Second Level.

Is it possible to disable the approval functionality provided in Team Calendar - Leave Request Approval Standard Screen. Means just to use it in TEAMVIEW Mode or Read-Only Mode.

also please suggest if there is any way to handle this at the BAdI Level or from R/3 Side.

Regards,

Tushar Shinde

TusharShinde
Active Participant
0 Kudos

Hi Kumaran,

Thanks for the code.

It helped me to get some key changes in my application but still the Main Issue of "Show Worklist" tab wherein even if the Approver approves the entry still can be seen If he opens some other workitem in his UWL and if APPROVER1, selects it and Approves then the action is taken, what was supposed to be taken from 2nd-level APPROVER2.

Please do let me know, if there is anything I am missing.

Please do suggest changes.

Thanks a Ton for replies.

siddharthrajora
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can implement this multi tier behavior also by adding a work item

activity to reset our Leave Request document status to SENT once the

work item has been approved.

ie

Yes you can make the changes in the approve method of the class

CL_PT_REQ_WF_ATTRIBS. As part of the sap standard we dont have any

method available in BADI to control multilevel approval. Its currently

not supported as a part of SAP standard workflow.

ie

1. TXN SWDD i copied WS12300111 to a custom workflow

2. enhanced class CL_PT_REQ_WF_ATTRIBS with a new method

3. changed table PTREQ_STATUS_TRA to have a new transition status

Hope this hint helps, If you need further assistance I would

recommend you to contact our consulting team.

or read here

TusharShinde
Active Participant
0 Kudos

Hello Siddharth Sir,

As per your suggestions we have done the necessary things in the BAdi as well as in Workflow, but still the problem that I mentioned in my thread is not rectified, You gave one more thread link in which they are talking about customizing the Badi

This is because the next processor in the workflow is not cleared. Because of this its visible in the UWL. I have faced the same issues the solution is need to clear the next processor for that use this BADI PT_GEN_REQ enhance it and in the method FIND_RESP_AND_DEFAULT_NEXT_PRC clear the next processor. This will solve your issue.

-


Hi Vijay,

Thanks for your reply. Can you please let me know which parameter should I clear inside that method - FIND_RESP_AND_DEFAULT_NEXT_PRC. In my system there code inside this method is fully commented.

EX_RET_VALUE

EX_RESPONSIBLE_ACTOR

EX_DEF_NEXT_PROC_ACTOR

This is what we have not done. so is it required to be done, that we need to enhance this Badi as well to achieve our purpose.

Please do let me know.

Thank You. Awaiting for your reply.

Regards,

Tushar