
Today I would like to showcase how you can leverage the capabilities of AI assisted Coding in ABAP.
Disclaimer: Parts of the text in this Blog post are "enhanced" by AI. This is just for the sake of better readability.
Artificial Intelligence is becoming an indispensable tool for developers. For ABAP developers, the combination of Visual Studio Code (VS Code), Cline, and AI-powered coding assistance can significantly enhance productivity and code quality. In this blog post, we’ll explore how to set up and use AI-assisted coding for ABAP development using VS Code and Cline. We’ll also discuss how to connect Cline to an AI model like DeepSeek R1 and how to integrate VS Code with SAP systems.
Visual Studio Code (VS Code) is a free, open-source code editor developed by Microsoft. It’s lightweight, highly customizable, and supports a wide range of programming languages through extensions. VS Code is a popular choice for developers due to its robust features, including IntelliSense (code completion), debugging tools, and Git integration.
Visit the official VS Code website.
Download the installer for your operating system (Windows, macOS, or Linux).
Run the installer and follow the on-screen instructions.
Once installed, launch VS Code and explore its interface.
Cline is a VS Code extension that integrates AI-powered coding assistance into your development workflow. It leverages large language models (LLMs) to provide intelligent code suggestions, auto-completion, and even code generation. Cline supports multiple language models, thus supporting multiple programming languages, including ABAP, making it a valuable tool for SAP developers.
Open VS Code.
Go to the Extensions Marketplace by clicking on the Extensions icon in the Activity Bar on the side of the window or pressing Ctrl+Shift+X.
Search for Cline in the marketplace.
Click Install to add the extension to your VS Code environment.
Once installed, Cline will appear in your list of extensions.
To use Cline effectively, you need to connect it to an AI model. In this example, we’ll use the DeepSeek R1 API, a powerful language model designed for code generation and analysis.
Visit the DeepSeek API website and sign up for an account.
Navigate to the API Platform and generate an API key.
Copy the API key to your clipboard.
Open VS Code and open Cline from the Extension Bar.
The API Selection should open automatically on the first start, if not, you'll find it in the Cline Settings.
Select "DeepSeek" as API Provider.
Locate the API Key field and paste your DeepSeek R1 API key.
Save the settings.
Re-Start VS Code, open the Cline Extension and give it a prompt in the chat field:
If everything is set up right, Cline will go ahead and create the application: Enjoy the show.
Once Cline is finished, it will notify you and you can start the application:
If you prefer to run the AI model locally for better performance or privacy, you can use Ollama, a tool that allows you to run large language models on your local machine.
Download and install Ollama from its official website.
Follow the installation instructions for your operating system.
Quickstart the ollama server using the model of your preference.
Running models locally is hardware-intensive and requires some fiddling around: It depends on which model you use, how much Memory you have, how much Memory the Model can handle, etc.
For example, run this in a powershell to start the ishumilin/deepseek-r1-coder-tools:14b model:
ollama run ishumilin/deepseek-r1-coder-tools:14b
Ollama will then download the model and run it. After the download is completed, and you tested the model, you can potentially exit the powershell - but we will do some fine-tuning now. First, stop the model again:
ollama stop ishumilin/deepseek-r1-coder-tools:14b
Now, run those commands one after another in the terminal:
set OLLAMA_FLASH_ATTENTION=1
ollama run ollama run ishumilin/deepseek-r1-coder-tools:14b --keepalive 4h
/set parameter num_ctx 131872
/bye
ollama ps
Additionally, In cline, open Cline Settings, open Advanced Settings, set "MCP Mode" to "server-only" or "off" depending on wether you want to use MCP-servers. Only set it to full if you want to create MCP servers using Cline. This reduces your prompt size and frees up some context.
Now, configure Cline to use the local Ollama instance instead of the DeepSeek R1 API:
In Cline, open the model selection by clicking "deepseek:deepseek-chat" below the input field:
Here you specify the local endpoint for Ollama by selecting API Provider "ollama" and the respective model (This screenshot shows deepseek-r1:1.5b, but imagine it would say ishumilin/deepseek-r1-coder-tools:14b)
Finally, you can test the local ollama model from Cline :
To develop ABAP code, you need to connect VS Code to your SAP system. There are two primary ways to achieve this:
The ABAP Development Tools (ADT) provide a set of endpoints for interacting with SAP systems. You can use an MCP (Model Context Protocol) Server to connect VS Code to these endpoints.
Ask Cline to set up an MCP server that connects to your SAP system using ADT endpoints. (This will be quite some effort, but it is possible!), or
use this MCP server (Work in Progress!) - and feel free to contribute.
Manual Installation Instructions are on Github - You can do a quick installation via
npx -y @smithery/cli@latest install @Mario-andreschak/mcp-abap-adt --client cline
Make sure to create a .env file to store your SAP-Credentials, as described on Github!
Otherwise, the Server can not establish a connection!
The MCP server should appear in the list:
Cline will use the tools/functions provided by your MCP server if you ask it to:
And here it gets the response from the SAP System:
The mcp-abap-adt mcp server is work in progress and currently only supports retrieving program source, class source, function group source, function module source, listing table structures and searching objects. It can theoratically read DB table contents, but that does not come out-of-the box, but requires an Service Provider for RFC_READ_TABLE.
While MCP-ABAP-ADT does not include complex operations, and can only READ source code (This is a design decision), It does however provide a starting point for your MCP development journey.
If you're looking for a more complex MCP server, check mcp-abap-abap-adt-api
If you're encountering issues with the connection, make sure to activate the HTTP-Endpoints in SICF, as described in the Article "Activating an HTTP End Point for Accessing ADT Resources"
The ABAPfs extension allows you to mount an ABAP system as a virtual file system in VS Code.
Install the ABAPfs extension from the VS Code Marketplace.
You can install it directly from VS Code by opening the Extensions View (File->Preferences->Extensions)
Configure the extension with your SAP system details (host, client, username, and password).
Once connected, you can browse and edit ABAP objects directly in VS Code.
Cline will be able to assist you with editing existing objects your Workspace.
You can not yet "create" new objects with Cline and ABAPfs, but I am working on a fork to make this possible.
Remember: AI-Development is about prompt design! Cline offers a "Custom Instructions" Field in the settings. Feed that with some SAP related instructions that you want to pass to the model everytime and see the magic happen! For example I like to tell my models that they should not make up Structure or Type Names but use the provided MCP Tools to look at structures and tables first!
Happy Coding!
By combining VS Code, Cline, and AI models like DeepSeek R1, ABAP developers can:
Increase productivity: AI-powered suggestions reduce the time spent writing boilerplate code.
Improve code quality: AI models can identify potential errors and suggest best practices.
Learn faster: AI-generated examples and explanations help developers understand complex ABAP concepts.
AI-assisted coding is revolutionizing the way developers work, and ABAP developers are no exception. With tools like VS Code, Cline, and DeepSeek R1, you can streamline your development process, write better code, and connect seamlessly to SAP systems. Whether you’re running the AI model in the cloud or locally with Ollama, the possibilities are endless. Give it a try and experience the future of ABAP development today!
Have you tried AI-assisted coding for ABAP? Share your experiences in the comments below!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
9 | |
5 | |
4 | |
4 | |
2 | |
2 | |
2 | |
2 | |
2 |