Page tree
Skip to end of metadata
Go to start of metadata


Generally an organisation has 4-5 types of leaves. Casual Leave, Annual or Priviledge leave, Sick Leave, Maternity Leave etc. I have come across a requirement to implement validations before applying leave. For eg: Male employees can not apply for Maternity leave or You can not take 3 days consecutive Casual Leave. Implementing these validations and displaying an error message on ESS ( WebDynpro based ) is a very common requirement. Lets see how to go about it in this blog.



A BADI is delivered by SAP to control leave processing. Definition: PT_ABS_REQ.

Create an implementation for this BADI. Standard implementation is delivered: Implementation Name CL_PT_ARQ_REQ.  In Ecc 5 ( ERP 2004) system, its a BADI Implementation CL_PT_ARQ_REQ and in ECC 6 system its an Enhancement implementation. We will discuss about Enhancement Implementation here.

You can copy the implementation CL_PT_ARQ_REQ  and the implementing class. Add your new implementing class to the newly copied implementation. Uncheck the option implementation is active in the original BADI implementation (CL_PT_ARQ_REQ) in the Runtime Behavior of the Enh. Implementation Elements. You will add your code in this implementing class. Reference Interface for this class is " IF_EX_PT_ABS_REQ". After copying implementation and the class, you are now ready to add validations.

2. Methods in implementing class.

The implementing class has a method "SIMULATE_VIA_BLOP". Add validation code in this method. Read the IM_ATTABS_TAB deep structure to get the current absence details. You can validate your rules depending on the current absence record. Current absence record will give you Pernr, Leave type, Dates applied for, Time, Approver etc. Lets say we are implementing a Check for Maternity leave. We know Pernr and Leave type applied. From Pernr we can find out the gender and check against the leave type. If the employee is male then we want to display appropriate error message on ESS screen.

3. How to display an error message on ESS leave request.

This is the most important part. Create a message class using se91 and add an error message to it. Then use following method to display this message on ESS.



                IM_TYPE       = 'E'                                           "Type of Message

                IM_CL         = 'XXX'                                         "Message class that you created

                IM_NUMBER     = 'XXX'                                         "Message no

                IM_PAR1       = 'SIMULATE_VIA_BLOP'

                IM_PAR2       = 'IF_EX_PT_ABS_REQ~SIMULATE_VIA_BLOP'          "Method name as in your impl.

                IM_PAR3       = 'BLOP'
                IM_CONTEXT    = ''
                IM_SUBCONTEXT = ''
                IM_METHODNAME = 'MESSAGE'.

This method will raise an error message on ESS leave request ( WebDynpro based).

Now many will argue that there are BADIs like HRPAD00INFTY and user exits that can be used for this same task. But problem with these BADIs is you can not display an error message on ESS screen. You can display an error message in R/3 (for PA30).

The good old user exits do not work on WD based ESS anymore. You have to replicate the validations in this leave specific BADI and use METHOD MESSAGE_HANDLER->ADD_MESSAGE to display error on ESS screen and restict users.

  • No labels

1 Comment

  1. Hello,

    For using message handling functionality, do we have to copy the standard implementation of PT_ABS_REQ? Or is there any other way we can add message?

    Actually BADI interface doesn't have anything related to message handling. So I am a bit confused how the errors would be routed to ESS screen.

    Best Regards!