‎2014 Aug 07 10:18 AM
Hi
Is is possible to add custom code to a private method of a SAP standard class? We are prototyping an upgrade of our Erec system and I have an error which is an issue with the ' add_role_to_bupa' method of the class CL_HRRCF_CANDIDATE. A SAP note meant to fix the issue has already been applied but the code is different from our current system hence the need to edit the private method.
I've been reading about enhancement options but so far nothing I've found seems to provide me with the option that I'm after.
Cheers
Jon
‎2014 Aug 07 2:14 PM
Hi Jon,
you could implement an enhancemant for the class and use an overwrite-exit for the private method as shown in this document: http://wiki.scn.sap.com/wiki/display/ABAP/Enhancement+Framework+-+Class+Enhancements+-+Pre-exit,+Pos...
Regards,
Kay
‎2014 Aug 07 10:20 AM
‎2014 Aug 07 10:26 AM
‎2014 Aug 07 10:45 AM
Hi,
You can do this by implementing Implicit Enhancement Point.
Follow these steps :
Regards,
Ashish
‎2014 Aug 07 11:07 AM
Thanks for that Ashish.
So basically I can't alter the existing code or overwrite a private method?
So far I'm not getting he option to Goto Enhancement Operations -> Create Implementation
‎2014 Aug 07 11:34 AM
Hi,
You need access key to change the standard code which is not recommended as it will void SAP support for that object. But you can add custom code using implicit enhancement point with no such disadvantages.
You need to be in enhancement mode with implicit enhancement points visible.
Regards,
Ashish
‎2014 Aug 07 1:19 PM
Cheers Ashish.
I've got that now. If I now write my custom code how will that overwrite what's happening in the existing code which is causing the error?
Thanks again
Jon.
‎2014 Aug 07 1:43 PM
Hi,
Like the enhancement point you found at the end of method, similarly there is 1 at the start of the method.
So what you can do is :
Regards,
Ashish
‎2014 Aug 07 1:52 PM
Oh my days!! Sometimes coding with ABAP is like trying to play snooker with a piece of string!!
Thanks Ashish.
‎2014 Aug 07 2:14 PM
Hi Jon,
you could implement an enhancemant for the class and use an overwrite-exit for the private method as shown in this document: http://wiki.scn.sap.com/wiki/display/ABAP/Enhancement+Framework+-+Class+Enhancements+-+Pre-exit,+Pos...
Regards,
Kay
‎2014 Aug 07 3:14 PM
Thanks Kay.
That definitely looks promising. I'll have to evaluate which option is the most suitable for my needs.
Regards
Jon
‎2014 Aug 08 6:45 AM
That is a useful tip by Kay. Use that if you want to overwrite the standard code completely.
‎2014 Aug 14 7:49 AM
Thanks Kay and Ashish.
I chose to go with Kay's suggestion in this instance as it suited my scenario best.
Thanks for your help and guidance.
Regards
Jon