abapGit Tutorial: Version Control for ABAP Cloud and Classic ABAP

Category
DevOps
Published
Author
Johannes

abapGit is the most important open-source tool for version control of ABAP code. In this tutorial, you’ll learn how to install, configure, and effectively use abapGit for professional code management - both for classic ABAP and ABAP Cloud development.

What is abapGit?

abapGit is an open-source Git client for ABAP that is written entirely in ABAP. It enables you to store, version, and share ABAP code in Git repositories with other developers.

Why is abapGit so Important?

In the classic SAP world, version control has always been a pain point:

  • Transport system is good for deployments, but bad for collaborative development
  • Versions in the system are limited and not branchable
  • Code reviews were practically impossible
  • Backup and recovery were cumbersome

abapGit solves all these problems by transferring ABAP objects to standardized Git repositories:

Before (without abapGit)After (with abapGit)
Versions only in SAP systemComplete Git history
No branchingFeature branches, bugfix branches
Difficult code reviewsPull requests with diff view
Transport-based sharingClone and push like any other language
Vendor lock-inCode can be backed up on GitHub/GitLab

abapGit vs. gCTS

A common question: When do I use abapGit and when gCTS?

CriterionabapGitgCTS
Target audienceDevelopersIT Operations
FocusCode versioningTransport automation
Git integrationFull (Push/Pull)Export only
Open SourceYesNo (SAP product)
CostFreeSAP license required
CI/CD PipelineManually configurableNative SAP integration
RecommendationDevelopment & CollaborationEnterprise deployments

Summary: abapGit for developers, gCTS for enterprise CI/CD. Both can be combined.


Installation and Setup

Prerequisites

  • SAP NetWeaver 7.02 or higher (for classic ABAP)
  • ABAP Environment on SAP BTP (for ABAP Cloud)
  • GitHub, GitLab, Azure DevOps or other Git provider account
  • ADT (Eclipse) for ABAP Cloud or SE80/SE38 for classic ABAP

Installation on On-Premise Systems

Step 1: Download abapGit Report

The latest version can be found at github.com/abapGit/abapGit.

  1. Navigate to Releases
  2. Download the file zabapgit_standalone.prog.abap

Step 2: Create Report in SAP System

" Transaction SE38 or SE80
" Create new report: ZABAPGIT_STANDALONE
" Or: ZABAPGIT (if you want to install the full package)
  1. Open SE38 (ABAP Editor)
  2. Create a new report: ZABAPGIT_STANDALONE
  3. Copy the complete code from the downloaded file
  4. Activate the report

Step 3: First Execution

" Start the report
REPORT zabapgit_standalone.

On first start, you’ll be prompted to:

  • Install SSL certificates (for HTTPS connections)
  • Configure proxy settings (if applicable)

Installation in ABAP Cloud (SAP BTP)

In ABAP Cloud, the situation is different: abapGit cannot be installed directly, since there’s no access to SE38/SE80. Instead, there are two alternatives:

Option 1: abapGit for Eclipse (ADT Plugin)

  1. Open Eclipse with ADT
  2. Go to Help -> Install New Software
  3. Add the update site: https://eclipse.abapgit.org/updatesite/
  4. Install abapGit for ABAP Development Tools
  5. Restart Eclipse

Option 2: abapGit Repository Interface (from SAP BTP ABAP Environment 2302)

SAP provides a native repository interface:

  1. Open ADT
  2. Right-click on your ABAP Cloud project
  3. Configure -> Link ABAP Repository to Git

This integration is still under development but offers native SAP support.

Git Provider Configuration

For secure communication with GitHub/GitLab:

Terminal window
# Generate SSH key (on your local machine)
ssh-keygen -t ed25519 -C "[email protected]"
# Display public key
cat ~/.ssh/id_ed25519.pub

Add the public key to your Git provider under Settings -> SSH Keys.

Personal Access Token (Alternative)

For HTTPS access:

  1. GitHub: Settings -> Developer Settings -> Personal Access Tokens
  2. GitLab: Preferences -> Access Tokens
  3. Create token with repo permission
  4. Use token as password in abapGit

Basic Workflows

Clone Repository

The first step is cloning an existing repository into your SAP system.

In abapGit Standalone:

  1. Start ZABAPGIT_STANDALONE
  2. Click on + Clone
  3. Enter the repository URL: https://github.com/username/repo.git
  4. Select the target package (e.g., ZABAP_GIT_DEMO)
  5. Click Clone

In ADT (Eclipse):

  1. Open the view abapGit Repositories (Window -> Show View)
  2. Click on + (Link Repository)
  3. Select your ABAP project and enter the URL
  4. Select or create a package

Stage Changes

