Professional Documents
Culture Documents
Scenario:
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.
Guidelines:
1. Use BADI: PT_ABS_REQ.
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.
EXPORTING
IM_PAR1 = 'SIMULATE_VIA_BLOP'
IM_PAR3 = 'BLOP'
IM_CONTEXT = ''
IM_SUBCONTEXT = ''
IM_CLASSNAME = 'CL_PT_ARQ_BLOP_ADAPTER'
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.