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: 

Create Post Exit Method - Access to protected attribute is not allowed

Former Member
0 Kudos

Hi Experts,

I am creating a post exit enhancement for standard ABAP class method.

Once its created when I run syntax check it says the " Access to protected attribute is not allowed".

The standard abap class method has a returning parameter, its associated type is protected attribute ( Refering different class attribute).

Could you please guide me how to overcome the above issue.

Thanks and Best Regards,

Vinoth

6 REPLIES 6

former_member195402
Active Contributor
0 Kudos

Hi Vinoth,

try to find a public method, where you can access the attribute's value. Scan the whole class for the attribute's name and check the where-used-list.

Regards,

Klaus

0 Kudos

Hi Klaus,

I am not able to create a POST exit ITSELF... the moment I create and do  syntax check , its throwing a message.

the standard class method has a returning parameter which is associated to protected attribute.

Best Regards,
Vinoth

0 Kudos

Hi Vinoth,

why do you enhance a SAP standard class?

What about creating a custom child class of this standard class?

Regards,

Klaus

0 Kudos

Klaus Babl wrote:

What about creating a custom child class of this standard class?

2 things i would like to point out -

  1. We don't know if the standard class is not marked as "Final".
  2. We cannot access the private attributes of the parent (standard) class

0 Kudos

Hi Suhas.

1. Yes, we don't know, but we will hear from Vinoth, if it is not possible to create a child class.

2. I don't think we need to access the attribute of the parent class. Methods can be redefined, new attributes can be added, there are several options in a child class to find a workaround for that.

Regards,

Klaus

SuhaSaha
Advisor
Advisor
0 Kudos

Once its created when I run syntax check it says the " Access to protected attribute is not allowed".

Which version of ABAP release are you working on?

I know that for releases > 731 you get a pop-up asking if you wanted access to the private/protected elements of the class.

This is possible via the usage of the addition LOCAL FRIENDS - ABAP Keyword Documentation.

BR,

Suhas