Skip to Content

Multi level approval in leave request workflow

Dear Experts,

I have copied std leave request wf 12300111 and extended it to 2 level approval. Once 1st level approver approves the request the status of request becomes APPROVED. So for 2nd level approver that leave line item is not displayed which means that only leave request with status SENT will be displayed to approvers and I have to change the status from APPROVED to SENT once 1st level approver approves. I found from SDN that PT_ARQ_REQUEST_PREPARE FM can be used to do this. Can you please tell me what I have give to IM_COMMAND input of this FM in order to change the status back to SENT.

Please share your valuable inputs if there is any other way to change the status from APPROVED to SENT.

KR,

Bharath

Edited by: bharath padmanabhan on May 8, 2010 9:33 AM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    May 10, 2010 at 04:50 AM

    Let me try to explain you breifly about how the leave request applied form portal or ESS wil behave, considering you have multiple levels

    1. ONce you try to apply a leave from ESS then leae req status will be set to SENT status. and the workitem is created and kept in the appropriate managers inbox.

    2. If at all manager takes a decision on the req the status of the req will be set to the decision he took, ( Approved, Rejected) , now if it is rejected then again the workitem will be sent back to the initiator or employee.

    3. If it is approved then you would like to get the approval of second level manager, in this case what you have to perform is that you need to change the staus of the workitem or Request Status back to SENT, inorder to perform this what you can try to do is make use of the below code snippet, and this code must be included in the workflow, using a separate background task, which needs to be included after the Approval task of the workflow..

    
      DATA: request TYPE REF TO if_pt_req_request,
            event   TYPE tim_req_xfer_event VALUE cl_pt_req_const=>c_reqtrans_send
    
      CALL METHOD cl_pt_req_badi=>get_request
        EXPORTING
          im_req_id  = me->req_id
        IMPORTING
          ex_request = request.
    
      CALL METHOD cl_pt_req_badi=>initiate_state_transition
        EXPORTING
          im_request    = request
          im_event      = event
        IMPORTING
          ex_new_status = me->status.
    
    

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi pavan,

      I'm using the code given by you,but facing one problem,in background processing we have to make the method as STATIC and in static method "me->req_id" is not possible.

      So please tell me what code I have to write instead of "me->req_id" or to fetch the document ID i.e request id.

      Thanks & Regards,

      Prajyot.

  • avatar image
    Former Member
    May 08, 2010 at 10:30 AM

    Hi,

    Here is an example about how to change a status of a leave request (in this example the status is changes to APPROVED - but the idea is the same).

    DATA:

    request TYPE REF TO if_pt_req_request,

    event TYPE tim_req_xfer_event VALUE cl_pt_req_const=>c_reqtrans_approve,

    lv_status TYPE tim_req_status.

    *Request object

    CALL METHOD cl_pt_req_badi=>get_request

    EXPORTING

    im_req_id = me->request_id

    IMPORTING

    ex_request = request.

    *Change status of request

    CALL METHOD cl_pt_req_badi=>initiate_state_transition

    EXPORTING

    im_request = request

    im_event = event

    • IM_RET_VALUE = 0

    IMPORTING

    ex_new_status = lv_status.

    Regards,

    Karri

    Edited by: Karri Kemppi on May 8, 2010 1:30 PM

    Edited by: Karri Kemppi on May 8, 2010 1:31 PM

    Add comment
    10|10000 characters needed characters exceeded