This is a test message to test the length of the message box.
Login
|

046: ABAP - ADT for VS Code (Part 2)

152

How do you get started with ABAP in Visual Studio Code (VS Code)? In this session, we'll give you an overview of using the extension. We'll focus on creating new ABAP code, debugging, and testing.

Advertising


In the last episode, we looked at the basics, why VS Code was created, and what the plugin can do for us. We discussed various points: what already works and what won't work yet, at least not in this initial version. In this episode, we'll therefore get practical and look at important aspects of using the editor.

 

Connect a System

To connect to a new system, we need to create a destination. To do this, we go to the Command Palette and search for "ABAP: New Destination" to create a new configuration in the editor. Currently, two login methods are available: via RFC, for example, to private clouds or on-premises systems, or via HTTP to connect to cloud systems. In the case of RFC configuration, the next step involves selecting the configured local systems that are provided via SAP Logon. Settings such as client, username, and language must then be configured to log on to the system. In this case, we want to connect to an ABAP environment, so we'll use the HTTP destination. The first step in the configuration requires providing the system URL. You can find this relatively easily: simply log on to the Fiori Launchpad once, copy the URL, and paste it here. Finally, we give the system a name. Here, we can use the system ID, for example, or we can specify a descriptive name that we will see again later. With that, we have completed the basic configuration of the destination and can now extend the workspace in the next step.

 

Workspace

In the workspace, we then work with the actual objects and systems. To get a system into the workspace in the first place, we have to add it. If we search for the command "ABAP add", we currently find three different versions and have various options for adding objects to the workspace. Using "Add Package as Folder", we can select a specific package from the system that we then want to include. Using "Add Destination" We can add a complete system; this will then be displayed split into local objects and software components. As a third option, we can add only the local data of a system, for example, if we want to experiment with it for testing purposes. However, this option doesn't work very well with the ABAP Environment, since we don't use $TMP here, but rather ZLOCAL as the local component.

Let's select the option to add a package. In the next step, we have to enter the destination we want to connect to. Here, we are asked to authenticate with the system first; we do this via the browser by clicking the first option in the dialog. After successful authentication, we can then search for packages in the system. Here, we use our demo AI package, which we then want to integrate into the workspace. Finally, we can choose the name for the virtual file system structure. In this case, it consists of the package name and the system name. We'll leave it as is for now and accept the changes to create our workspace, which we'll then use.

Before we can work with the workspace, however, we need to log in. We can tell we're logged in because there's an exclamation mark after the name, indicating that we're not yet logged in. To log in, simply right-click on the folder and select the first option, "Logon to Destination," to authenticate with the system and load the corresponding structure. The package is now open, and we see the first two parent packages present here.

 

Scaling

Since Visual Studio Code is a web component-based application, we can easily scale the UI without restarting the IDE or changing any system settings. Using the plus sign, we can activate the zoom and increase it by one level. You'll find a corresponding plus symbol at the bottom of the editor; there you can make further adjustments or reset to the default settings. We'll increase it one level here so that we can read the elements more easily for the video. In the past, we had the problem with Eclipse that while we could increase the size of the source code, the individual UI elements didn't change, which usually led to readability problems during presentations and demonstrations.

 

Objects

What's immediately noticeable when opening the package is that there's a JSON file containing the package configuration. These are objects that aren't present on the system but describe the actual packages, i.e., the files. When we open the package, we find the familiar structures, such as the Source Code Library, which we can further expand to access classes, interfaces, and other source code-based objects. Here, we'll open the Reader as an example and find several more files within it. Generally, we can't open the class directly from the top menu item; instead, we have to navigate to one of the files below. The first file describes the general class with the ABAP code. Here, we can scroll normally and view the ABAP code. If we then want to switch to the test class, for example, we have to open a separate file for the test classes. You'll also find the general properties in the corresponding JSON within this structure.

Where does this structure actually come from? Let's take a look at the Git project for ABAP File Formats. These define the actual structure of each individual object. It's an open-source project, driven by the community and SAP, to give each object a structure so it can later be stored in a file format. Let's examine the different file formats and look at the class. A class consists of various objects that describe the individual elements. Since a class primarily consists of includes and isn't contained in a single file, there are a correspondingly large number of files. For example, we see a configuration file that describes what's in the class, the source code file that defines the general part of the class, the various includes for the definitions, implementations, macros, and test classes, as well as further includes for the text elements present in a class. If a sufficient number of languages are involved, a corresponding number of includes are possible. In the back section, you'll also find various examples and can see how such a file is structured and what it looks like.

 

Create an object

Let's now create a new object in the system. To do this, we go to the Command Palette again and search for "ABAP: Create New ABAP Object". In the next step, we can choose from the available file types. Here we see the currently bound types in VS Code and can get an overview. We want to create a new class, so we land in the corresponding wizard. We see in the upper section that we currently have to go through five steps to define a new class. In the first step, we define the package in which we want to create the class, and in the second step, we assign a name to the actual class. In step 3, we provide a description. Steps 4 and 5 can be confirmed simply by pressing Enter; these concern the superclass and the interface that we can include. Afterward, the creation of the new class begins, and we receive an empty class body that we can work with.

As the next step, we want to define the interface for the executable class. To do this, we simply need to implement the interfaces and then search for "IF_OO" after the first statement. Then, we can start autocomplete with CTRL + Space. Here, we see both interfaces from the system and can choose our interface. However, the option to create the implementation for the method is still missing. This means we have to do the actual implementation manually. The convenient feature we also have in Eclipse is still missing. After that, we'll print something directly to the console to generate some initial output. You can find "Format Document" via the context menu or the corresponding shortcut. This allows us to start the Pretty Printer for the document and format it. The ABAP Cleaner isn't currently available, but it's planned for VS Code as well, which would greatly simplify document formatting and provide the standard functionality from the new world. In the next step, we need to activate the object. You'll find a button above the editor to activate the individual object. If you want to activate all inactive objects, you'll find an "Activate All" option below the editor. This opens a pop-up window where you can select which objects you want to activate. A normal activation process then runs in the system; the class has been created. To run the class, you can select the appropriate option from the object's context menu or press F5 to start the class and generate output in the console. With that, we've created, activated, and executed a new class.

 

