Making ESS Personal Profile read-only dynamically
Hello,
It’s been a while since I’ve thrown together a blog which hasn’t involved cloud or mobile or just general ranting, but today I threw together some code that was so simple and useful that I just had to share it. 😀
The business problem
The client wanted a solution where accessing their ESS personal profile screens would not lock the employee records, but only during the day or so a month that payroll was processing.
Now, personally, if I had my way there wouldn’t be a need for this as I’d redesign payroll on HANA such that payroll processing was obsolete… but that’s another blog and a dream away.
The solution
A simple switch?
There is a parameter for the WDA personal profile application that can be set to put the application into a read-only state. Check outSagar Joshi’s blog post Exciting Enhacements to ESS Personal Information Profile in Enhancement pack 6 for an explanation of the various parameters.
So by setting the WD application parameter READ_ONLY_PERSONAL_PROFILE equal to ‘X‘ the application won’t cause a lock. 🙂
Unfortunately a little testing found that this wasn’t actually the case 🙁
A search on Service Market Place however found:
After implementing the note, the promised functionality did work 🙂
Making it dynamic
So I could now switch the functionality to read only by using an application parameter, the question was how to do this dynamically?
Sometime the simplest ways are best 🙂
I created a simple freestyle FPM UIBB:
and in the WDDOINIT method added some very simple code:
METHOD wddoinit .
DATA: lo_fpm TYPE REF TO if_fpm,
lv_dummy TYPE string.
IF wd_assist->is_pay_processing( ) = abap_true.
lo_fpm = cl_fpm_factory=>get_instance( ).
lo_fpm->mo_app_parameter->set_value(
iv_key = 'READ_ONLY_PROFILE_WITH_DETAILS'
iv_value = abap_true
).
MESSAGE e000(zm_hr_ess) INTO lv_dummy.
lo_fpm->mo_message_manager->report_t100_message(
iv_msgid = 'ZM_HR_ESS' " Message indentification (Class)
iv_msgno = '000' " Message number
io_component = wd_this->wd_get_api( )
iv_severity = if_fpm_message_manager=>gc_severity_warning ). " Report the severity of the message
ENDIF.
ENDMETHOD.
This code called the assistance class to figure out if the payroll was processing. The logic of that will quite possibly vary from site to site so I won’t go into too much detail (also because I don’t think my employee object is perfectly implemented either (should have built an interface and a factory method, but never mind!)
METHOD is_pay_processing.
DATA: lo_pernr TYPE REF TO zcl_hr_employee.
TRY.
CREATE OBJECT lo_pernr
EXPORTING
iv_pernr = cl_hress_employee_services=>get_instance( )->get_pernr( ).
rv_payroll_processing = lo_pernr->is_pay_processing( ).
CATCH cx_hress.
* caught and handled by main ESS page too
ENDTRY.
ENDMETHOD.
Note the use of the cl_hress_employee_services method – very useful!
Adding it together
Now I added this UIBB into the INITIAL_SCREEN of my ESS config.
It’s important that it’s the first UIBB in the page – as this determines that it gets called first!
To wrap up
So I met the customer’s requirement to have a dynamic read-only ESS screen with very little code indeed, and even better, no modifications or enhancements! 🙂
I hope this post is of use to you, it was such a simple 😎 solution that it really needed to be shared. Hopefully it might save you buying a really expensive modification solution from a third party! 😀 Just throw a little code together and you should have a solution that can work in less than a day.
All the usual disclaimers, as in, even if the pictures above make it very clear that the solution and code provided work, they might not, they might even make little green men start running out of your coffee machine – you implement at your own risk! No opinions expressed here should be taken as representing the company I work for, the client I implemented this for or anything other than my ramblings. Nothing here or should be relied on for making any decisions whatsoever. HTTP 418.
Hi Chris,
Nice trick....
Just another opinion
I believe there could be a simpler solution to problem by implementing BAdI HRESS_MENU
http://scn.sap.com/community/erp/hcm/employee-self-service/blog/2012/05/31/tips-recommendations-for-customizing-ess-menu-wd-abap
You could just evaluate if Payroll is on/off during certain days and pass additional parameter READ_ONLY_PERSONAL_PROFILE = 'X' Dynamically to application.
On the Menu you can also display text that due to paryoll the access is set to read only.
Thanks, Sagar
Thanks Sagar,
Of course the BAdI only works if you are using the WDA LPD menu or NWBC menus (I believe) and requires you to redefine the filter values/re-implement the NWBC BAdI (as no-one would be using the standard SAP roles 😉 ). The BAdI also suffers from the same issues as using a proxy class did in WDJ ESS - in that the evaluation of the parameter/configuration to be chosen happens when the menu is loaded and not when the user executes the application. 🙁
But being able to tell people on the LPD/NWBC menu that the pay area is processing (at least when the menu was first opened) is a very nice touch! 🙂
Thanks for updating with that option! I have to admit that I hadn't really thought of using the NWBC_RUNTIME_EXTENSION_ROLE enhancement spot at all. (or the related call to the HRESS_MENU BAdI).
Cheers,
Chris
Hi Chris
Thanks for the great blog. I was able to do this following your procedure. From the personal profile overview, I see the pencil(edit) are now turned to Details and this is awesome as users could view the details as well read only. But when I come back to the Personal Profile overview from any of the details page, I lose the message warning message. Am I missing something?
Thanks, Raj
I've just tried doing this (to control whether an employee has access to maintain their talent profile or not depending on whether they are part of a talent group or not) - and found that in NWBC the BAdI is only called if the navigation tree cache doesn't already exist. So in the case of HTML NWBC the BAdI always fires, but in the case of standard NWBC, the cache means it does not fire every access. So if the condition that access is being granted/denied is transient, then I'd suggest the use of this BAdI to control NWBC menus isn't the best 🙁
Fortunately being part of a talent group isn't that transient, so should be OK. but will be a bugger for the testing team 😉
Hi Chris,
Nice blog.
Is it possible to do make a particular section read-only like 'Bank Information' tab dynamically.
Regards,
Porselvan
Hi Porselvan,
I've not had the requirement to dynamically just change one section - generally if some employees aren't supposed to maintain bank information, this is a constant in the cases I've been involved in so far.
You could used the launchpad BAdIs as suggested by Sagar with different configuration to enable/disable some services (probably easiest option) or alternatively if you really need to to be very dynamic, you could subclass the feeder class and override some of the methods (but this is far tricker!)
Good luck.
Chris
Yes this should be possible. Please check
http://scn.sap.com/community/erp/hcm/employee-self-service/blog/2012/05/29/exciting-enhacements-to-ess-personal-information-scenario-in-enhancement-pack-6
You can make a particular infotype/subtype display only by using V_T7XSSPERSUBTY or BAdI HRXSS_PER_SUBTYPE
With BAdI you should be able to achieve desired behaviour dynamically
I like the BAdI approach, it's really great the enhancement options that EhP6 has given us! 🙂
Hi Sagar
Please explain how V_T7XSSPERSUBTY could be used for read only purpose?
I know how to make desired info- & sub-types available, but i can not figure how this is used for making these read-only.
Best Regards
Michael
If you are on EHP6 and activated the business functions then you should see additional checkbox in view to make a subtype read-only
We are on EHP6, so I have to find the Business Function. Which one is it?
Michael,
I asked this very same thing last week...Answer can be found
. Hope that this helps!Cheers!
Jason
Hi Chris,
Its a very useful doc. Thanks a lot 🙂
Regards,
Namsheed
Hi,
I have done the following
setting the WD application parameter READ_ONLY_PERSONAL_PROFILE equal to 'X' . And this is working perfectly in Development. when I moved the TR to Quality, it is not working still getting PERNR is locked.
Why happenening like this..??
Do I want to implement note 1769653...??
Regards,
Namsheed.
Hi Chris,
Thanks for the great blog. I am implement your code already, but still did not work for me. Is there anything that i must check to make your guidance worked well. Thanks.
Best Regards.