Recently I came across a requirement to set the begin date of HSA record when an employee enters “HSA contribution changes” application in the Benefits service in EHP5 WD-ABAP application. The requirement is to default the start date of HSA change to ENDDA +1 of current pay period.
After a little search, I was able to find the Badi PBEN0040, but the problem is we don’t have Pernr, Benefit event data as importing parameters which is required to default the start date. After debugging the benefit application, I found two standard classes which can be used for this purpose.
cl_hress_employee_services and cl_hress_ben_services. I have used the first one to read the employee no. who is logged in using the below code.
cl_hress_employee_services=>get_instance( )->get_pernr( ).
and for reading the benefit event, the code is
lo_instance = cl_hress_ben_services=>get_instance( ).
lv_ben_event = lo_instance->gv_ben_event.
Hope this is useful