Get/Set generator for ABAP OO Classes
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.
Hi,
thanks for linking to my first work on GET and SET Methods...
I thougt, I extended the Post last year but It does not look like.
I also did some enhancements on the very first version I published back in 2010.
May be it would make sense to bring it all togehther and share it on google code?
There has been a project on SAP CodeExchange .. but this is gone:
https://cw.sdn.sap.com/cw/groups/getter-setter-generator
I think my idea was to contribute there ...
No problem, credits to who invented the original concept.
I'm open for sharing and collaborating on this code on google code, sharing is key 😉
Regarding the SAP CodeExchange link, I've also come across it, but found it was gone, that was the main reason I decided to share it trough a blog.
Hey Mark,
Congratulations on your first blog post! The second will be (even) easier, and I'm already waiting for it 🙂 .
Thanks for sharing this nice functionality. Posting the code on Google Code or Github is a great idea...
Cheers, Fred
Hi Huisman,
Congratulations on your first blog. This will be very useful. Good Work 🙂
Cheers,
Kiran
Hi Mark,
wonderful idea. But why not integrate this functionality directly in the IDE? With ABAP in Eclipse there is a SDK available where you can integrate new functionality directly in your development tool without triggering a report. If you want to know more there is a blog from Michael Schneider about it:
http://scn.sap.com/community/abap/eclipse/blog/2013/05/10/first-version-sdk-for-abap-development-tools
Kind Regards,
Thomas.
Basically because the ABAP SDK for Eclipse you are mentioning lives outside of SAP.
Also, the documentation states that I need either a SAP NetWeaver 7.31 SP8
or SAP NetWeaver 7.40 SP2 to be able to use it.
If I look at my tooling, it's a lightweight, 600-lines ABAP which can be easily copied from one system to another, basically supporting SAP ABAP stacks as old as 4.6c (and maybe even older).
Next to that, most customers I face are not even near the versions mentioned above, so I´m dependant on a small ABAP-program to do this for me.
Never the less, I´ll look into enhancing the functionality of the eclipse plugin with getter and setter generating functionality.. but i'm not promising anything 🙂 .
Hi,
I would have expected that this kind of features are available out of the box in Eclispse ...
Is it not as comfortable as it is for java? Where I expect that I only used 10% of the available functions ...
Anyway I agree with M. Huisman that we should not rely on very latest NW releases...
I have "only" 7.31 SP6 available ... which is VERY new compared to the ones I worked on before.
It is difficult to "sell" a complete Enhancement Pack upgrade if you just get some nicer Development tools ...
I hope i can come up with such a google code project soon.
KR