What is abapGit and how does it work?
Assuming you are already familiar with ABAP programming but have not heard about abapGit, let us first shortly introduce you to the Git world.
Git is a version control system, „VCS”, which gives us the possibility to follow changes in a file. Yet, you may be wondering, what is a VCS and what is its purpose?
A Version Control System, also known as a Revision Control, is a system that gathers and stores the history of changes in any collection of files or source codes during their lifetime cycle. Each change is assigned to a „revision number” and has a bookmark that includes when and who made that specific change.
Versioning procedures have become more and more necessary in the field of computer science. Significantly, a version control system allows us to go back to or restore an older version, in case there is an undesirable change in or deletion of a software program.
ABAP itself also brings in a version control system, but this system is closed in its own environment, hence it does not allow working together with “outsiders”. This happens particularly for opensource projects, but also in general, for all source codes, and for that reason, sharing is quite complicate.
If you are interested to learn more about Git, we highly recommend you the book “Pro Git” written by Scott Chacon and Ben Straub. It is available under https://git-scm.com/book/en/v2.
In the landscape of SAP development, abapGit comes as the Git client written in ABAP. It is an Open Source project initiated by Lars Hvam under an MIT License. You can find his blog posts on https://people.sap.com/lars.hvam.
More helpful information about abapGit itself and other great ABAP open source projects can be found in the great blog of Graham Robinson, which is also the basis for the article today: https://blogs.sap.com/2017/06/21/abapgit-so-easy/.
In this article we will focus on the installation and utilization of the ABAP Git using GitHub and AWS CodeCommit. In the following procedures, the environment used was SAP NetWeaver 7.5. Now let’s take off on our journey.
Four steps away from the abapGit experience
In order to be well equipped to explore the abapGit features, further are the steps needed for setting up and connecting to the development platform and hosting services.
Step 1: abapGit Server installation
First and foremost, all we need to do is to run the abapGit project on our ABAP development system.
Considering you already have access to an SAP NetWeaver installation, open the SAP GUI client and create an ABAP Report “ZABAPGIT” via SE38 or SE80 transactions. Then replicate the code from this link: https://raw.githubusercontent.com/abapGit/build/master/zabapgit.abap
Activate and execute your report. Consequently, the abapGit Homepage will be displayed on screen.
Please keep in mind that if you want to update your abapGit project to a newer version, you just need to replace the code in the report with the most recent settings and the upgrade is done.
In other words, this is a straightforward manner through which you can download the most recent version of the abapGit whensoever. Easy, right?
Step 2: GitHub Root Certificates download
In this next step, we will carry on with the SSL setup which allows us to use the online feature of the Git server. As opposed to, offline projects operate behind firewalls and without SSL. An SSL, “Secure Sockets Layer”, certificate is a text file with encrypted data that we need to install on our server for establishing a secure, reliable and responsive communication with a web browser.
Nowadays, the most popular web-based community hosted by Git is GitHub. To enable the communication between the abapGit and GitHub, it is necessary to install some root certificates on your ABAP system. We have several options for downloading the files depending on the web browser we use, otherwise, we can download them manually. The purpose of these root certificates is to assure the integrity and privacy of the communication data between the server and the web browser.
We have used Google Chrome as the main web browser. Proceed with the following steps to find the necessary certificates:
- Go to https://github.com.
- Click on the locker icon near the address bar and then select “Certificate”.
- Go to the “Details” tab and click on “Copy to file…” to export the certificate to a .CER file.
- Specify the name of the file, choose the path to which the file will be saved and press “Finish”.
- Select the “Certification Path” tab and repeat the two previous steps starting from the parent node of the tree until the root node.
If you want to manually download the root certificates, navigate to the GitHub platform and find the certificates that it is using, as shown for the above browser. Download these certificates from https://www.digicert.com/digicert-root-certificates.htm by accessing the “Root Certificates” section.
You can find more information here: http://docs.abapgit.org/.
We have now the files in the format wanted and, consequently, we can establish the connection with the SAP system.
Step 3: SSL Setup using SAP Trust Manager
For the previously downloaded certificates to be acknowledged, we need to install them in the SAP system using Trust Manager application. Therefore, log on to your SAP GUI system and run the STRUST transaction.
Make a switch to the “Change” mode and from the top-left objects list, open the “SSL System Client SSL Client (Anonymous)” folder.
Choose ”Import certificate” from the bottom-left side of the “Certificate” box and insert the file paths of the certification files exported earlier from the web browser.
Select “Add to Certificate List” for each certification file separately, one by one. As a result, the “Certificate List” box should look as follows:
Save the changes made. The root certificates are now installed on the SAP development system.
In order to check if the ABAP tools can communicate with the Git server, it is compelling to test if the connection between them works properly. To give an illustration for that, create an ABAP Report “ZABAPGIT_TEST_SSL” via SE38 or SE80 and copy the code from this link: http://docs.abapgit.org/other-test-ssl.html
Activate and execute your program. If the connection has been successfully established, following output is expected:
However, if the connection is not working properly, consider the fact that you may have to set two profile parameters in the RZ10 transaction (see also SAP Note 510007 – Setting up SSL on Application Server ABAP, step 7).
For instance, in our system we had to set the following values:
ssl/ciphersuites = 135:PFS:HIGH::EC_P256:EC_HIGH
Please keep in mind that you need to restart the application server or at least, in the ICM Monitor, SMICM transaction, to restart the icman process!
Dive deeper into the subject by going to https://blogs.sap.com/2008/10/31/calling-webservices-from-abap-via-httpsssl-with-pfx-certificates/.
Step 4: Git Repositories connection
Keep your installed abapGit code up to date with the most recent developments and extend the supported object types by downloading the required plugins.
Particularly, when abapGit is run for the first time, the abapGit tutorial page will be displayed, as shown in Step 1. On the bottom side of the page, you can find the “abapGit related repositories” section.
Click on the „install abapGit repo” to start the process. Press „Continue” to download the current version of abapGit into package $ABAPGIT, which in this case is a local package. Choose „Overwrite” to update the „ZABAPGIT” program created previously and activate all the abapGit artifacts.
In a similar manner, choose „install abapGit repo”, proceed the steps and you will be then ready to experience the abapGit features.
An important thing to be detailed here is that not only GitHub platform, which is a web-based hosted service for version control, can be used to connect with the abapGit, but there is also the possibility to communicate using the Amazon Web Services.
We as Inspiricon work a lot with the Amazon Web Services, so for us, it would be the best to use the “AWS Service CodeCommit” as Git-Server for our repositories. If you want this as well, the first thing you might want to do after the installation is to connect to the Amazon Web Services, so you can leverage the online feature of the abapGit platform.
Amazon Web Services, shortened as “AWS”, offers reliable, scalable and secure cloud computing services, database storage and other functionalities to help in the business processes. For connecting to the AWS Server, you need to follow several steps.
The first steps are similar to the previous ones presented for connecting to the GitHub server, including the download and upload of the root certificates, as shown in Step 2 and Step 3. Next thing is to create IAM-Users in the AWS. It is important that you create in the IAM-User profile “HTTPS Git credentials for AWS CodeCommit”.
As privileges you should assign at a minimum the following permissions:
- AWSCodeCommitPowerUser AWS Managed Policy
- IAMReadOnlyAccess AWS Managed Policy
- IAMSelfManageServiceSpecificCredentials AWS Managed Policy
For more information, you can also go to https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html.
After the initial configuration is made, you can create your own repositories in the AWS CodeCommit Dashboard.
Online and Offline?
First and most importantly, the abapGit project can be started in the SAP NetWeaver platform using the transaction “ZABAPGIT”. abapGit comes in with the Online and the Offline features. On the one hand, the offline feature refers to replicating a local ABAP package from your system into the abapGit workspace. On the other hand, the online feature allows us to work with repositories. Hence, what it is a Repository?
A repository, frequently abbreviated as “repo”, is a location where all the files for a single project are stored. Each project has its own repository and it can be accessed by using a unique HTTPS-Url. We need to connect this repository to an existing ABAP package from our system or to create a new one.
An increasing number of companies and developers around the world have decided to make a switch and use Git as the main control software. In the landscape of the SAP industry, abapGit comes to the help of developers in the form of an ABAP client written in ABAP which completely benefits from the Git functionalities.
AbapGit is free, fast and provides a consistent, scalable model. Another big plus is that abapGit automatically pushes changed objects to the remote Git repository, being, in the same time, an environment which facilitates the process of parallel development. It is best suited for code sharing and for tracking changes in the development process.
Open source projects and code sharing beyond company boundaries are a good way to participate to the open source community, to learn and improve your own skills and find new solutions for different actual problems. Furthermore, all these are supported by Git and abapGIT!
Do you feel enthusiastic to find out more about the subject? We would be very happy to keep you informed with the updates and to present you many more other interesting topics and projects we are also involved in. Stay in touch!