on 07-14-2011 9:49 AM
Hi All,
My requirement is to Auto Approve Leave Request using workflow WS04200009, if request is pending with approver for more than 3 days. (I want both approval through manager as well as auto approval if deadline reached).
I searched existing threads, and i got lot of auto approval ways (using FM PT_ARQ_REQUEST_EXECUTE , using class) but all of them were for new leave request workflow WS12300111.
But as i am using older version of Leave Request workflow, i am facing problem, as there is no Request Id (Document Id) in older version.
So please help me to find a way to auto approve leave request using older version of workflow.
Amar
Solved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rick,
After approval step there is a flag (Actual State) to check whether request is approved or rejected.
Now in my case after deadline reached i need to forcefully approve it and update infotypes.
So i just set this flag as 'Approved' in my processing obsolete path, and remaining thing works as usual.
Because there is a condition step which checks this flag for 'A' or 'R' (approve or reject), and depending upon this flag value it updates the infotypes accordingly.
Hope it helps.
Amar
Hi All,
Any help in this, i am still waiting.
My problem is not yet resolved.
Amar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes, you are using some older version of the absence approval scenario, and thus you don't have the request_id etc. and cannot use the above-mentioned code samples.
I don't know your scenario either, but just taking a quick look, isn't that so that the approval transaction is just a dummy form for displaying the absence details, and when the approver approves the leave, it is actually "approved" (or actually created) by the workflow in the following step (task TS01000102). If this is the case, then just do modifications to the workflow, that the step will be automatically completed in 3 days and then the workflow will continue to the correct path and the absence gets approved.
By the way, isn't you requirement a bit crazy? Why do you even need the approval, if the absences will be approved automatically in any case?
Regards,
Karri
Amar,
In leave request, for auto approval The FA will configure so that no WF will be triggered and the leave will be approved.
In your case On deadline reaching if you need auto approval then you have do your approval activity with MODELED deadline and when dead line is reached then call the task/activity which changes the Leave request status to APPROVED from SENT, and now you complete the workflow.
Set the workitem to obsolete so that it will be removed from Inbox or UWL of approver.
Regards,
Chandra.
Edited by: chandra shekhar on Jul 15, 2011 6:51 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Chandra,
I am done with work flow changes for daedline monitoring.
Actually i stucked at approval process.
In task TS12400026 we are using HTMLPROCESS method of FORM BOR, it basically calls a T-Code, which in return populates approver screen through module pool programming, and here approver clicks on approve button to approve the leave request.
Now i want this process to be done automatically if deadline reached.
So how can i achieve this, approval process without calling approver screen in older version of leave workflow.
Regards,
Amar.
Hi,
You can do this by using the modeled option in the deadline monitoring.
Now if you use the modeled option another branch will created where you can create activity step to call a background mothod.
( This should be the same method which is calling in the after clicking approve option in the module pool screen ).
Thanks and regards,
SNJY
Hi,
You can do this by using the modeled option in the deadline monitoring.
Now if you use the modeled option another branch will created where you can create activity step to call a background mothod.
( This should be the same method which is calling in the after clicking approve option in the module pool screen ).
Then complete the dialog step by using the process control.
Thanks and regards,
SNJY
Hi Amar,
As I have said earlier you have to go with modeled deadline , when deadline is reached you have to call your activity and in that activity you have to write the below code to change the status from SENT to APPROVED.
Please let me know if you need information on Modeled deadline for approver task.
data:
newstatus type ptreq_status_tra-new_status,
request_id type ptreq_header-request_id,
current_status type ptreq_status_tra-new_status.
constants :
c_req_send type tim_req_xfer_event
value cl_pt_req_const=>c_reqtrans_send
, c_req_approve type tim_req_xfer_event
value cl_pt_req_const=>c_reqtrans_approve
.
data:
application type ref to cl_pt_cor_application,
new_status type tim_req_status,
ws_ptreq_header type ptreq_header ,
it_ptreq_header type table of ptreq_header .
statics:
request type ref to if_pt_req_request.
class:
cl_pt_cor_application definition load,
if_pt_req_request definition load.
swc_get_element container 'newstatus' newstatus.
swc_get_element container 'request_id' request_id.
*-- Get the current status of request
clear : it_ptreq_header,it_ptreq_header[],ws_ptreq_header.
select * from ptreq_header into table it_ptreq_header
where request_id = request_id.
sort it_ptreq_header by version_no descending.
read table it_ptreq_header index 1 into ws_ptreq_header.
if sy-subrc eq 0.
swc_set_element container 'Current_status' ws_ptreq_header-status.
endif.
call function 'ENQUEUE_EPTREQ'
exporting
mode_ptreq_header = 'E'
request_id = request_id
exceptions
foreign_lock = 1
system_failure = 2
others = 3.
if sy-subrc 0.
message w058(hrtim_abs_req).
else.
application = cl_pt_cor_application=>get_instance( ).
* get request from guid
call method ca_pt_req_header=>agent->get_request
exporting
im_request_id = request_id
importing
ex_request = request
exceptions
request_not_found = 1.
if request is bound.
if new_status = 'APPROVED'.
clear new_status.
* execute state transition
call method request->initiate_state_transition
exporting
im_transfer_event = c_req_approve
importing
ex_new_status = new_status.
else.
clear new_status.
* execute state transition
call method request->initiate_state_transition
exporting
im_transfer_event = c_req_send
importing
ex_new_status = new_status.
endif.
commit work.
swc_set_element container 'newstatus' new_status.
endif.
endif.
call function 'DEQUEUE_EPTREQ'
exporting
request_id = request_id.
Hi Sanju,
After clicking Approve button PAI of module pool programming is getting called.
So no specific method is getting called on click to approve button.
Now if you want to say, that i should call the PAI, then please let me know that how to call PAI programatically, because i never worked on Module Pool Programming.
Regards,
Amar
Hi Chandra,
But in older version of leave workflow WS04200009, we don't have Request_Id and newstatus elements, so how can i use this code.
Because in this code Request_Id and newstatus is required.
Please correct me if i am wrong, and if Request_Id and newstatus is available in this workflow.
Regards,
Amar
Edited by: amarjyotisingh on Jul 15, 2011 8:33 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.