Skip to Content

Is it possible to access a static attribute using me operator in ABAP 7.4

Apr 26, 2017 at 05:47 AM


avatar image
Former Member

Hi Folks,

I have an issue in ABAP 7.4 code that i wrote. I have developed an application with a static attribute and by mistake I accessed it using "me" operator and the compiler compiled th

IF ( rv_concession_allowed EQ abap_true ) AND ( me->gv_vic_concession_config EQ abap_false ).
rv_concession_allowed = abap_true.
rv_concession_allowed = abap_false.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Suhas Saha
Apr 26, 2017 at 07:22 AM

Yes, you can. It's not something new to ABAP 740.

Per SAP documentation,

It is also possible to access the static components of a class using the object component selector if an instance of the class was created.


But IMHO one shouldn't be doing it.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

okay, actually all these years I knew Class=>static component and me->instance and never experimented as it sits well with what I learnt in OOP. Y'day i did this and while doing a code review I found this and surprised but this is sick and not good where is the sanity then ? :-) Thanks Suhas for replying.

I also find the constant behaves funny did they change it or it too was there?


I think the way that an attribute is accessed depends on where it is being accessed from and do not find this behaviour strange at all. Whether an attribute is only accessible via an instantiation (and is public), or whether it is accessible without being instantiated is a matter of 'convenience'. For example, if you want to use constants of a class outside that class you don't really want to instantiate that class each time.

As for accessing a static attribute via 'Me' - well that attribute is part of the class and I would find it weird if that didn't happen


Srinivasa Mukka May 29, 2017 at 09:19 AM


why dont you check in your abap code instead of writing here...... please read SCN guidelines



10 |10000 characters needed characters left characters exceeded
Richard Harper Apr 26, 2017 at 06:57 AM

And this is inside an instance of the class ?


Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Yes sir it is inside the instance method of the same class.