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

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

64

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.

Advertising


In the last episode, we set up Agentic AI in our system and performed an initial test run with class generation. In this episode, we'll look at further examples and conclude with some tips on what to consider when working with Agentic AI in your system. Finally, we'll wrap up the session and give a brief summary of the entire topic and how to proceed with VS Code.

 

Unit Test

For the next example, we'll switch classes and look at the database reader. This is a small class that provides two methods for reading data. In the first case, we'll read the business partners and five rows from them. In the second example, we read a language configuration here via the key that we pass into the method. To do this, we switch to the test class and tell the LLM that we want to create a test class and test all methods within it. As before, the agent now looks at what we actually want it to do, reads the actual objects and their types, and then starts to consider the next steps.

The agent then starts working and decides to use the SQL double, which is perfectly correct in this case. It then generates some initial test code, which looks fine so far. However, we also see that there is already an error message, and the error message indicates that the method name is too long and needs to be shortened. Based on the error message and the inability to activate, the LLM immediately recognizes the error and begins correcting the code. As always, we confirm all changes made by the Large Language Model. This is our last chance to review the changes. Next, the LLM still finds an error in the data. It sees that it cannot properly set an identification. Here, the model assumed that when working with a Language object or a Language table, we would also pass the corresponding Language keys. Now the model tries to read the Core Data Service and find out what the problem is. However, the model will not find a solution because the Core Data Service is not within the scope of the currently included packages. This means it cannot obtain any information about how the language is structured.

Since we now see that the model is going in circles, we provide further information so that the agent can now fully complete the test. We specify that the Identification is of type UUID and is a Raw-16 field, so that it knows it needs to generate UUIDs here to properly populate the key. The model responds to our comment and adds a method to generate the key fields. Once the changes are implemented, we see that the class can be reactivated. However, when running the unit tests, the model also notices that the types used are incorrect, because the SQL Double requires the database types and not the types defined in the class. Here, for simplicity and ease of use, we have specified local types; however, the original database type must be specified for the unit test. The agent then replaces this type and activates the class. It then executes all unit tests. These now pass, and we receive a result. The agent's run is complete.

 

RAP Generator

In the next example, we want to generate a RAP object. This time, we use a predefined prompt, which we simply insert. We specify that we want to create a RAP application, in which package we want to create it, and which prefix we are using. Basically, the classic RAP generator is used "from scratch" in the background to create the object. That's why the prefix is important. We provide information that we want a RAP entity containing information for documentation and including fields like title, description, long text, creator, and review. Finally, we provide further information that we want to hide the UUID and administrative fields in the UI. Normally, the RAP generator generates this information automatically, resulting in an overloaded UI with a lot of information that we actually want to hide from our end user.

The agent begins working in the system and first queries which system we are working on. Next, it wants a list of the RAP generators on the system. We allow it to do this; that is, it first retrieves a list of possible RAP generators. Then, it needs to know which schema the RAP generator requires to function. The Large Language Model then builds the corresponding schema, defines the initial fields, and passes the schema to the RAP generator to create the objects. In this case, the Large Language Model no longer handles the object generation; instead, the RAP generator is solely responsible for the generation. This is semantically correct and therefore consumes fewer tokens than if our agent were to create each object individually and manually. This is fundamentally an interesting idea for optimizing processes in the context of agents. The object generation process then takes a few minutes before the objects are consistently created in the system.

Once the RAP generator is finished, the objects are created in the system, and we can, for example, take a look at the service. At the same time, the agent continues working in the background to hide the UI fields and the admin fields in the UI. To do this, we navigate to the Metadata Extension next to the service, where we expect changes to be made. After the changes have been made, we can already see that "hidden" has been set to "true". If we scroll down, we also find the other administrative fields, which are now also hidden. Therefore, they should no longer be actively displayed in the interface. Finally, we go to the Service Binding and click on the inline action for Publish to initiate the publishing process of the service. Unlike Eclipse, there's no dedicated button here. Instead, certain actions are displayed inline to initiate the publishing process. At the bottom, you'll find information indicating that the process is currently running.

Once the service activation is complete, we find the Preview button directly above the service definition and can start the preview of our Fiori Elements application. VS Code then asks us which entity we want to start; the Leading Entity is already suggested. Accordingly, we now see our application in the UI. We only find the relevant fields, which we can then populate. Let's first create a new record and enter some basic information. Here, we notice that the model has defined a very short key for the title with only 10 characters. In principle, creating new data records and visualizing them in the UI works.

 

