Hi,
You can use SAP standard workflow WS12300011 for leave approval. Just modify it as per your business requirement. For deadline monitoring, create a method and get deadline date and time in 2 workflow containers, you can use function module END_TIME_DETERMINE. Insert those deadline date and time on latest end tab of your approval activity step type. in the processing obsolete branch, create a method to auto approve the leave request.
Write below code in the method for changing the leave status to 'Approved' (auto approve).
call method cl_pt_req_badi=>get_request
exporting
im_req_id = iv_request_id "" Request id, pass it from workflow
importing
ex_request = lo_request.
*-- Initiate the State Transition to APPROVED
call method cl_pt_req_badi=>initiate_state_transition
exporting
im_request = lo_request
im_event = cl_pt_req_const=>c_reqtrans_approve
importing
ex_new_status = lv_new_status.
commit work and wait.
Regards,
Ibrahim