ABAP Development with VS Code

ABAP Development with VS Code
VS Code logo

As a developer who entered SAP from the world of web, I am relatively unforgiving with the quality of the tools available to ABAP developers. However progress is being made. The ABAP Development Tools (ADT) which make developing ABAP in Eclipse possible, also enables other code editors and IDEs for ABAP, like VS Code.

When I started learning ABAP I found myself getting increasingly frustrated with the speed at which the SAP GUI for Java responded and I looked for other options, this led to getting started with VS Code for ABAP.

Note: If you are not running Netweaver v7.51+ you will have to install a patch that can be found as part of the first plugin install options.

Getting the right plugins

VS Code is required for this tutorial along with the following plugins:

Once you have installed these plugins we can begin configuring your SAP System as a Remote FileSystem.

Note: In this blog I will only cover the configuration of the ABAP Remote FileSystem plugin. For further information on configuring the other plugins listed, please review the VS Code Marketplace/GitHub repositories.

Configuring your SAP system

In order to connect to your SAP system you will need to enable the ABAP Development Tools (ADT) ICF node, this is the same service that tools such as the SAP Hana Studio use.

Open your SAP GUI and connect to the target system, run the transaction SICF and then activate the ADT_SRV service as shown below.

Screenshot of SAP GUI: activating ADT in transaction SICF

This enables the service that allows code editors and IDEs to connect to your SAP system.

Configuring VS Code

Configuring this plugin to connect to your SAP system is straightforward, just open up your VS Code settings by pressing "Control/Command + ," select "Extensions" in the menu and then in the "ABAP-FS" plugin, click on "Edit in settings.json".

VS Code Preferences panel

Then you need to update the below block of json to include your SAP system and user details. You can find the URL details by right-clicking the node in SICF on the SAP System (like when we turned the service on, earlier) and selecting "Test Service".

Testing ADT Service from SAP GUI

This will open the ADT service and you can copy the top-level domain and port number from there.

"abapfs.remote": {
  "My SAP System label": {
    "url": "https://my-sap-system:8012/",
    "username": "my-username",
    "password": "my-password",
    "client": "920",
    "language": "EN",
    "allowSelfSigned": true
  }
}

Note: The usual rules apply... if you're on an SAP system that's only accessible on a specific network then you'll still need to be on that network to connect!

This will create a system profile for you to connect to in VS Code, once you've saved your settings press F1 (the shortcut to launch a command) and start typing "ABAP" and you should see the "ABAPfs Connect to an ABAP system" command appear, click on this. Then select the profile you just set-up and you will connect to your system.

SAP System in VS Code as a workspace

Writing ABAP in VS Code

Now that you're connected to your SAP system, you can start creating your own reports, classes and structures in VS Code. To get started, make sure that you already have a transport open for your user, you cannot create transports from VS Code.

Transport Management

You can view transports assigned to you (or a colleague) by opening the SAP plugin in the sidebar as pictured below:

List of transports assigned to a colleague, shown in VS Code

Creating an ABAP Object

To create an ABAP object in VS Code, you simply right-click somewhere in your workspace and select "ABAPfs Create object".

Creating an ABAP object in VS Code

You will then have to select one of the supported object types, these include Core Data Services (CDS) objects. Once you have selected the type of object you are creating, you must write a name and description for the object and then assign it to a package and transport.

List of supported ABAP object types

Activating changes to an object

When you edit an ABAP object in VS Code, you don't need to bounce back into the SAP GUI to activate your changes. You can do this in VS Code by clicking on the "activate" wand in the top right corner of your object editor.

Activate changes to an ABAP object in VS Code

The breadcrumbs along the top of your editor full support navigation to related objects just like any other language.

Using VS Code for ABAP day-to-day

As easy as these plugins for VS Code have made writing ABAP without the usual rigmarole of the SAP GUI, I don't think that it's mature enough to use for everything in your day job.

The key issues I have come across are object locking over the ADT, which can be a little volatile and the fact that there's no SAP GUI integration like with Eclipse. I think that if these two issues are resolved I wouldn't open the SAP GUI from outside of VS Code ever again!

Leave a comment

Let me know how you're getting on with writing ABAP in VS Code, or if you got stuck somewhere along the way by leaving a comment.