abapGit – so easy
Are you an ABAP developer? Are you using abapGit?
If you answered “Yes” to the first question did you answer “Yes” to the second question too?
You might be thinking – “What is abapGit?” – so let’s start there. The simple answer is that abapGit is a Git client written in ABAP for ABAP.
Some of you are now thinking “What is Git?”. I’m sorry that is outside the scope of this post but please, please, please use Google to figure that out. And I urge you do it quickly – like “now” – and then return to this post later. Git is a fundamental part of the contemporary developer’s toolkit. IMO ignoring Git is not an option for developers in 2017.
Back to the topic at hand. abapGit is an Open-source project initiated by Lars Hvam under an MIT License.
At time of writing there are 24 contributors to the abapGit project. There have been over 400 commits in the past 5 months alone which shows this is a very active and vibrant project. Maybe you too will want to contribute and help make abapGit bigger and better?
One of the design goals of abapGit is that it should have a “small footprint”. This can mean many things to many people. One thing is it is absolutely the easiest ABAP project to install – EVER! No transports. No multiple steps. No pre-install of other things. No file uploads. No patches required. No add-ins required. Simply copy and paste code into a program on your ABAP development system and activate.
The first thing you might want to do after installation is connect to GitHub so you can keep your abapGit code up to date. Yeah – amazing concept isn’t it? We can pull down the latest version of the abapGit project any time we like. Kapow! Take that CTS! abapGit also has a “background mode” so you can automate this task.
You are highly likely to want to use GitHub for some of your repositories anyway. It is the most popular hosted Git out there, it is free, and it contains some other awesome ABAP Open-source projects like abap2xlxs.
For abapGit to talk to GitHub we have to use TLS. This means we have to install some root certificates on our ABAP system using transaction STRUST. The abapGit installation documentation takes you through how to get these certificates and install them. And there is also a simple test program so you can ensure the connection to GitHub works.
If you want to connect abapGit to other Git servers they may well mandate you use TLS as well and therefore you might have to install other root certificates depending who their CA is.
So now that is done, let’s see how we can link to the abapGit repository on GitHub so we can keep our installed abapGit code up to date with the latest developments. There is a wizard to help you do this in a few clicks of the mouse.
When abapGit is run for the first time it will take you to the abapGit tutorial page. You can also find this via the menu Help->Tutorial. Simply click on the “install abapGit repo” link to kick off the process. You will be asked to confirm that you want to install into package $ABAPGIT. abapGit links Git repositories (repos) to ABAP packages. So we need to store the abapGit artifacts in a local package of their own – in this case $ABAPGIT. You will also be asked if you want to overwrite the ZABAPGIT program you just created. Answer “Ok” to this. Activate all the abapGit artifacts and you are done.
To finalise this post – and hopefully to leave you with just one example of how abapGit changes the game for ABAP developers let me take you through a simple scenario. We need to start by cloning a repo to an ABAP package. I am going to use the sample code from my recent presentations on Building Gateway Services which can be found at https://github.com/grahamrobbo/teched16_example.
See how easy that was? A few clicks here and there and I have all that ABAP code pulled down from GitHub into a package I was able to create from inside the abapGit UI including activated everything. Kapow!
Now watch as I stupidly decide that my code needs a little too much refactoring. I brilliantly decide to delete the interface ZIF_GW_METHODS because I have forgotten how this is used all over the place. Suddenly I have lost important code, the stuff I have is broken, and I can’t activate anything. Arrrggghhhh. I guess I will have to logon to the production system and copy and paste the old code from there to get me back on track? Assuming I can remember all the other changes I had in progress as well.
Or – I can just refresh my package from the latest commit on my GitHub repo. And because I “commit early and commit often” I have lost none of my work in progress either.
And that is just one benefit of bringing Git to the ABAP developer toolset.
RIP Adam West
BREAKING NEWS BREAKING NEWS BREAKING NEWS BREAKING NEWS BREAKING NEWS
In his SAP TechEd Las Vegas keynote presentation Bjoern Goerke announced that “we (SAP) are going to work with the SAP Mentors to embed this (abapGit) into the ABAP design-time“.
You can hear this announcement and see Bjoern’s demo around the 41 minute mark of the keynote presentation replay.