Multi level approval in leave request workflow
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.
Edited by: bharath padmanabhan on May 8, 2010 9:33 AM
Pavan Bhamidipati replied
First try to insert a commit work statement after the above code what i mentioend, even then ifthe version status is not getting chnaged to SENT then, i think you have to try with the below code snippet
after type casting the request CL_PT_REQ_REQUEST, in this class you have the methods, by which the request can be cloned to new or current or old.
so you need to make use of the CLONE_TO_NEW and check.
DATA: request TYPE REF TO if_pt_req_request, lcl_req_request TYPE REF TO cl_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. lcl_req_request ?= request. CALL METHDO lcl_req_request->clone_to_new commit work.