inetphantom
inetphantom

Reputation: 2617

Change attribute/getter/setter visibility in abap persistent class

Is there a possibility to change the visibility of the setter/getter from an attribute without changing attribute visibility?

e.g in Java I can say:

That is very practic if I want to allow only in private scope changes, in protected scope I allow changes via setter (some checks and verifications in there) and in public scope you can only read.

In the classbuilder you can only change all of them together.

Upvotes: 2

Views: 786

Answers (2)

vwegert
vwegert

Reputation: 18483

You can make the attribute public and change it to read-only in the persistence mapping - this will prevent the setter from being generated. You can change the attribute visibility in the class builder or the persistence mapping, which will affect both the setter and the getter. As far as I know, there are no other ways to affect the visibility. For a greater control, I'd recommend wrapping the persistence class - either in a separate class or by introducing a public getter-only interface whose methods defer to the generated getters.

Upvotes: 1

Jagger
Jagger

Reputation: 10524

Yes, it is possible. Just make use of this button.

enter image description here

And then change the visibility

enter image description here

Upvotes: 0

Related Questions