Phani Puttabakula - Mar 9, 2026

Part 2: Your First ABAPer Prompts โ€“ Simple Use Cases

Part of ABAPer Series

Summary

Now that ABAPer is set up, it’s time to write prompts that do real work. This article covers practical prompt examples for everyday ABAP development tasks โ€” from explaining programs and fetching metadata to querying repository objects. You’ll learn how prompt structure affects output quality and build a foundation for more advanced workflows.

The Problem

ABAP developers spend significant time on routine tasks: understanding unfamiliar programs, looking up table structures, tracing function module dependencies, and navigating complex codebases. These tasks are necessary but repetitive. They eat into the time you could spend on actual development.

Asking a general-purpose AI to help with ABAP is frustrating. It doesn’t know your system. It can’t read your programs. It hallucinates table names. You end up spending more time correcting the AI than doing the work yourself.

Why This Matters

ABAPer’s AI assistant is connected to your SAP system. When you ask it about a program, it reads the actual source code via ADT. When you ask about a table, it fetches the real metadata. This is not a general chatbot โ€” it operates on live SAP data.

This means your prompts produce accurate, system-specific results. No hallucinated table names. No invented function modules. Real answers from your real system.


Step-by-Step Tutorial

Understanding the AI Panel

Open the AI panel with Ctrl+L (Windows/Linux) or Cmd+L (Mac).

The AI panel has two modes of interaction:

  1. Quick Actions โ€” Pre-built buttons at the top of the panel:

    • Review โ€” Run a code review on the active file
    • S/4HANA Check โ€” Analyze S/4HANA compatibility
    • Explain โ€” Summarize the active file
    • Test โ€” Run ABAP unit tests
    • Optimize โ€” Suggest performance improvements
  2. Free-form Prompts โ€” Type any question or instruction in the text input at the bottom of the panel.

The AI always has context about your active file in the editor. If you have text selected, it uses the selection as context instead of the full file.

In the VSCode extension, the same applies: selected code or the open file (up to 200 lines) is automatically included as context. You also have chat commands:

  • /explain โ€” Explain selected code
  • /generate [description] โ€” Generate ABAP code
  • /performance โ€” Analyze performance
  • /table [name] โ€” Look up table definition

Screenshot Image


Use Case 1: Explain an ABAP Program

Open any ABAP program in the editor and use the AI panel.

PROMPT:

Explain this program. Focus on the data flow and business logic.

EXPECTED OUTPUT:

Program: Z_VENDOR_PAYMENT_REPORT

Purpose

Generates a vendor payment aging report for accounts payable. Reads open items from BSIK and cleared items from BSAK, then categorizes payments by aging buckets (0-30, 31-60, 61-90, 90+ days).

Data Flow

  1. SELECTION-SCREEN collects: company code, vendor range, key date
  2. SELECT from BSIK (open items) with company code and vendor filters
  3. SELECT from BSAK (cleared items) for the same period
  4. Internal table lt_items consolidated from both sources
  5. LOOP calculates aging bucket per line item based on baseline date
  6. Final ALV output via CL_SALV_TABLE with subtotals by vendor

Business Logic

  • Aging calculation: sy-datum - baseline_date (BSIK-ZFBDT)
  • Currency amounts converted to local currency via BAPI_CURRENCY_CONV_TO_INTERNAL
  • Subtotals grouped by vendor number (LIFNR)
  • Grand total row appended at end

Dependencies

  • Tables: BSIK, BSAK, LFA1 (vendor master for name)
  • BAPI: BAPI_CURRENCY_CONV_TO_INTERNAL
  • Class: CL_SALV_TABLE

Why this works: The AI reads the actual source code from your SAP system. It identifies the tables, the control flow, and the business purpose from the real code โ€” not from guessing.

Tip: Be specific about what you want. “Explain this program” gives a general overview. “Focus on the data flow” or “Focus on the authorization checks” gives targeted answers.


Use Case 2: Fetch Object Metadata

You don’t need to have a file open to ask about objects in your system.

PROMPT:

Get the source code of program ZSALES_ORDER_CREATE and explain its purpose.

EXPECTED OUTPUT:

ZSALES_ORDER_CREATE

Retrieved Source (428 lines)

Purpose

BDC program for mass sales order creation. Reads order data from an Excel upload (via ALSM_EXCEL_TO_INTERNAL_TABLE), maps fields to transaction VA01 BDC recording, and processes orders in batch.

Structure

  • Selection screen: file path input, test mode flag
  • Excel upload and field mapping
  • BDC session creation via BDC_OPEN_GROUP
  • Loop through order data, calling BDC_INSERT for each order
  • BDC_CLOSE_GROUP to submit the batch session
  • Error log written to application log (BAL)