After editing ABAP objects, changes must be prepared for commit:

  1. Open abapGit
  2. Select your repository
  3. Click Stage
  4. You’ll see a list of all changed objects
  5. Select the objects you want to commit

Typical View:

Changes:
[x] ZCL_MY_CLASS (Modified)
[x] ZIF_MY_INTERFACE (Modified)
[ ] ZCL_TEST_CLASS (Modified) <- Don't commit
[x] ZABAP_PROGRAM (New)

Create Commit

A commit saves your changes in the Git history.

Best Practices for Commit Messages:

feat: Implemented new validation for customer number
- Check for valid customer number in ZCL_CUSTOMER_VALIDATION
- Added unit tests for edge cases
- Localized error message (DE/EN)
Refs: JIRA-1234

Conventions:

  • feat: New functionality
  • fix: Bug fix
  • refactor: Code refactoring without functional change
  • docs: Documentation
  • test: Tests added or corrected

Push to Remote

After the commit, changes must be pushed to the remote repository:

  1. Click Push
  2. Authenticate (SSH key or token)
  3. Confirm the push
Pushing to origin/main...
3 objects pushed successfully

Pull from Remote

To get changes from other developers:

  1. Click Pull
  2. abapGit compares remote and local versions
  3. For conflicts: Manual resolution required

Caution: Pull overwrites local objects! Save your changes first.


Integration with GitHub and GitLab

Set up GitHub Repository

Step 1: Create New Repository

Terminal window
# On github.com or via CLI
gh repo create my-abap-project --private

Step 2: Understand Repository Structure

abapGit creates a standardized folder structure:

my-abap-project/
├── src/
│ ├── zcl_my_class.clas.abap
│ ├── zcl_my_class.clas.locals_def.abap
│ ├── zcl_my_class.clas.locals_imp.abap
│ ├── zcl_my_class.clas.testclasses.abap
│ ├── zcl_my_class.clas.xml
│ ├── zif_my_interface.intf.abap
│ ├── zif_my_interface.intf.xml
│ └── zmy_program.prog.abap
├── .abapgit.xml
└── README.md

File Conventions:

  • .clas.abap - Class implementation
  • .clas.locals_def.abap - Local types/constants
  • .clas.locals_imp.abap - Local classes
  • .clas.testclasses.abap - ABAP Unit tests
  • .intf.abap - Interface definition
  • .prog.abap - Program/Report
  • .xml - Metadata (package, description, etc.)

GitLab Integration

GitLab works identically to GitHub. Important differences:

# GitLab Repository URL
https://gitlab.com/username/my-abap-project.git
# GitLab Personal Access Token
Preferences -> Access Tokens -> Scope: api, read_repository, write_repository

Azure DevOps Integration

For Microsoft environments:

# Azure DevOps Repository URL
https://dev.azure.com/organization/project/_git/repository
# Personal Access Token
User Settings -> Personal Access Tokens -> Scope: Code (Read & Write)

Code Snippets for Typical Scenarios

Scenario 1: Initialize New Project

" 1. Create a new package in SE80/ADT
" Package: ZABAP_GIT_DEMO
" Transport request: Local (for development)
" 2. Create initial objects
CLASS zcl_demo_application DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
ENDCLASS.
CLASS zcl_demo_application IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
out->write( 'Hello from abapGit managed project!' ).
ENDMETHOD.
ENDCLASS.
" 3. In abapGit: Link repository and make first commit

Scenario 2: Feature Branch Workflow

Terminal window
# On your local machine (after clone)
git checkout -b feature/new-validation
# Or directly in abapGit:
# 1. Repository -> Settings -> Default Branch
# 2. Manually switch branch before pull

In the SAP system:

  1. Pull the new branch
  2. Develop your feature
  3. Stage and commit
  4. Push to feature branch
  5. Create pull request on GitHub/GitLab

Scenario 3: Conflict Resolution

When two developers have changed the same class:

" File: zcl_shared_class.clas.abap
" <<<<<<< HEAD (your change)
METHOD calculate_total.
rv_result = iv_quantity * iv_price * ( 1 - iv_discount ).
ENDMETHOD.
" =======
" >>>>>>> origin/main (remote change)
METHOD calculate_total.
rv_result = iv_quantity * iv_price.
rv_result = rv_result - ( rv_result * iv_discount / 100 ).
ENDMETHOD.

Solution:

  1. Decide which version is correct (or combine both)
  2. Remove the conflict markers
  3. Test the change
  4. Commit and push

Scenario 4: Configure .abapgit.xml

The project configuration is stored in .abapgit.xml:

