cancel
Showing results for 
Search instead for 
Did you mean: 

2 level approval for workflow

Former Member
0 Kudos

Hi all,

I am supposed to make an EP workflow for 2 level approval for absences or leaves. I am using a copy of workflow WS12300111. I am able to get the single level of approval, but not the second level. When the request goes to the second approver ( which is the supervisor of first approvar), it shows the leave requests of the first approvar and when I check the workplace of the employee who applied for the leave, his leave has the status 'approved'.

In other words, when the first supervisor or approvar approves the request, it gets approved and second approvar has no option to approve it again. Please suggest what to do?

In my tasks for approval, I am using the class - CL_PT_REQ_WF_ATTRIBS and the method APPROVE. Is that correct???

Is there any other standard workflow which I can refer to?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hey Ribhu,

Well, why dont you reset the status of the Leave Request from APPROVED state to SENT state?

That should solve your problem.

Regards

<i><b>Raja Sekhar</b></i>

Former Member
0 Kudos

Raja,

Thats exactly what I want to do. But HOW????

Former Member
0 Kudos

Hi,

Create a new BOR with a method that changes this the Request's status.

Why dont you check the coding of the include LPT_ARQ_REQUEST_UIAF06, check the sub routine STATE_TRANSITION.

Use the same coding in your BOR's method.

Hope this helps.

Regards

<i><b>Raja Sekhar</b></i>

Former Member
0 Kudos

Well Raja,

I am lil new to classes and BOR's. Can you elaborate some code or some solution please?

Waiting for your reply.

Thanks

Ribhu

Former Member
0 Kudos

Hi,

Create a new BOR and create a new method - CHANGESTATUS.

Add one and only IMPORT parameter REQUEST of type PTREQ_HEADER-REQUEST_ID.

In the coding part, firstly lock your request using the FM - ENQUEUE_EPTREQ.

Then create an instance using the static method ca_pt_req_header=>agent->get_request which takes the REQUEST number as input and gives us the instance as OUTPUT.

Having the instance in hand, we can use the method initiate_state_transition to change the status of this method. Pass the SEND status as INPUT and get the new updated status as OUTPUT.

Unlock the leave request using the FM - DEQUEUE_EPTREQ.

Implement and release this method in your BOR.

And please make sure that your method is INSTANCE INDEPENDENT METHOD.

In your template create a Standard background task after your first approval step which calls this method.

Hope this should close this thread.

Regards

<i><b>Raja Sekhar</b></i>

Former Member
0 Kudos

Hi Raja....

I am trying to get what you are saying..... and I am getting it slowly and slowly.....

Lets see what happens...... I will close the thread once I AM able to change the status again man. I hope I am not giving you less points every time????

Help me more if u can.....

Thanks

Message was edited by:

Ribhu Ahuja

Former Member
0 Kudos

I have made that method change request and have defined the parameter. In coding, what I have to do? I am not clear with that.....

Thanks

Former Member
0 Kudos

I have made that method change request and have defined the parameter. In coding, what I have to do? I am not clear with that.....

And how to go about - creating the instance......

Thanks

Message was edited by:

Ribhu Ahuja

Former Member
0 Kudos

Dear Raja Sekhar,

Can you eleborate more on the initiate_state_transition? I wanted to change the status from approve to sent.

Thanks

Regards,

Bryan

Former Member
0 Kudos

Dear Raja Sekhar,

I create a sampel program with the following code in SE38 and put in the following code. However, it seem that it does not work and the status did not get updated.

Do you know what is the problem?

DATA:

request TYPE REF TO if_pt_req_request,

event TYPE tim_req_xfer_event VALUE cl_pt_req_const=>C_REQTRANS_APPROVE,

req_id TYPE PTREQ_HEADER-REQUEST_ID value '48561480F033007EE1008000C0A8D282',

status type TIM_REQ_STATUS.

CALL FUNCTION 'ENQUEUE_EPTREQ'

EXPORTING

mode_ptreq_header = 'E'

request_id = req_id

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

CALL METHOD ca_pt_req_header=>agent->get_request

EXPORTING

im_request_id = req_id

IMPORTING

ex_request = request.

CALL METHOD request->initiate_state_transition

EXPORTING

im_transfer_event = event

  • im_event = event

  • IM_RET_VALUE = 0

IMPORTING

ex_new_status = status.

CALL FUNCTION 'DEQUEUE_EPTREQ'

EXPORTING

request_id = req_id.

Thanks

Regards,

Bryan

martin_nooteboom
Active Contributor
0 Kudos

Did you debug your program to see what happens?

By the way, stick to your own post in stead of posting your queries in other posts. It is good to see you searched, but posting your queries in other threads is against the forum guidelines.

Regards,

Martin

Answers (0)