Export Objects from SAP System to Github Indirectly (ABAPGIT Offline Mode)

Aditya Aufar
4 min readJan 7, 2022

The Appetizer

As an SAP ABAP Consultant I have experienced that the requirements and the solutions can be identical or even exactly the same across projects or clients. Well, I can actually copy manually the codes or solutions and paste it locally in notepad or in any other code editor.

There is also another approach of using custom program that can run and export the code automatically to the local system as a various file formats. But surely those approaches can be troublesome to manage in the local machine , not to mention it can not be accessed once switching to another local machine (computer). Unless backup already made to the cloud storage or portable storage beforehand.

Just on top of my head, at least you can benefit these for using ABAPGIT and storing the codes to Github:

  1. Sync the source codes between the SAP System and the cloud (Github) (Although additional configuration may needed to connect between the two and sync automatically)
  2. Github has huge community of developers. Not only SAP ABAP, but others too! Once you upload it to Github it can accessed to all Githhub community members. Others may find your solutions or codes helpful or even can lend you a hand so your solutions can be better! However you can also set your account to private if your purpose is just to backup your code.
  3. Your Github account can also represents your code portfolio because it shows what you you have been working on. Additionally, you can also add README file that can explains in short what the codes or solutions all about.

However, Github is not the only platform you can benefit by using ABAPGIT. There are also another platform such as Gitlab, Bitbucket, etc.

The Main Course

The best practice surely to export the objects from SAP system using ABAPGIT to Github directly (the online approach). That’s why the steps regarding that approach should be found easily on the Internet.

However, there are times that the connection between the SAP system and Github can not be made. This usually can happen because the SSL is not set up properly, the SAP system is not connected to the internet (e.g behind firewall) or etc.

Prequisites

Download and install Git in your local machine here https://git-scm.com/downloads (This article will only cover the Windows in the local system)

The Steps

1.Open or execute the ABAPGIT program in the SAP system. Click New Offline button

2. The page below should appear. Fill the Repository Name according to your liking and the Package with package created in the SAP system. Make sure the chosen package contains the objects you want to Import. After all mandatory fields filled, click Create Offline Repo button

3. This page below should appear next. You can press the Export button to export ABAP objects in ZIP file format to whichever location in your local system. After that, extract the ZIP file. Make sure the path of extraction is main_folder/* . If the ZIP file name is ZABAP_AUFAR_GIT_TEST_20220105_160038.zip, extract it to ZABAP_AUFAR_GIT_TEST_20220105_160038/* or ZABAP_AUFAR_GIT_TEST_20220105_160038 folder. The folder should contains src folder and .abapgit.xml file

4. The steps below require you to create Github repository and assuming the Github repository is empty.

5.
Open CMD

6.
Navigate to the extracted folder mentioned in step 3.

7.
Enter this command in the folder, then Enter

git init

This message should appear:
Initialized empty Git repository in C:/Users/……………………….

8.
Enter this command in the folder, then Enter

git add .

Few warnings should appears.

9.
Enter this command in the folder, then Enter

git commit -m “first-commit”

You can replace the “first-commit” to whatever message you like

10.
Enter this command in the folder, then Enter

git branch -M main

11. Enter this command in the folder, then Enter. Replace the [ URL ] part with the URL of your Github Repository

git remote add origin [ URL ]

12.
Enter this command in the folder, then Enter

git push -u origin main

13. if you haven’t done this before using git in the local machine, there will be login prompt that requires you to login to the github account. Fill the username and password to your account. After that, there will be messages indicating that the object pushed (exported) successfully to the Github repository. You can open your Github repository to make sure the ABAP object succesfully exported.

Those are just few of git commands. You can learn more about other git commands from this site https://git-scm.com/docs/git.

I hope you can find this useful in any way.

--

--