Observations

  • Uses legacy BDC approach โ€” consider migrating to BAPI_SALESORDER_CREATEFROMDAT2
  • No error handling for file-not-found scenario
  • Test mode flag is accepted but not fully implemented (still creates BDC session)

Behind the scenes, ABAPer used the get-object MCP tool to retrieve the program source from your SAP system, then analyzed it.


Use Case 3: Look Up a Table Structure

PROMPT:

What is the structure of table MARA? List the key fields and important columns.

EXPECTED OUTPUT:

Table: MARA (General Material Data)

Key Fields

Field Type Description
MANDT CLNT (3) Client
MATNR CHAR (40) Material Number

Important Columns

Field Type Description
MTART CHAR (4) Material Type
MBRSH CHAR (1) Industry Sector
MATKL CHAR (9) Material Group
MEINS UNIT (3) Base Unit of Measure
BRGEW QUAN (13) Gross Weight
NTGEW QUAN (13) Net Weight
GEWEI UNIT (3) Weight Unit
ERSDA DATS (8) Created On
ERNAM CHAR (12) Created By
LAEDA DATS (8) Last Changed
PSTAT CHAR (15) Maintenance Status
LVORM CHAR (1) Deletion Flag

Notes

  • MARA is the central material master table (general data)
  • Plant-level data is in MARC, storage location in MARD
  • Sales data in MVKE, purchasing in EINE/EINA

In the VSCode extension, you can use the /table chat command for quick lookups:

PROMPT:

/table MARA

This triggers a dedicated table lookup that returns the structure directly.


Use Case 4: List Tables Used by a Program

PROMPT:

Analyze this program and list all database tables it reads from or writes to.
Include the operation type (SELECT, INSERT, UPDATE, DELETE, MODIFY).

EXPECTED OUTPUT:

Database Access Analysis: Z_INVENTORY_ADJUSTMENT

Table Operation Line Context
MARD SELECT 45 Stock overview by storage location
MSEG SELECT 78 Material document items
MKPF SELECT 82 Material document headers
MARD UPDATE 134 Adjust unrestricted stock
MSEG INSERT 156 New material document item
MKPF INSERT 152 New material document header
CDHDR INSERT 178 Change document header
CDPOS INSERT 182 Change document items

Observations

  • Direct table INSERT on MSEG/MKPF instead of using BAPI_GOODSMVT_CREATE
  • Direct UPDATE on MARD is risky โ€” stock quantities should be updated via goods movement
  • Change documents written manually instead of using CHANGEDOCUMENT_OPEN/CLOSE
  • Recommendation: Refactor to use standard BAPIs for inventory movements

This prompt is valuable during code review or when inheriting unfamiliar programs. It gives you a database access map in seconds.


Use Case 5: Search for Objects

PROMPT:

Search for all programs that start with Z_MM_* in the system.

EXPECTED OUTPUT:

Search Results: Z_MM_*

Found 12 objects:

Object Name Type Package
Z_MM_STOCK_REPORT Program ZMM_REPORTS
Z_MM_VENDOR_EVAL Program ZMM_REPORTS
Z_MM_PO_MASS_CHANGE Program ZMM_TOOLS
Z_MM_PRICE_UPDATE Program ZMM_TOOLS
Z_MM_MATERIAL_UPLOAD Program ZMM_MASTER
Z_MM_BATCH_CLEANUP Program ZMM_TOOLS
Z_MM_INVENTORY_COUNT Program ZMM_WM
Z_MM_GR_REVERSAL Program ZMM_TOOLS
Z_MM_OPEN_PO_REPORT Program ZMM_REPORTS
Z_MM_DELIVERY_MONITOR Program ZMM_REPORTS
Z_MM_CONTRACT_EXPIRY Program ZMM_REPORTS
Z_MM_QUOTA_ARRANGEMENT Program ZMM_MASTER

ABAPer uses the search-objects MCP tool with wildcard support to query your SAP repository directly.


Use Case 6: Understand a Class

PROMPT:

Get class ZCL_SALES_ORDER_HANDLER and describe its public methods,
their parameters, and what each method does.

EXPECTED OUTPUT:

Class: ZCL_SALES_ORDER_HANDLER

Superclass: None Interfaces: ZIF_SALES_ORDER

Public Methods

CREATE_ORDER

Importing:

  • IS_HEADER TYPE ZSALES_HEADER โ€” Order header data
  • IT_ITEMS TYPE ZSALES_ITEMS_T โ€” Order line items

Returning:

  • RV_ORDER_NUMBER TYPE VBELN โ€” Created order number

Raises: ZCX_SALES_ORDER