Debugging

Let's take a look at debugging in the new editor. As always, you can set a breakpoint on the corresponding line; this line will be highlighted, and we can then see the active breakpoint. Next, we run the application again with F5 and land directly in the debugging view. Here we find the basic debugging tools. This describes the editor, which is located in the middle section. On the left, you'll find the variable view, various watchpoints, and the system call stack. In the lower section, you'll find active breakpoints in the source code. A nice feature: the breakpoint is highlighted again in the lower section when we're in debugging mode, with a red line. We also switch tools: On the left, you can see that we've switched to the "Run and Debug" area, which is quite similar to Perspectives in Eclipse. Through variables, we have access to the various local variables or can add new variables. We can open these and view their contents using the standard tools. This doesn't quite match the content we see in Eclipse, but is purely standard VS Code.

At the top, you'll find a small palette for the different steps we can take in debugging. This looks similar to the debugging tools in the Chrome browser. You can move these freely; they offer various options for navigating through the source code, skipping a step, or jumping to other relevant points. These options correspond to the same options as in the Eclipse debugger. Basically, you need to understand that the keyboard shortcuts here are completely different from those you'll find in Eclipse. Pressing F5 runs the debugger and exits object debugging. Generally speaking, only the standard tools have been implemented so far, and further tools, such as a more detailed variable view or better debugging functionalities and insights, will be added later. Basically, this is perfectly sufficient for standard debugging and first steps.

 

ABAP Unit

In the next step, we will look at working with unit tests and how we can execute them and view the results via the coverage. For this, we switch to the RSS reader. This is an implementation that we created using Agentic AI to read and process our RSS feed. As a first step, we switch to the include for the test class to see that there is a unit test. Then we can go to "ABAP: Run" in the Command Palette. Search and find various options for running unit tests, including the ABAP Test Cockpit within the system. Instead of a simple unit test, this time we'll create a unit test with coverage to examine the visualization within the editor. The test is visualized in the editor's UI, as seen at the bottom. Next, we switch to the testing tool and see the executed test class. We can see that the corresponding method was executed and passed successfully. Below this, you'll find the corresponding runtimes, just as you're used to in Eclipse.

Below that, you'll also find a display of the test coverage, which is approximately 87%. To examine the class itself, we need to switch back to the Explorer and this time view the implementation. Here you'll find formatting and highlighting on the line numbers, and you can hover your mouse over the line. A nice difference compared to the Eclipse implementation is that here you can also see, for example, how often the individual sections were called. This means that our unit tests show which sections were tested particularly intensively and which weren't executed at all.

 

Navigation

What does it look like for you if, for example, we don't have a sidebar for an object, or if we want to quickly switch between different objects? To show this, let's reopen our initial class that we created. In the upper area above the text editor, you'll find the so-called breadcrumb menu. Everything is listed here, from the workspace and the various packages to the actual object we are currently working in. If we click on the element we are currently viewing under the object, we can, for example, switch to the test class within the text editor or to the other includes and artifacts belonging to that class.

Alternatively, we can also use the paths that exist at higher levels. For example, if we click on the class, we can see all the classes currently at the same level, such as our database reader and the RSS reader as additional classes. If we open the RSS reader, we then see all the includes or files it contains and can also switch directly to the object within the corresponding include. The same applies to the options we find further up. This allows us to navigate down to the package level and then select objects within those packages to open them in our editor. This means a second form of navigation is via the breadcrumb menu at the top, which can speed up searching and selection.

 

Outlook

In this episode, we looked at practical work with Visual Studio Code, from integrating a system to creating objects and working in the debugger, as well as unit testing. Basically, the tool offers all the basic components we need to work with source code and the system, but it still needs further improvement in the future. In the next episode, we'll look at Agentic AI, how to set it up in Visual Studio Code, and then explore various examples of how AI can already actively support us today. Thanks for watching, and see you next time!

 

YouTube
Video


Included topics:
YouTubeSkriptADTVS CodeHands-On
Comments (0)



And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Tuesday and Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.


048: ABAP - ADT for VS Code (Part 4)

Category - YouTube

How do you get started with ABAP in Visual Studio Code? In this episode, we'll look at some examples in the Agentic AI and RAP environments. We'll also look at some points to keep in mind, when working with Agentic AI.

07/20/2026

047: ABAP - ADT for VS Code (Part 3)

Category - YouTube

How do you get started with ABAP in Visual Studio Code? In this episode, we configure Agentic UI and look at various examples of its use in the areas of ABAP Unit and RAP.

07/13/2026

045: ABAP - ADT for VS Code (Part 1)

Category - YouTube

How do you get started with ABAP in Visual Studio Code? In this episode, we'll give you an overview of the extension's architecture and structure, and what you can expect from it so far.

06/29/2026

043: Modern, solid and testable ABAP Code (Part 4)

Category - YouTube

The digital version of the betterCode presentation on modern and testable ABAP code. We'll look at software architecture and give tips for using ABAP Units.

05/25/2026

042: Modern, solid and testable ABAP Code (Part 3)

Category - YouTube

The digital version of the betterCode presentation on modern and testable ABAP code. We'll look at software architecture and give tips for using ABAP Units.

05/18/2026