Artificial Intelligence Blogs Posts
cancel
Showing results for 
Search instead for 
Did you mean: 
vodela
Active Participant
5,452

Author: Ramesh Vodela
Machine: Dell Precision 7760 | 128 GB RAM | NVIDIA RTX A3000 (6 GB VRAM). If you have less RAM you response could be slow.

For years, ABAP development was a "closed box," but the rise of Generative AI has promised to change that. While SAP has introduced Joule on BTP, many developers and organizations find themselves at a crossroads. Why build a local AI powerhouse when a cloud solution exists?

  1. The Availability Gap

SAP Joule is a premium, cloud-based tool primarily available for S/4HANA Cloud (Public/Private Edition) and BTP. For developers working on On-Premise S/4HANA systems or older ECC landscapes, Joule often remains out of reach. We believe AI shouldn't be limited by your SAP version.

  1. The Privacy Paradox

In the SAP world, code is proprietary. Many firms are hesitant to "ship" their custom business logic to a cloud provider for processing. By using a Local LLM (Large Language Model), your source code never leaves your workstation. It stays behind your firewall, ensuring 100% data sovereignty.

  1. The Cost of Innovation

Cloud-based AI is expensive. Between BTP licensing, API consumption costs, and per-user fees, the "Joule bill" can add up quickly. Our solution leverages the 128GB of RAM already sitting in your workstation. Once your hardware is paid for, your AI "co-pilot" costs $0 per month to run.

  1. Empowering the Developer

This blog is for the developer who wants the power of a Senior Architect sitting on their shoulder, without waiting for corporate budget approval or BTP provisioning. We are democratizing AI for the ABAP community, one local install at a time.

This blog outlines how to build a private, high-performance ABAP development environment using VS Code, Ollama, and a Local 32B AI Model.

Phase 1: The Hardware & Engine”

Before coding, we must prepare the "brain" of the operation.

  1. Install Ollama: Download from ollama.com.   When you install ollama it is configured as autostart program. Use taskmanager to disable this .  Disable Ollama autostart to ensure environment variables are correctly applied when manually starting the service. Open a powershell in admin mode and run the following commands and leave this window open.   A windows restart is required before the next step otherwise you will get a port binding error.

$env:OLLAMA_HOST = "127.0.0.1:11434" 

$env:OLLAMA_ORIGINS = "*"   # this is for CORS   This allows VS Code       #extensions (Continue) to communicate with Ollama locally.

ollama serve

  1. Pull the Models: Open PowerShell and run:
    • ollama pull qwen2.5-coder:32b (Your "Senior Architect")
    • ollama pull qwen2.5-coder:1.5b (Your "Fast Autocomplete")
  2.  Create a Modelfile (without any extensions) with the following contents for qwen2.5-coder:32b  you can change this to whatever model you want to use.

FROM qwen2.5-coder:32b

# We have 128GB RAM, so let's use a massive context window for SAP projects

PARAMETER num_ctx 32768

PARAMETER temperature 0.

SYSTEM """

You are a Lead SAP ABAP Developer specializing in S/4HANA 2023.

Your goal is to provide high-quality, production-ready code.

  1. Use Modern ABAP: Prioritize expressions like NEW, VALUE, CORRESPONDING, and inline declarations (@DATA).
  2. Framework Expertise: Deep knowledge of RAP (RESTful ABAP Programming Model), OData v4, and CDS Views.
  3. Clean Code: Follow Clean ABAP principles. No Hungarian notation.
  4. Context: When I provide code, analyze it for performance bottlenecks (e.g., SELECTs inside loops).

"""

  1. Create an ABAP model with this file in a PowerShell admin window

 ollama create abap-master-fast  -f Modelfile

 

  1. The 128GB RAM Flex: Increase the memory window so the AI can read massive files like abapGit:
    • Run ollama run qwen2.5-coder:32b.
    • Type /set parameter num_ctx 32768 and then /save abap-master

Phase 2: Connecting VS Code to S/4HANA

