on 05-08-2010 4:57 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Pavan,
Thanks a lot for your reply. When I debug the method where I have included your code snippet, I can see that I get the value of me->status as SENT. But still the value of Request status in workflow container as well as PTREQ_HEADER remains as APPROVED only. Can you please tell me where the new status SENT will be reflected.
KR,
Bharath
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.
Hi,
You can do as below,
1) Create a BOR Method or method in your custom class and add the code snippet as recommended by Pavan.
2) You have to call this method in a activity step (background) immediately after the activity step for 1st level approval. This is because after 1st level approval the status of leave request will be APPROVED. Then your method will switch it from APPROVED to SENT.
3) Note: If you have muti level approvals, make sure you call this method after every approval activity step. Only then the workitem will be available for approval for the subsequent approvers.
Please let me know if you have any queries.
Best,
AWF
hi ,
Thanks for the response.
I did whatever you said, but getting error. Attaching the error screen shot please check.
Let me explain what I did.
1.copied standard task : 12300097
2.copied standard class :CL_PT_REQ_WF_ATTRIBS
3.Created ZSTATUS_CHANGE method in copied class ZCL_PT_REQ_WF_ATTRIBS and written the code given by pavan.
---------->No Parameters. If we have to mention the parameters please tell me.
4.Inserted Activity just after 1st approval with copied standard task,class and methodin background processing.
Am i right,please correct me if anything wrong.
thanks & regards
Prajyot.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.