User Exits
abapGit contains predefined user exits which can be used to modify the standard behavior.
Overview
If the standalone version is installed, create include ZABAPGIT_USER_EXIT
and add local class ZCL_ABAPGIT_USER_EXIT
implementing ZIF_ABAPGIT_EXIT
.
If the development version is installed create global class ZCL_ABAPGIT_USER_EXIT
implementing ZIF_ABAPGIT_EXIT
.
To support both versions with the same code, proceed as follows:
- Implement
ZCL_ABAPGIT_USER_EXIT
as a global class and test with the developer version. - Copy & paste the complete code of
ZCL_ABAPGIT_USER_EXIT
into includeZABAPGIT_USER_EXIT
and change the beginning to a local class.
CLASS zcl_abapgit_user_exit DEFINITION
FINAL
CREATE PUBLIC.
- Activate the include.
In either case, add the object in a package different from the main abapGit code.
The list of user exits can change at any time, make sure to syntax check user exits after updating abapGit.
Exits
ADJUST_DISPLAY_COMMIT_URL
Can be used to set the URL to display a commit. There are default implementations for some providers:
Provider | Repo URL | Show Commit URL |
---|---|---|
github | http(s)://github.com/<user>/<repo>.git | http(s)://github.com/<user>/<repo>/commit/<sha1> |
bitbucket | http(s)://bitbucket.org/<user>/<repo>.git | http(s)://bitbucket.org/<user>/<repo>/commits/<sha1> |
gitlab | http(s)://gitlab.com/<user>/<repo>.git | http(s)://gitlab.com/<user>/<repo>/-/commit/<sha1> |
ADJUST_DISPLAY_FILENAME
This exit can be used to change the path and filename displayed in the repository view (see #5185). For example, you can implement a logic to shorten the path avoiding the output of repetitive details.
ALLOW_SAP_OBJECTS
Force allowing serialization of SAP objects.
CHANGE_LOCAL_HOST
If the hostnames are not properly configured, this exit can be used to modify the settings. This is especially useful when running abapGitServer on the local system.
CHANGE_MAX_PARALLEL_PROCESSES
Adjust the determined maximum number of parallel processes used in parallel serialization. Also see CHANGE_RFC_SERVER_GROUP.
CHANGE_PROXY_AUTHENTICATION
Determine based on the repository URL if authentication is required when accessing the proxy.
CHANGE_PROXY_PORT
Determine the proxy port from the repository URL.
CHANGE_PROXY_URL
Determine the proxy URL from the repository URL.
CHANGE_RFC_SERVER_GROUP
Adjust the RFC Server Group used for parallel serialization (default parallel_generators
). The group may be cleared to use parallelization without a server group. Then CHANGE_MAX_PARALLEL_PROCESSES needs to be implemented as well. Also see System Resources.
CHANGE_SUPPORTED_DATA_OBJECTS
Add or remove supported data objects. You can add single tables, for example, TABU, RSADMIN
, or a set of tables, for example TABU, T009*
.
CHANGE_SUPPORTED_OBJECT_TYPES
Add or remove supported object types
CHANGE_TADIR
Can be used to skip certain objects, or force a different object setup than currently in TADIR (Example).
CREATE_HTTP_CLIENT
Store username and password in RFC connection setup (see #1841).
CUSTOM_SERIALIZE_ABAP_CLIF
Allows for a custom serializer to be used for global classes' CLIF sources. See #2321 and #2491 for use cases. This example implementation forces the old class serializer to be used for specific packages.
As of #4953, the exit offers a post-processing option. First, the exit is called with the optional parameter it_source
set to initial. If you do not return any serialization (rt_source
is initial), then abapGit will serialize the object as usual and call the exit a second time. This time it_source
contains the complete source and can be modified in the exit as required. To use this option, use the following code at the beginning of the exit:
" Ignore the first call of exit
IF it_source IS INITIAL.
RETURN.
ENDIF.
DESERIALIZE_POSTPROCESS
Can be used for any postprocessing operation for deserialized objects. Since it is a postprocessing step, only logs can be added to ii_log
and one should not terminate the process by raising an exception, which may lead to inconsistencies.
DETERMINE_TRANSPORT_REQUEST
Set a transport request per repository. If set, no transport request popup appears and the transport is used for pull/delete (see #5916).
ENHANCE_REPO_TOOLBAR
With this exit, you can extend the toolbar with your own menu options. Currently, the exit is active for repository settings so you may define your own settings (see #6249).
GET_CI_TESTS
Add your own repositories to run a complete CI cycle (clone, pull, check, delete) when executing unit tests for object serializer classes (see #3993).
GET_SSL_ID
Possibility to change the default ANONYM
SSL ID to something system-specific.
HTTP_CLIENT
Can be used for setting logon tickets eg. in connection with abapGitServer connections between SAP systems (Example). Can be used to change HTTP protocol. E.g. to switch from HTTP/1 to HTTP/1.1 (Example).
ON_EVENT
This exit allows you to extend abapGit with new features that are not suitable for abapGit itself. For example, you can link to a new page from a wall message. Another use case is redirecting menu items to a custom page rather than standard abapGit, for example using a company-specific solution to replace "Advanced > Run Code Inspector" (see #4722).
PRE_CALCULATE_REPO_STATUS
Can be used to modify local and remote files before calculating diff status. Useful to remove diffs that are caused by deployment between different system versions (see also abapgit xml stripper plugin).
The exit also receives a repo metadata snapshot (zif_abapgit_persistence=>ty_repo
) to identify the repo and its attributes in the current system (e.g. package). This can be used to enable/disable the exit for specific repos.
SERIALIZE_POSTPROCESSING
This exit is called at the end of the serialize process and gives an opportunity to change the content of the serialized files (see #5194).
VALIDATE_BEFORE_PUSH
Perform custom validations just before pushing into remote while being on the "Commit Message" screen (see #6013).
WALL_MESSAGE_LIST
Can be used to add a message at the list level (repository list, see #4653).
WALL_MESSAGE_REPO
Can be used to add a message at the repo level (repository view, see #4653).