Eclipse ADT plugin for temporary versioning
Inspired by this question.
In SAPGui, you can for most ABAP Workbench objects create temporary versions. Then during development if you need to revert a change that you’ve not yet transported, you can go back to an earlier version. When the transport the object is locked against is finally released the temporary versions are deleted.
I develop in Eclipse/ADT, which has local versioning which happens everytime you save your work. This is far more useful to me than having to manually make a version. But some people Mike Pokraka for example, like to use temporary versions. So I created this plugin to be nice to such people. 😀
How to install
You can find the plugin here. Just download the zipped file, extract the contents and update Eclipse from the local folder.
You’ll also need a function module. By default it’s called Z_SVRS_AFTER_CHANGED_ONLINE. This function module is needed, because SVRS_AFTER_CHANGED_ONLINE_NEW that does the actual work isn’t RFC enabled.
However, if you don’t like the name you can create your own with whatever name you choose. Just make sure it has exactly the same interface! Then, once the plugin is installed, you can go to Window->Preferences->Temporary Versioning->Function Module Name and enter the name of your function module.
And that’s it. Right-click on your object in the editor, favourites or outline and choose Run As->Create Temporary Version.
It’s all a bit rough and ready, but I’m sure it can be improved upon. I’ve had to use some classes in ADT that are not part of the official API, but I couldn’t find another way to do it. I used the source code of “Run as->ATC” as my base.
It won’t work for all objects – e.g. structures. I’ve only written it for classes, function modules and programs. Since it’s hard to figure out whether to use R3TR or LIMU, if one fails, I try the other. This is coded in the function module so easy to change – you don’t have to clone my repository and do some Java coding!
How to find ADT source code
This is kind of cool. You’ll need Eclipse PDE with the spies plugin installed (for details try here part 8. This site has free tutorials on developing plugins, but it also has course you pay for which are very good). You’ll also need a Java code decompiler Eclipse plugin. I use this one. And of course, you’ll need ADT!
To find the ATC launcher, I ran my plugin as an Eclipse application. I ran ATC one one of my ABAP programs, then on the results, pressed alt-shift-f1. This told me that the ATC plugin is com.sap.adt.atc.ui. And the spy presents this information as a navigation link, so I could just open it.
I went to the Extensions tab, and found the launcher enhancement point(org.eclipse.debug.ui.launchShortcuts), and this gave me the class com.sap.adt.atc.ui.internal.launch.AtcLaunchShortcut.
Now all I had to do is figure out (back in my plugin development environment), which library contains this class and add it to the dependencies of my plugin. Then I could from the Project Explorer, examine this libary, find the class and see the source code.
The entire source code is available in my repository. If anyone wants to refine it, feel free to clone it and submit a pull request with any changes you make.