ABAP + private LLM
AI for ABAP Development: A Private Code LLM That Knows Your Z Objects
Short answer
An LLM can help ABAP developers explain legacy Z programs, draft SELECT statements and BAPI calls, write unit tests and fix ATC findings. SAP's own ABAP AI capabilities target ABAP Cloud and recent releases; for classic ABAP on ECC or on-prem S/4HANA, a private code model with retrieval over your own custom code and data dictionary does the same work without sending source code outside your network.
- ERP
- SAP ECC 6.0, SAP S/4HANA, SAP NetWeaver AS ABAP
- Industries
- Manufacturing, Aerospace, Defense, Electronics
- Written for
- SAP Development Lead
Most SAP shops carry thousands of custom objects: Z reports written in 2006, user exits nobody dares touch, enhancement implementations stacked three deep, and function modules whose only documentation is the transport description. The developers who wrote them have moved on, and every change request starts with an afternoon of reading code in SE80 or ADT to work out what it actually does.
General chat tools can write plausible ABAP, but they do not know your tables, your naming conventions or the fact that your company code logic lives in a Z function group. They also invite developers to paste proprietary source into a public service, which many security teams have already banned. The useful version of AI for ABAP is grounded: it retrieves your own DDIC definitions, custom code and coding guidelines before it answers.
SAP is investing heavily here. Joule for developers and the ABAP AI capabilities in ABAP Development Tools target ABAP Cloud and SAP BTP, ABAP environment, and SAP Build Code adds generative AI for CAP applications. If you develop mostly in ABAP Cloud on a supported release and your licences cover it, start there. The gap is the large estate of classic ABAP on ECC 6.0 and on-prem S/4HANA, where those features are limited or unavailable.
This page explains how a private code assistant for ABAP works, which jobs it handles well, where it still needs a senior developer, and how to keep its output inside your normal transport and code review process.
What usually gets in the way
The problems we hear most from sap development lead teams running SAP ECC 6.0.
Legacy Z code nobody understands
Custom reports, user exits and BAdI implementations accumulate for decades. Before any change, a developer must reverse-engineer the logic, often across includes and function groups, which turns a two-hour fix into a two-day investigation.
Public chat tools are banned for source code
Pasting ABAP into a public assistant exposes pricing logic, customer-specific rules and table structures. Many SAP security policies prohibit it, so developers either ignore the rule or get no help at all.
Generic models do not know your data dictionary
An unaided model guesses field names, invents tables and writes SELECT statements that do not compile against your system. Without retrieval over DD03L, DD02L and your Z tables, its output costs more time than it saves.
ATC and S/4HANA readiness findings pile up
Custom code checks for S/4HANA produce long lists of findings: obsolete tables, field length extensions, simplification items. Each needs a small, careful fix, and the volume overwhelms a small team.
Documentation and unit tests are always last
ABAP Unit coverage in most custom estates is close to zero and technical documentation lags behind the code. Both are tedious to write by hand and are the first things cut under deadline pressure.
Where AI earns its place in SAP ECC 6.0
Each use case names the ERP objects it reads or writes, so your ERP team can judge the integration effort before anyone commits budget.
Explain a legacy program
The developer points the assistant at a Z report or function module. It reads the source, its includes and the tables it touches, and writes a plain explanation of inputs, logic, side effects and risky statements.
Touches: Z programs, includes, function groups (TFDIR, TADIR), DDIC tables (DD02L, DD03L)
Outcome: Investigation time on unfamiliar objects drops from hours to a short review of a generated summary.
Draft SELECTs and BAPI calls against real tables
Ask for open purchase order items for a plant or a goods movement posting. The assistant retrieves the actual table and BAPI signatures from your system and drafts code with correct field names and commit handling.
Touches: EKKO, EKPO, EKET, MSEG/MATDOC, BAPI_GOODSMVT_CREATE, BAPI_TRANSACTION_COMMIT
Outcome: First drafts compile far more often because field names come from your DDIC, not from memory.
Fix S/4HANA custom code findings
Feed ATC results from the S/4HANA readiness checks. The assistant groups similar findings, proposes the fix pattern for each group and drafts the change for a developer to review.
Touches: ATC check runs, simplification items, MATDOC vs MKPF/MSEG, ACDOCA vs BSEG, field length extension for MATNR
Outcome: Repetitive remediation moves faster; developers spend their time on the findings that need judgement.
Generate ABAP Unit tests
For a method or function module, the assistant drafts ABAP Unit test classes with test doubles for database access, covering the main paths and edge cases it finds in the code.
Touches: ABAP Unit, test seams, CL_OSQL_TEST_ENVIRONMENT, local test classes
Outcome: Teams start building coverage on the objects they change most, instead of none at all.
Write technical documentation from code
Generate a technical specification for an existing enhancement, including the user exit or BAdI, triggering transaction, tables read and written, and authorisation checks performed.
Touches: Enhancement implementations, BAdIs, customer exits (CMOD/SMOD), AUTHORITY-CHECK statements
Outcome: Documentation exists for the objects that matter, generated in minutes and corrected by the owner.
Review transports before release
Before a transport is released, the assistant summarises what changed, flags risky patterns such as SELECT without WHERE, missing AUTHORITY-CHECK or hard-coded company codes, and links them to your guidelines.
Touches: Transport requests (E070, E071), version management, code inspector variants
Outcome: Reviewers get a structured first pass, so human review focuses on logic rather than style.
Answer how-do-we-do-this questions
A new developer asks how the company handles output determination or pricing exits. The assistant searches your custom code and internal guidelines and points to the existing implementations.
Touches: Custom code base, naming conventions, internal development standards documents
Outcome: Onboarding time shortens because institutional patterns are searchable.
Reference architecture
The assistant runs an open-weight code model on your own GPUs and retrieves context from an index built from your custom code, DDIC metadata and development guidelines. It integrates with the developer's IDE and never writes to the SAP system directly.
- 1
Code and metadata extraction
A scheduled job exports custom objects (TADIR entries in the customer namespace), source via standard read function modules or abapGit, and DDIC definitions for tables, structures and BAPI interfaces.
- 2
Code-aware index
Source is chunked by method, form and function module rather than by character count, with metadata for package, object type and last transport, so retrieval returns whole logical units.
- 3
Private code model
An open-weight coding model in the Qwen Coder or similar class, served with vLLM on on-prem GPUs. A mid-size model is usually sufficient for ABAP drafting when retrieval supplies the right context.
- 4
IDE integration
Developers work in ADT (Eclipse) or VS Code with an extension that calls the private endpoint. Suggestions appear as drafts; nothing is activated or transported automatically.
- 5
Governance and logging
Every prompt and response is logged with user and object, and generated code passes through ATC and your normal peer review before any transport is released.
Integration notes for your ERP team
- Extract custom objects by package or namespace (Z*, Y*, /yourns/) using TADIR, and refresh nightly or on transport import.
- abapGit serialisation is a practical way to export source and DDIC objects in a text format the indexer can read.
- Include BAPI and function module interfaces (FUPARAREF) so the model sees real parameter names when drafting calls.
- Index your development guidelines, naming conventions and code inspector variants so suggestions match house style.
- Run generated code through ATC with your standard check variant before review; treat AI output as untrusted input.
- Keep the assistant read-only against SAP: it reads exported code and metadata, it never logs on to activate or transport.
Deployment options
On-prem GPU server
Defense, aerospace and regulated manufacturers where source code is controlled information.
One or two data center GPUs serve a development team comfortably. Source code and prompts never leave the network.
Private cloud tenancy
Companies already running SAP in a hyperscaler under their own account.
The model runs in your own VPC next to the SAP landscape, with private endpoints and no shared multi-tenant inference service.
SAP-native first, private for the rest
Teams with significant ABAP Cloud development on current releases.
Use SAP's ABAP AI features where licensed and supported, and the private assistant for classic ABAP on ECC and older S/4HANA systems.
Compliance and data control
How the architecture supports your obligations. Certification and accountability stay with your organisation; the design keeps the evidence straightforward.
ITAR / EAR
When custom code embeds controlled technical data or customer program logic, keeping inference on-prem avoids exporting it to a third-party service. The customer remains responsible for its own export control determinations.
SOX change management
Generated code follows the same transport path, approvals and segregation of duties as hand-written code. The assistant has no transport or activation rights.
NIST SP 800-171 / CMMC
Access to the assistant uses existing identity, prompts are logged, and the index lives inside the controlled environment, which supports the customer's own CUI handling obligations.
Internal source code policy
A private endpoint gives developers a sanctioned tool, which is usually more effective than a ban on public chat tools that people work around.
Where Netray fits
How an engagement runs
Phase 1 . 1-2 weeks
Code estate assessment
- -Custom object inventory by package and age
- -Developer interviews on top time sinks
- -Security and source code policy review
Phase 2 . 2-3 weeks
Index and model setup
- -Extraction pipeline for code and DDIC
- -Code-aware index with metadata
- -Private model endpoint on your GPUs
Phase 3 . 3-4 weeks
Pilot with one team
- -IDE integration for pilot developers
- -Prompt patterns for explain, draft, test and remediate
- -Measured comparison on real change requests
Phase 4 . 2-4 weeks
Rollout and governance
- -Logging and review workflow
- -ATC gating for generated code
- -Training and usage guidelines
Questions to ask any vendor, including us
A short list that separates real SAP ECC 6.0 AI work from a chatbot demo.
- Does the assistant retrieve our actual DDIC definitions, or does it rely on the model's memory of standard SAP?
- Where does our source code go, and is any of it used to train a shared model?
- How does it handle classic ABAP on ECC 6.0 as well as ABAP Cloud?
- Can it ever activate, transport or execute code in our system?
- How is generated code checked before it reaches a transport?
- Which of these features does SAP already include in our licences, and what does a private assistant add beyond them?
- What GPU capacity does a team of our size need?
Frequently asked questions
Can ChatGPT write ABAP?
General models write plausible ABAP and know common standard tables and BAPIs. The problems are that they guess field names in your custom tables, do not know your Z function groups or conventions, and require pasting proprietary code into an external service. For occasional syntax questions that is acceptable to some teams. For real work on your custom estate, an assistant grounded in your own DDIC and code produces drafts that compile more often and keeps source inside your network.
What does SAP offer for AI in ABAP development?
SAP offers Joule for developers and ABAP AI capabilities in ABAP Development Tools, aimed at ABAP Cloud on SAP BTP and recent S/4HANA releases, plus generative AI in SAP Build Code for CAP and full-stack apps. Availability depends on release, edition and licence, so check with SAP. If your development is mostly ABAP Cloud on a supported release, SAP's tooling is the natural first choice. Classic ABAP on ECC is where a private assistant fills the gap.
Which model is good enough for ABAP?
ABAP is a smaller language in public training data than Java or Python, so retrieval matters more than raw model size. Current open-weight coding models in the 14B to 32B parameter range handle ABAP drafting well when given your table definitions and similar existing code. Larger models help with long explanations of complex legacy programs. The practical approach is to pilot two candidates on your own change requests and measure compile rate and review effort.
Will it help with S/4HANA custom code migration?
Yes, this is one of the strongest uses. ATC with S/4HANA readiness checks produces many repetitive findings, such as direct reads of replaced tables, MATNR length issues and obsolete transactions. The assistant can cluster findings, propose a fix pattern per cluster and draft changes. A developer still reviews each change, and functional decisions about whether to keep, retire or rebuild custom code remain human.
Is generated ABAP safe to transport?
Only after the same checks as any other code: ATC with your check variant, peer review, unit tests where practical and testing in QA. The assistant should have no ability to activate or release transports. Treat its output as a draft from a capable but unreliable junior developer: often right, sometimes confidently wrong, especially around commit handling, authorisation checks and performance on large tables.
How do you get our code out of SAP for indexing?
Common options are abapGit serialisation by package, standard read function modules for source and DDIC metadata, or an export job that writes source to a file share. The extraction runs under a technical user with read-only development authorisation and refreshes nightly or after transport imports. The index stays inside your environment alongside the model.
What does it cost to run?
For a development team of five to thirty people, a single server with one or two data center GPUs is usually enough, since coding assistance has bursty, modest concurrency. The bigger cost is the initial build: extraction, indexing, IDE integration and tuning prompts to your conventions. Compare that against developer time spent reverse-engineering legacy code and remediating S/4HANA findings.
Related guides
Get AI Value From SAP ECC Now, and Use It to De-Risk the Move to S/4HANA
SAP ECC 6.0 mainstream maintenance ends in 2027. Add AI value on ECC now, using its existing BAPIs and IDocs, and use it to de-risk the S/4HANA migration.
SAP S/4HANA + private AIAI for SAP S/4HANA, Running On-Prem or in Your Private Cloud
Run AI on SAP S/4HANA without sending ERP data to a public API. On-prem and private-cloud architecture, CDS views, OData, and honest deployment trade-offs.
SAP Joule + on-prem alternativeSAP Joule or a Private LLM Beside SAP: An Honest Comparison
An honest comparison of SAP Joule and Business AI against a private, self-hosted LLM beside SAP: what each covers, where they overlap, and where CIOs run both.
SAP AI Buyer GuideSAP AI Consulting for On-Prem and Private Deployments
What to demand from an SAP AI consulting partner when data must stay on-prem or private: OData/BAPI mechanics, Joule vs. private LLM, and buyer questions.
Vendor copilots vs private AIBuild vs Buy: Should You Use Your ERP Vendor's AI Copilot, or Build Your Own?
SAP Joule, Copilot for D365, Infor GenAI, Oracle AI Agent Studio, or a private LLM on your own data. A CIO framework for the build vs buy decision, with real trade-offs.
SAP Business One + AIAI for SAP Business One, Without Sending Your Books to a Public API
Add AI to SAP Business One without sending customer data or financials to a public API. Service Layer and DI API integration, sized for an SMB budget.
Plan it with numbers
SAP Open Purchase Order Items ABAP SELECT Generator
Builds an ABAP report that selects open PO schedule lines with open quantity from EKKO, EKPO and EKET, filtered by purchasing organisation, plant, document type and date.
Free ToolSAP Custom Code Inventory ABAP Query Generator (TADIR)
Generates ABAP SELECT statements against TADIR that count and list custom objects by type and package for S/4HANA remediation planning.
Free ToolSAP ABAP AUTHORITY-CHECK Snippet Generator
Fill in an authorization object, activity and organisational field and get a ready ABAP AUTHORITY-CHECK block with error handling.
GuideLLM Integration Patterns for Enterprise ERP
Integrate large language models with enterprise ERP systems using RAG, fine-tuning, function calling, and prompt engineering patterns for production deployment.
GuideOn-Prem LLM Deployment Architecture: Reference Guide
Reference architecture for on-prem LLM deployment: inference servers, GPU sizing, RAG pipelines, and security zones for regulated manufacturers.
GuideFine-Tuning vs RAG vs Prompting: A Decision Guide
Fine-tuning vs RAG vs prompting for enterprise LLM customization: what each actually changes, when each wins, and how to combine all three.
Talk it through with an engineer who knows SAP ECC 6.0
Bring one real question your team cannot answer from the ERP today. We will map the data path, the model, and where it runs, and tell you honestly if AI is the wrong tool for it.
Try it here, free
ABAP Development Effort Estimator
Turn counts of simple, medium and complex ABAP objects into build, test and total hours and days with contingency.
New to SAP HANA and Basis? Start with the SAP HANA and Basis guide and toolkit.
Keep exploring
Free tools
- ABAP Development Effort EstimatorTurn counts of simple, medium and complex ABAP objects into build, test and total hours and days with contingency.
- ABAP Code Review ChecklistA practical review checklist for ABAP changes: database access, security, error handling, structure and S/4HANA compatibility.
- ABAP Unit Test Case WorksheetAn editable test case log for ABAP objects with expected and actual values, variance and pass/fail status, exportable to Excel.
ERP fixes and how-tos
- How to Use BAPI_TRANSACTION_COMMIT CorrectlyBAPIs never commit their own update. Here is when to call BAPI_TRANSACTION_COMMIT with WAIT, and why a BAPI can run fine and still save nothing.
- How to add AI to SAP ECC 6.0 on-prem without moving data to a cloudReference architecture for a private on-prem AI assistant on SAP ECC 6.0: RFC and BAPI reads, SLT replica, retrieval index, local LLM, permission mirroring.
- SAP S/4HANA upgrade steps: a runbook for manufacturersStep-by-step SAP S/4HANA upgrade and conversion runbook: readiness check, Maintenance Planner, custom code, SUM, testing and cutover for manufacturers.
Runs with your ERP
- SAP Joule in S/4HANA Cloud Public Edition: what it does for manufacturersWhat SAP Joule does in S/4HANA Cloud Public Edition for manufacturers: natural-language navigation and supply chain insights, limits, setup and trade-offs.
- Loftware with SAP ECC and S/4HANA: label design and printing from SAP transactionsHow Loftware and the NiceLabel ABAP package drive labels from SAP ECC and S/4HANA, including SAP GLM Plus, data flows, setup steps and pitfalls to avoid.
AI on your ERP
- SAP Joule or a Private LLM Beside SAP: An Honest ComparisonAn honest comparison of SAP Joule and Business AI against a private, self-hosted LLM beside SAP: what each covers, where they overlap, and where CIOs run both.
- AI on SAP ECC vs S/4HANA: What Each Platform Can Actually RunAI on SAP ECC vs S/4HANA: Joule and embedded AI, data model and API differences, and what a private model can run on ECC today before you migrate.
Integrations
- How to use ChatGPT with SAP ECC 6.0Using ChatGPT with SAP ECC 6.0: custom GPT actions, exports versus live access, an OData or MCP bridge, enterprise data controls, and when a private model is safer.
- How to use Claude with SAP S/4HANAUse Claude with SAP S/4HANA through MCP connectors, the Anthropic API, AWS Bedrock or Google Vertex, and learn when an on-prem model is the better fit.