This project implements a Emacs plugin which allows to access development artifacts like reports, classes, interfaces etc. of a ABAP system. It uses the ABAP Development Tools (ADT) HTTP protocol to access the ABAP workbench functionality. Currently, the package provides the following:
- Retrieve (Pull) source from ABAP server
- Offline edit
To haveABAP Mode
available, a major mode for editing/viewing development files in Emacs, install sap-abap-mode (see description below). - Server side formating & auto-complete
- Server side syntax check
- Submit (push) source to ABAP server
- Activate source at ABAP server
- Run source
The current version can only be installed manually. Clone this repository with the --recursive
option, i.e.
$ git clone --recursive https://github.com/marianpiatkowski/ABAPInEmacs.git
to get additional packages like sap-abap-mode as well.
Add ABAPInEmacs
directory to your load-path
(add-to-list 'load-path "path/to/ABAPInEmacs")
;; sap-abap-mode includes
(require 'abap-mode)
(add-to-list 'auto-mode-alist '("\\.abap\\'" . abap-mode))
;; ABAP CDS Mode
(require 'abap-cds-mode)
(add-to-list 'auto-mode-alist '("\\.cds\\'" . abap-cds-mode))
(require 'abap-ddic-mode)
(add-to-list 'auto-mode-alist '("\\.tabl\\'" . abap-ddic-mode))
;; ADT files as well
(add-to-list 'auto-mode-alist '("\\.\\(asprog\\|asinc\\|aclass\\)\\'" . abap-mode))
(add-to-list 'auto-mode-alist '("\\.asddls\\'" . abap-cds-mode))
(add-to-list 'auto-mode-alist '("\\.astabldt\\'" . abap-ddic-mode))
;; ABAPInEmacs includes
(require 'abap)
(require 'abap-flycheck)
Specify your workspace directory by setting the variable abap-workspace-dir
.
(setq abap-workspace-dir "path/to/ABAPWorkspace")
With the configuration above
ABAP Mode
will be loaded automatically once a file with suffix.abap
has been openedABAP CDS Mode
will be loaded automatically once a file with suffix.cds
has been openedABAP DDIC Mode
will be loaded automatically once a file with suffix.tabl
has been opened.
Steps to set up a ABAP project:
- Create a project with
M-x abap-create-project
.
If you already have a project, it can be added withM-x abap-add-project
.
Remove an existing project withM-x abap-remove-project
. This will not physically remove the project files.
At any time, you can open or switch to an existing project withM-x abap-open-project
. - Add a ABAP server to project with
M-x abap-add-server
.
The following steps are an essential part of the workflow:
M-x abap-login
- Logon to ABAP server
By default, the encoded credential will be persisted so that a login on each action is not required.M-x abap-search-object
- Search ABAP development object
The source code of the selected search result is then pulled from the ABAP server and a directory buffer opens up showing the corresponding files.
Once a ABAP development object has been successfully fetched by Step 2, the following steps can be
done when working on .abap
-files:
-
M-x abap-retrieve-source
- Get content of ABAP development object associated to current buffer from server -
M-x abap-check-source-uptodate
- Check whether source in current buffer is up to date with server -
M-x abap-syntax-check
- Perform syntax check of object in current buffer
If errors and/or warnings occur, they are displayed in the *ABAP Log* buffer.Furthermore, on-the-fly syntax checking of the source code can be enabled with the Flycheck extension for ABAP. Call
M-x flycheck-abap-setup
for setting this up. Documentation of the Flycheck extension can be found at the following link. -
M-x abap-format-source
- Do source code formatting of object (pretty print) -
M-x abap-submit-source
- Submit local content in current buffer to ABAP server
Unless the object is local on the server side, a transport request has to be chosen for the current version of the source code. -
M-x abap-activate-source
- Activate (compile) object in current buffer on the server -
M-x abap-code-completion
- Request proposals for code completion from ABAP server -
M-x abap-navigate-code
- Navigate to object under cursor in current buffer, i.e. find definition/implementation of the object -
M-x abap-execute-object
- Execute source code of current buffer and display in external window.M-x abap-console-run
- Execute source code of current buffer and display in *ABAP Console* buffer.
You can also create a Git repository with the retrieved source code and collaborate with other colleagues.
Function | Description |
---|---|
M-x abap-create-project | Create new ABAP project |
M-x abap-add-project | Add ABAP project to workspace |
M-x abap-remove-project | Remove ABAP project from workspace |
M-x abap-open-project | Open ABAP project |
M-x abap-add-server | Add server to current project |
M-x abap-login | Logon to ABAP server |
M-x abap-search-object | Search and retrieve ABAP development object |
M-x abap-retrieve-source | Retrieve source of ABAP development object |
M-x abap-check-source-uptodate | Check whether local source is up to date |
M-x abap-retrieve-object-etag | Retrieve ETag of ABAP development object |
M-x abap-retrieve-source-etag | Retrieve ETag of source |
M-x abap-check-object-version | Compare local version of development object with server |
M-x abap-check-source-version | Compare local version of source with server |
M-x abap-syntax-check | Syntax check of source |
M-x abap-force-submit-source | Submit local source to server |
M-x abap-submit-source | Submit local source to server |
M-x abap-activate-source | Activate ABAP development object |
M-x abap-format-source | Format source - pretty print |
M-x abap-code-completion | Request code completion proposals |
M-x abap-navigate-code | Navigate to object under cursor |
M-x abap-execute-object | Launch program/application in GUI |
M-x abap-console-run | Launch program/application in console |
M-x abap-where-used | Get Where-Used list of object under cursor |
M-x abap-outline | Get object structure of ABAP development object |
M-x abap-location-stack-reset | Clear location stack |
M-x abap-location-stack-push | Push position under cursor to location stack |
M-x abap-location-stack-pop | Pop element from location stack |
M-x abap-location-stack-forward | Move up in location stack |
M-x abap-location-stack-back | Move down in location stack |
M-x abap-location-stack-jump | Move up/down in location stack |
M-x abap-location-stack-visulize | Print current location stack |
M-x abap-code-search | Perform code search |
M-x abap-unit-execute-object | Execute unit tests of ABAP development object |
M-x flycheck-abap-setup | Set up flycheck ABAP |