Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

access protected and private methods and attributes within overwrite exit

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Halo Rohit,

Overwrite Exit(Implicit Enhancement) is meant to completely overwrite the existing SAP Code. So you will be better off

use different renamed local variables .

Regards

Arshad

3 REPLIES 3

Former Member
0 Kudos

Halo Rohit,

Overwrite Exit(Implicit Enhancement) is meant to completely overwrite the existing SAP Code. So you will be better off

use different renamed local variables .

Regards

Arshad

sreenivas_pachva
Participant
0 Kudos

This message was moderated.

0 Kudos

I think we are better off with renaming of local variable and copying the entire code in the implcit enhancement.

It looks ugly but works.