Skip to Content
-3

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

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.
ELSE.
rv_concession_allowed = abap_false.
ENDIF.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • 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.

    Cf. http://help-legacy.sap.com/abapdocu_740/en/abenclass_component_selector.htm

    But IMHO one shouldn't be doing it.

    Add comment
    10|10000 characters needed characters exceeded

    • 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

      Rich

  • May 29, 2017 at 09:19 AM

    @Prasenjit

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

    Regards,

    SM

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 26, 2017 at 06:57 AM

    And this is inside an instance of the class ?

    Rich

    Add comment
    10|10000 characters needed characters exceeded