RAP Validation

However, it's also noticeable that we can create empty data records, which isn't very practical. Therefore, we want to extend the object again via the agent and include a validation that checks that certain mandatory information is populated. To do this, we switch back to our editor and go back into the chat with the agent. We open the behavior definition, thus giving the Large Language Model some context. Next, we populate our prompt and specify that we want the title, description, and creator to be defined as "mandatory." Additionally, it should create a validation that checks whether these fields are actually populated. While we could theoretically set fields to "mandatory," we still have to perform the check manually each time, as the framework only reacts to these flags in the UI.

The agent then begins analyzing the current behavior definition and starts making initial changes. It inserts the fields that were then defined as "mandatory," as well as a validation that is also inserted. We also see that there are still some initial errors, as the fields were also marked with an update flag. The LLM detects this and then changes the field definition to "mandatory," removing the status in the process. In the next step, the validation implementation begins, which is also included in the Prepare Action, so that validation also takes place during the draft. If we then navigate to the implementation, we see that it has been created. Corresponding EML statements have been executed. The data is looped, and each field is checked to see if the content is correctly populated. Messages are then generated so that the user receives error messages in the UI if they try to create an empty instance.

Finally, let's switch back to the UI. We see that the fields are now defined as mandatory, and we try to create an empty record. We receive three error messages; these error messages were generated by the agent. This also ensures validation that we are not creating empty records, but only information that we can then process further.

 

Caution

However, we would like to address a few points again when it comes to working with agents within a customer's actual production or development system. It must always be emphasized that SAP resources are centralized; once they are saved and activated, they reside in the system and are therefore active for every other user. As a general rule, we should check AI-generated code before deploying it to test and production environments. This means that a review process should be carried out by the developer or a second developer.

When dealing with version history, please note: If an object is newly generated, there is no version history. If an existing object has been modified, there is most likely a version history, but only to the state at the time of the export. This means that restoring the version is either not possible at all or only partially possible.

If you are working with existing objects, you should use "Explain" and "Ask". You can fall back on this mode, or at least you should make a backup beforehand using a Git repository so that you can then work with the data and have a way to revert to the original state if you don't like the results or the agent has stopped making the correct changes.

Working with agents is especially useful when you're creating new developments, i.e., starting from scratch, migrating things (perhaps to a new environment), creating unit tests in an empty class, or, for example, running mock-ups that you want to discuss with your department. Here it's definitely worth working with AI, as you'll save a lot of time and it doesn't have to be 100% correct yet.

 

Summary

Let's summarize the different sessions again. The first version of the MCP server for the ABAP Development Tools is now available and can therefore be used in Eclipse and VS Code. There are still some minor bugs in Eclipse when the server loads, resulting in error messages. However, the MCP server is generally the first port of call when it comes to a good context for LLM (Large Load Management) or when it provides feedback in agent mode to clean up errors that have occurred in the source code. Looking at the features of VS Code, it's still in its early stages for the environment. This means that, in principle, it's already very well suited for cloud development, especially when used with Fiori as a full-stack tool. However, it still lacks support for the numerous objects available in Eclipse, as well as support for various tools like the debugger, data preview, and other tools that developers need on a daily basis. Regarding AI, we can finally work with agents and have various ways to interact with the system using tools and the MCP server. Current use cases primarily involve its use in the RAP context and the development of classes to leverage the advantages of an agent and achieve speed in extension and development. Basically, the next releases will show what other features are available and how we can further extend our agent with skills in the future, enabling migrations from old coding to the new environment.

VS Code is still in an early stage, meaning there are still bugs and it's not as polished as Eclipse, but you can already make initial code changes with it. You'll also need an Eclipse installation to have the latest tools readily available. However, as recent releases have shown, SAP is very quick when it comes to patching and delivering initial features, so that the ABAP Cleaner, for example, is now available, and objects such as function groups, reports, and classic tables can also be edited. This gives you a first chance to use the editor to edit objects and work agent-based. Thank you for watching, and see you next time.

 

YouTube
Video


Included topics:
YouTubeScriptADTVS 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.


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

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

Category - YouTube

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.

07/06/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