We use the ABAP Remote FileSystem to bridge the gap.

  1. Install Extension: Search for "ABAP Remote FileSystem" in the VS Code Marketplace.
  2. Enable ADT on SAP: In your S/4HANA system, In Transaction SICF, ensure the ADT service is active. (In S/4HANA 2023, ADT_SRV is no longer use.
  3. Configure Connection: Press Ctrl + Shift + P -> ABAPfs: Connection Manager. Add your system details (Hostname, Client, etc.).

      The contents of config.json for ABAP  S4HANA 2023 are as follows

{

    "workbench.colorTheme": "Default Dark+",

    "window.zoomLevel": 1,

    "abapfs.remote": {

 

        "A5H": {

            "url": "http://vhcala4hci:50000",

            "username": "<YOUR_USER>",

            "password": "<YOUR_PASSWORD>",

            "client": "001",

            "language": "EN",

            "allowSelfSigned": true,

             "syncFolder": "C:\\Users\\r_vod\\Documents\\SAP_Local_Sync",

             "downloadOnOpen": true

        }

    },

    "abapfs.cleaner": {

   

    },

    "editor.inlineSuggest.edits.showCollapsed": true

Save this and restart VS code so that the connection is made on startup as shown below. Click on the package to see the different folders

vodela_0-1770761690557.png

 

 

Phase 3: The AI Assistant (Continue Extension)

This replaces the need for an expensive Claude/Copilot subscription.

  1. Install "Continue-open source AI Code agent": Search for the Continue extension in VS Code.
  2. Configure config.yaml: Set your provider to ollama and point the model to abap-master.
  3. The "Ghost Text" setup: Ensure the tabAutocompleteModel is set to the 1.5b version for instant typing suggestions

The following .yaml file is in %USERPROFILE%/config.yaml  - a sample with my settings is provided below

 

name: SAP ABAP Master Config

version: 1.0.0

schema: v1

 

# This is the list of models for Chat and Refactoring (Ctrl+L / Ctrl+I)

models:

  - name: "ABAP Master (Fast)"

    provider: ollama

    model: abap-master-fast

    apiBase: http://localhost:11434

    roles:

      - chat

  - name: "ABAP Master (Heavy 32B)"

    provider: ollama

    model: qwen2.5-coder:32b

    apiBase: http://localhost:11434

    contextLength: 32768  # <--- Increases "Short-term memory"

    completionOptions:

      maxTokens: 8192      # <--- Allows for long code generations

    roles:

      - edit

      - apply

 

# This section must be OUTSIDE the models list

tabAutocompleteModel:

  name: "Qwen 1.5B (Speed)"

  provider: ollama

  model: qwen2.5-coder:1.5b

  apiBase: http://localhost:11434

  roles:

    - autocomplete  # This tells Continue specifically to use this for Ghost Text

tabAutocompleteOptions:

  useCopyBuffer: true

  maxPromptTokens: 400

  debounceDelay: 250

 

Make sure VS code does not show any errors with continue

vodela_1-1770761690559.png

 

Phase 4: Creating Your First Program (The Workflow)

Never create files manually in Windows. Always use the SAP-aware command:

  1. Command: Ctrl + Shift + P -> ABAPfs Create object.
  2. Details: Select Program, name it Z_AI_FLIGHT_DEMO, and use package $TMP.

vodela_2-1770761690561.png

 

 

Phase 5: "Vibe Coding" with SFLIGHT

Now, let the local AI do the heavy lifting.

  1. Inline Edit: Press Ctrl + I inside the blank file.
  2. The Request: "Write a report using SFLIGHT and the SALV class to show all flights for carrier 'AA'."

vodela_3-1770761690565.png

 

  1. Review & Accept: The AI streams the code. Press Ctrl + Shift + Enter to accept.

vodela_4-1770761690570.png

 

 

Save in VS Code and SE38 Activate, and click on change to see the code. Test to execute this program.

    Phase 6: Pushing to SE38 (Solving Conflicts)

The most common hurdle for new users is the "Sync Conflict."

  1. The Conflict: If you see "Merge with Remote," it means VS Code and SAP are out of sync.
  2. The Fix: Press Ctrl + F3 (Activate). This forces the local AI code into the SAP database.
  3. Verification: Open Transaction SE38 in your SAP GUI. Your code is there, ready to run!

   

     Phase 7: Using AI to Read and Summarize Code

  1.  Download:  Click on the File you want the AI to read and help you to understand, right click and choose download and save it with the same name in the configured folder in config.json

vodela_5-1770761690573.png

 

 

 

  1. Click on Ctrl+L to chat with AI – type in the chat window Can you read the file C:\Users\r_vod\Documents\SAP_Local_Sync\z_ai_flight_demo.prog and give me a summary of what it is doing and hit enter

vodela_6-1770761690576.png

 

      

vodela_7-1770761690580.png

Summary of Success

  • Privacy: 100% (No code leaves your machine).
  • Speed: Instant (Thanks to the 128GB RAM).
  • Cost: $0 (Open-source tools only).
2 Comments