<?xml version="1.0" encoding="utf-8"?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DATA>
<MASTER_LANGUAGE>E</MASTER_LANGUAGE>
<STARTING_FOLDER>/src/</STARTING_FOLDER>
<FOLDER_LOGIC>PREFIX</FOLDER_LOGIC>
<IGNORE>
<item>/.gitignore</item>
<item>/LICENSE</item>
<item>/README.md</item>
<item>/.github/</item>
</IGNORE>
</DATA>
</asx:values>
</asx:abap>

Important Settings:

  • MASTER_LANGUAGE: D for German, E for English
  • FOLDER_LOGIC: PREFIX (recommended) or FULL
  • IGNORE: Files that are not imported into the SAP system

Best Practices for Team Work

1. Define Branching Strategy

Recommended Model for ABAP Projects:

main (or master)
├── develop
│ ├── feature/US-001-create-customer
│ ├── feature/US-002-material-search
│ └── bugfix/FIX-042-price-calculation
└── release/1.0.0

Rules:

  • main: Only stable, tested releases
  • develop: Integration of all features
  • feature/*: One branch per user story
  • bugfix/*: Quick bug fixes
  • release/*: Release candidates

2. Establish Pull Request Workflow

  1. Develop feature in own branch
  2. Create pull request on GitHub/GitLab
  3. Code review by at least one colleague
  4. CI/CD checks (syntax, ABAP unit tests)
  5. Merge after approval
  6. Delete branch after merge

3. Code Review Checklist for ABAP

## ABAP Code Review Checklist
### Functionality
- [ ] Does the code meet the requirements?
- [ ] Are edge cases handled?
### Code Quality
- [ ] Clean ABAP principles followed?
- [ ] Meaningful variable names?
- [ ] No magic numbers?
### Performance
- [ ] No SELECT * without restriction?
- [ ] Correct index usage?
- [ ] Bulk operations where possible?
### Tests
- [ ] Unit tests present?
- [ ] Sufficient test coverage?
### Documentation
- [ ] Public methods documented?
- [ ] Complex logic explained?

4. Follow Commit Conventions

Use Conventional Commits for consistent history:

<type>(<scope>): <subject>
<body>
<footer>

Examples:

feat(customer): Validation for international customer numbers
- Implemented ISO 3166-1 country code check
- VAT-ID validation for EU customers
- Unit tests for all country variants
Closes #42
fix(pricing): Division by zero with 0% discount
The price calculation broke when a discount of 0%
was specified. Now the case is handled correctly.
Fixes #57

5. .gitignore for ABAP Projects

Create a sensible .gitignore:

# OS-specific files
.DS_Store
Thumbs.db
# IDE files
.idea/
*.iml
# Local configuration
.local/
# Generated files
*.log

6. Documentation in Repository

README.md Template:

# Project: Customer Management Extension
## Overview
This repository contains custom extensions for the SD module.
## Installation
1. Clone the repository into package `ZCUSTOMER_EXT`
2. Activate all objects
3. Run the setup report `ZCUSTOMER_SETUP`
## Dependencies
- SAP S/4HANA 2023 or higher
- Package `ZABAP_UTILS` (see other repo)
## Development
1. Create feature branch
2. Implement changes
3. Add unit tests
4. Create pull request
## Contact
Maintainer: [email protected]

Troubleshooting

Problem: SSL Certificate Error

Error: SSL certificate problem: unable to get local issuer certificate

Solution:

  1. Open transaction STRUST
  2. SSL Client Standard -> Add certificate
  3. Import GitHub/GitLab root certificate

Problem: Proxy Connection Error

Error: Could not connect to proxy

Solution: In abapGit -> Settings -> Proxy:

Proxy Host: proxy.company.com
Proxy Port: 8080
Bypass: localhost,*.intranet.company.com

Problem: Object Cannot Be Deserialized

Error: Object ZCL_EXAMPLE could not be deserialized

Possible Causes:

  • Missing dependencies (other classes/interfaces)
  • Incompatible SAP version
  • Corrupt XML metadata

Solution:

  1. Import dependencies first
  2. Check and correct .xml file if necessary
  3. In emergency: Create object manually, then repeat pull

Problem: Push Rejected

Error: rejected - non-fast-forward

Solution:

Terminal window
# Locally: Fetch changes and rebase
git pull --rebase origin main
# In abapGit: First pull, then resolve conflicts, then push

Conclusion

abapGit revolutionizes ABAP development by bringing modern version control to the SAP world. The key takeaways:

  1. abapGit is essential for professional ABAP development
  2. Git workflows (branching, pull requests) work with ABAP too
  3. Team collaboration is massively improved through code reviews
  4. Backup and portability - your code belongs to you, not the SAP system

Next Steps:

  1. Install abapGit (standalone or ADT plugin)
  2. Clone or create first repository
  3. Establish feature branch workflow in team
  4. Introduce code reviews via pull requests

Further Reading