<div dir="ltr">Dear Friends,<br>
  We have copied the standard leave request workflow WS12300111 and enhanced it with two levels of approval.<br>
As per the Workflow design of the leave Approval, the Status of the
leave request will be in SENT Status when the employee sends the leave
request for approval. When the Manager approves the leave request the
status of the leave request will be changed to APPROVED. The <b>workflow system will then change this again to SENT for second level approval(this is not available in standard)</b>
and when the second level approver approves the leave request the
status is again changed to APPROVED(part of standard). The background
job which posts the leave requests RPTARQPOST will pick the all leave
request which has a status APPROVED and create a leave request in R/3
and finally change the status as POSTED. For changing the leave request
status from APPROVED to SENT(intermediate step) we have created a
method inside the class CL_PT_REQ_WF_ATTRIBS and call that method
inside a task in workflow and we are using the following code to change
the status. The issue we are facing is the leave request are getting
posted without the second level approval, means the worklfow is in
ready status(for second level approval) but the leave request is having
the status as &quot;Posted&quot;, and because of this when the second level
approver opens his work item from UWL, he cannot see those leave
request. Please advice what could be the issue and how to trouble shoot
this problem. I tried to simulate the same issue in Quality system and
its working fine.<br>
<p>
  </p><pre class="jive-pre"><code class="jive-code jive-java">DATA: request TYPE REF TO if_pt_req_request,<br>              event   TYPE tim_req_xfer_event VALUE cl_pt_req_const=&gt;c_reqtrans_send.<br> <br>    CALL METHOD cl_pt_req_badi=&gt;get_request<br>
    EXPORTING<br>      im_req_id  = me-&gt;req_id<br>    IMPORTING<br>      ex_request = request.<br> <br>  CALL METHOD cl_pt_req_badi=&gt;initiate_state_transition<br>    EXPORTING<br>      im_request    = request<br>      im_event      = event<br>
*    IM_RET_VALUE  = 0<br>    IMPORTING<br>      ex_new_status = me-&gt;status.<br></code></pre></div>