abapGit: PREFIX Error on the SAP Cloud Platform ABAP Environment

“PREFIX: Unexpected package naming (…) you might switch to FULL folder logic”. This error occurred when I was trying to push a package with sub packages via abapGit from the SAP Cloud Platform ABAP Environment (SCP) to GitHub.

abapGit: Error on the SAP Cloud Platform ABAP Environment
abapGit: PREFIX Error on the SAP Cloud Platform ABAP Environment

abapGit: FOLDER_LOGIC = PREFIX

The issue results on the repository settings of the abapGit that are stored in the “.abapgit.xml“: [1]

<?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>/package.json</item>
    <item>/.travis.yml</item>
    <item>/.gitlab-ci.yml</item>
    <item>/abaplint.json</item>
    <item>/azure-pipelines.yml</item>
   </IGNORE>
  </DATA>
 </asx:values>
</asx:abap>

As you can see, “PREFIX” is used as folder logic, and that means a package name must contain its parent package name as prefix, [2] e.g.:

ZRAP
* Parent folder is ZRAP
    ZRAP_TRAVEL
* Parent folder is ZRAP_TRAVEL
        ZRAP_TRAVEL_API
* Folder structure: ZRAP/TRAVEL/API

Unfortunately, I did not know that when I attended the openSAP course “Building Apps with the ABAP RESTful Application Programming Model” where you will create several packages. [3] I used the following folder structure that is invalid with the abapGit folder logic “PREFIX” and leads to the PREFIX error:

ZRAP_####
* Error because of the wrong structure
    ZRAP_TRAVEL_####   " Right structure: ZRAP_####_Travel
    ZRAP_TRAVEL_U_#### " Right structure: ZRAP_####_Travel_U
    " etc.

abapGit: FOLDER_LOGIC = FULL

abapGit supports “FULL” as second folder logic but it is not possible to change this setting for a package/project on the Cloud Platform. Some tips in the internet recommend creating/changing the file “.abapgit.xml” on the GitHub repository (with folder logic = full). But it does not work because the file will be changed with every push (folder logic = prefix). [4]

After I spent a lot of time with searching and reading I assume the repo settings of the abapGit on the Cloud Platform are defined for the package “ZLOCAL” and are inherited to all sub packages.

If you know both folder logic options and the restriction of “PREFIX“, than it is simple to avoid such PREFIX errors by using package names that follow the prefix rules. Furthermore, this folder logic makes more sense because it is more intelligible.

Do you have an idea or a solution? Please, do not hesitate to leave a comment or write an e-mail so that I am able to update this blog post. Many thanks.

Further information
[1] abapGit Documentation
[2] abapGit Documentation: Folder Logic
[3] Building Apps with the ABAP RESTful Application Programming Model, GitHub Repository of the RAP Hands-on exercises
[4] abapGIT Error PREFIX: Unexpected package nameing … you might switch to FULL folder logic

Leave a Reply

%d bloggers like this: