Skip to Content
0
Former Member
Dec 16, 2011 at 02:19 AM

access protected and private methods and attributes within overwrite exit

490 Views

Hi,

I am trying to access protected and private attributes and methods from within overwrite exit of the same class. The overwrite exit intends to retain the standard functionality of the method which it replaces along with some custom coding. In order to do so I created an additional public method called GET_ATTR which is called via instance of core_object, generated by SAP automatically as a part of Overwrite Exit. This public method has all the private and protected attributes used in the original method (I mean the one which is getting overwritten) as its exporting parameters. Similarly for each protected method, I have created a sort of wrapper method which is accessed via same core_object and which in turn calls the protected method.

All went fine till now. When it came to setting the protected attribute values, I was unable to do so even with using something like SET_ATTR public method of core_object.

Is the above approach correct or am I better off with simpltying using Implicit enhancement spots in the method (which is currently having overwrite exit) and use different renamed local variables and ending the enhancement with a statement like CHECK 1 EQ 2, thereby preventing the ABAP runtime to get into the standard implementation. Which one is the recommended approach?

Thanks and Regards,

Rohit