Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Need to display Error message when there are no approvers found in leave workflow

Dear experts,

In a customized leave workflow for HCM ( Time Module ), we are facing an issue. As per requirements, when there are no approvers found for an user's request then on the portal, it should display an error message. This is a one level cusomized workflow. If requester's approver is blank then it looks for its 1 level up approver and if one level up approver is also not available then it should throw an error message. I was understanding that standard BADI PT_GEN_REQ throws this message automatically when there are no approvers found. I was wrong. Even though there are no approvers, on portal, message is displayed as 'Leave Request was sent successfully.' in workflow logs, there are no approvers found as expected. Functionality wise it is correct ( approvers are coming blank in the logs ) but I want to display error message. That is not coming. I have also observed one more issue. Even though as per logs, there are no approvers, it shows that 'All users can process this task'. This might be coming because, workflow doesn't find any approvers so all the users who have rights to approver might be able to approve. Would you please advise./guide me how to bring the error message ? As per my little understanding, if I succeed to display error message, then work item can not go to any users' UWL. Please correct me if I am wrong. Thank you.

Best regards.


Message was edited by: Abhijit Kamatkar

Former Member
Former Member replied

Hi Karri and experts,

Thank you for your reply.

Well, I managed to resolve this issue and it was worth to check both BADIs in order to resolve this issue. I could say that both BADIs can be used to display the error message.

1)PT_ABS_REQ - Class CL_PT_ARQ_REQ_EXIT and in the method : IF_EX_PT_ABS_REQ~SIMULATE_VIA_BLOP. In table im_attabs we get details of the initiator (( pernr ) who has applied for the leave. Then using pernr details, I was able to find his approver and approver's manager. If both of them are empty, I throw an error message using message handler. This worked for me.

2)PT_GEN_REQ - Class CL_DEF_IM_PT_GEN_REQ and in the method : IF_EX_PT_GEN_REQ~START_WF.

In this standard method itself, we get work item details. Once you get work item, you also get contents of the workflow container. Then it was easier to see whether approver is present or not. If he is not present, I display an error message on the portal using message handler.

I preferred PT_ABS_REQ as I don't need work item details. Initiator's details are more than sufficient in my case.

Thank you very much for your suggestions and inputs.


0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question