Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Since i'm tangled up in quite an extensive project using Abap OO I came across the issue that the ABAP workbench doesn't allow you to generate getters and setters for class-attributes. After searching a bit on Google I stumbled across Timo John's blog basically assigning the whole issue, and supplying us with a report.

After playing around a bit, I found that I missed some features:

- The report doesn't allow you to select which attributes you want to generate the getters/setters for.

- The report doesn't allow you to easily delete the generated records.

- I use a different standard on naming my attributes, and I wanted a consistent way of naming my parameters.

- I tend to also use constants in my classes, and I don't want getters and setters for that.

Therefore I took the report he wrote and extended (quite a bit of) it.

Before extending the report, I created a class (for testing puposes) with a few attributes on it.

So, in this case you can see I have a few different type of attributes.

Now I fire up the getter/setter generating program.

When pressing F8 it leads me to a second screen in which I can select for which attribute I want to generate/delete the getters and setters.

After generating, opening the class in SE24, you see the getters and setters which have been generated.

Including the implementation and the importing/returning parameters.

Since the blog doesn't allow me to attach a SAPLINK nugget, the download is available from here, hopefully this is something where others can also benefit from.

7 Comments