Description: Creates a sales order via BAPI_SALESORDER_CREATEFROMDAT2. Maps input structure to BAPI format, calls BAPI, handles RETURN messages, commits on success.

GET_ORDER_STATUS

Importing:

  • IV_ORDER TYPE VBELN โ€” Sales order number

Returning:

  • RS_STATUS TYPE ZSALES_STATUS โ€” Status structure

Description: Reads order status from VBUK (header status) and VBUP (item status). Returns consolidated status with delivery and billing flags.

CANCEL_ORDER

Importing:

  • IV_ORDER TYPE VBELN
  • IV_REASON TYPE CHAR2 โ€” Rejection reason code

Raises: ZCX_SALES_ORDER

Description: Sets rejection reason on all open items via BAPI_SALESORDER_CHANGE. Does not delete the order.


Use Case 7: GitHub Repository Browsing

ABAPer’s Web IDE includes a GitHub explorer panel for browsing ABAP repositories.

  1. Click the GitHub icon in the left sidebar
  2. Authenticate with your GitHub account
  3. Browse repositories, branches, and files
  4. Open ABAP files directly in the editor

This is useful for reviewing open-source ABAP code, importing reference implementations, or browsing abapGit repositories.

PROMPT (with a GitHub file open):

Explain this class from the GitHub repository.
How does it compare to standard SAP patterns?

Screenshot Image


Prompt Structure Best Practices

Be Specific

Bad: Tell me about this code Good: List all SELECT statements in this program and evaluate their performance

Specify Output Format

Bad: Review this code Good: Review this code. Present findings as a table with columns: Issue, Severity, Line Number, Suggestion

Add Context

Bad: Fix the bug Good: This program abends with a DBSQL_SQL_ERROR on line 45 when the vendor table has more than 10,000 entries. Suggest a fix.

One Task Per Prompt

Bad: Explain this program, then rewrite it using ABAP OO, add unit tests, and check S/4HANA compatibility Good: Start with Explain this program, then follow up with specific requests.

Use Selection Context

Instead of describing which code you mean, select the specific lines in the editor before prompting. The AI uses your selection as context automatically.


Best Practices

  1. Start with Explain before you Review. Understanding the code first gives you context for evaluating the AI’s review suggestions.

  2. Use Quick Actions for common tasks. The Review, Explain, and Optimize buttons are pre-tuned prompts โ€” they’re faster than typing and consistently structured.

  3. Select code before prompting. When you want to ask about a specific method or block, select it first. The AI focuses on your selection instead of the entire file.

  4. Combine system knowledge with AI. ABAPer can fetch objects from your system. Ask it to retrieve programs, classes, or tables you don’t have open โ€” it will use MCP tools to pull the source.

  5. Iterate on prompts. Your first prompt gets you 80% of the way. Follow up with a refinement: “Now focus on the error handling” or “Show me just the SELECT statements.”


Troubleshooting

AI response says “object not found”

  • Verify the exact object name (ABAP names are case-insensitive, but spelling matters)
  • Check that your SAP system connection is active
  • Ensure your SAP user has read authorization for that object’s package

Response seems generic or hallucinated

  • This usually means the AI couldn’t fetch the object from SAP. Check the transport indicator in the status bar โ€” it should show connected (green).
  • Try using the exact object type: “Get program ZREPORT” instead of just “Get ZREPORT”

Prompt works in Web IDE but not VSCode

  • Both use the same backend AI service
  • In VSCode, ensure you’re authenticated (status bar shows “ABAPer” with a checkmark)
  • VSCode sends up to 200 lines of the open file as context. For very large programs, select the relevant section first.

Response is cut off

  • Long responses may be truncated. Ask a follow-up: “Continue from where you left off” or narrow your question scope.

“Tool execution failed” message in AI panel

  • This means an MCP tool call failed (e.g., get-object, search-objects)
  • Check the Output panel for detailed error messages
  • Common cause: SAP system connection dropped โ€” reconnect and retry

Conclusion

You’ve now learned the core prompt patterns for ABAPer:

  • Explain code to understand unfamiliar programs
  • Fetch objects from your SAP system by name
  • Look up table structures and metadata
  • Trace database access across a program
  • Search your repository for objects
  • Analyze classes and their methods
  • Browse GitHub repositories for reference code

These are building blocks. Every advanced workflow in ABAPer starts with these fundamental interactions.


Next Article

In Part 3: Using ABAPer for Code Review and Analysis, we’ll use these prompt skills for structured code reviews. You’ll learn how to run S/4HANA compatibility checks, detect anti-patterns, identify performance bottlenecks, and get actionable improvement suggestions โ€” all from the AI panel.

Share this article
LinkedIn