
Fiori for ABAP - Git
The Git connection is an important component for securing the resources from the Fiori generation, as it allows for adjustments during later maintenance.
Table of contents
In this article, we'll look at connecting Git (HitHub, GitLab, or similar) to the Business Application Studio and how you can use it to back up your project.
Introduction
Last time, we made some initial adjustments to our Sales App. You'll have noticed that we now have changes that we're currently only storing locally and can't make available to any other developer. Therefore, in the next step, we should familiarize ourselves more closely with Git and version control. This is the standard tool for centrally storing resources and sharing them within the team.
Git
Git is a centralized, file-based version control system. This is the current standard for software development outside the SAP ecosystem. In the ABAP environment, all our versions and changes made to objects are stored locally on the system. Therefore, decentralized storage via Git is often not strictly necessary within the system. However, Git is already used when we work with open-source projects, as these are made available via abapGit. In this case, the various artifacts are also stored as files and made available in a Git repository. The Git repository follows a certain structure, depending on the project or programming language.
Synchronizing the Project
So, in this chapter, let's begin by backing up our existing project to a Git repository.
GitHub Project
Before we can actually start saving the project, we first need to create a Git repository. In this case, we'll use GitHub to store the data and create a new repository. First, we create an empty repository and do not perform any initialization; that is, we do not create a README file or a .gitignore file. At the end of this process, we have an empty Git repository, which we can then access via the URL (https://github.com/Xexer/fiori-global-sales.git). Whether you make the repository public or private is up to you. If no one else should have access to the data and the project, you should create it as private.
After creating the repository, we get the following overview. Here you can see that no data has been uploaded yet and therefore no branchüis available yet. In the lower, blue highlighted area you will find the repository URL. We will need these in the next step to continue saving in the Business Application Studio.
Change Directory
Since we will be performing manual initialization in the next step, we first need to change to the designated working directory. To do this, navigate to the path "File -> Open Folder..." via the hamburger menu at the top to select the project folder. After selection, our project should be visible at the top level of the Explorer bar. By default, Fiori projects are saved in the directory "/home/user/projects/" filed.
Hint: If your Fiori app is not in the top-level directory, Git will save all your files in the next step. This allows you to back up multiple Fiori apps, among other things.
Synchronization
Next, we'll switch to the Source Control Tool. In the sidebar, you will now find the "Initialize Repository" button, which we will click first.
The local repository will now be initially set up. In the overview, you will now find all changes or files that are linked to the repository. If, for example, you do not want a certain file to be available later in the public repository, you should include the file or the corresponding file path in the .gitignore file. This is especially useful if you are using local password files or other settings that should not be publicly visible.
In the next step, you enter an initial message in the message field to perform the first commit, for example, "Initial Commit", and then click the blue commit button. This saves an initial state in your version control system. Since you probably haven't manually added the files to the staging area before, the system will ask you if you want to commit all changes directly; confirm this with "Yes". The first commit to your local repository has been successfully completed. However, the changes are not yet on GitHub. Therefore, in the next step, we will connect the GitHub repository to this local repository. You can find the corresponding command under "Remote -> Add Remote" in the three-dot menu.
In the next step, you will add the GitHub repository. To do this, paste the link that you previously copied from GitHub. The system will then ask you for a name for the remote; by default, "origin" is often used. Next, you will be asked to authenticate. This is the standard procedure for GitHub. You will receive a verification code, log in to GitHub, confirm the code, and thereby authorize the link. Finally, you will be asked whether you want to permanently save your login credentials to a local file or use them only for the current session. We recommend the "Session" option. This is more secure and prevents problems if, for example, your authentication token expires. A fresh login for each session ensures that the connection to the repository is always stable and up-to-date.
As a final step, we click the blue "Publish Branch" button to perform the actual push to the remote repository. A security prompt will appear asking if we really want to perform the action, which we confirm with "Yes". The resources are now being transferred to our GitHub repository, thus securely saving the current development state.
.gitignore
If you take a closer look at the file structure in Explorer, you'll notice that the node_modules folder and the ui5-deploy.yaml file are grayed out and highlighted. This is because we've included these files in the .gitignore file, so they aren't automatically synchronized with the Git repository. The deployment configuration, for example, contains information about the target system that we don't want to publish there. The node_modules folder, on the other hand, is created automatically when the application is built, and the packages it contains are downloaded to ensure they are up to date. Therefore, it makes no sense to synchronize this folder, as the artifacts can change during the build process anyway, and these are automatically made available via the npm registry.
Manual
Working via the graphical interface is not ideal for every developer, as many prefer full control over individual Git commands. This approach is, of course, also available to you in the Business Application Studio. You can manually execute all Git commands via the integrated terminal to connect to the repository and perform the push. In this article, however, we have deliberately focused on the guided approach via the user interface to make getting started as easy as possible.
Git (On-Prem)
If you want to use on-premise Git, you must choose the Cloud Connector route. A direct connection is not possible because Business Application Studio is a cloud product that does not have direct access to your local network. Therefore, we have to work with a destination in the BTP subaccount. This destination points to the Cloud Connector, which in turn securely forwards the request to the internal Git system (e.g., GitLab). In the following example, we use an on-premises hosted GitLab instance. The following image shows the corresponding destination and the detailed technical configuration.
You can then work normally, as if it were a public address. However, you need to change the path so that the connection can be established via the destination. To do this, replace the main path (host) with the reference to the destination, ending with ".dest". This tells the system that it should use a configured destination and which specific connection is meant. To illustrate this, below is a small example of the original path and, for comparison, the modified path:
" Original path
https://gitlab.intranet.local/MyUserId/fiori-global-sales.git
" Adjusted path
https://gitlab.dest/MyUserId/fiori-global-sales.git
Complete Example
You can find the saved resources for our application in our GitHub repository. This will allow you to track all future customizations to the Fiori app or use the resources for deployment.
Conclusion
Working with Git is an important part of backing up the current configuration of a Fiori application. Without backing up the data and the corresponding customizations, subsequent developers will not be able to properly manage, maintain, or update the app.








