Chapter 3 - Agentic AI
Understand how agentic workflows differ from classic chat assistance and where they add the most value in SAP integration scenarios.
- Reading time: 30 minutes
- Practical time: 35 minutes
Reading
Agentic AI is not just question-answer chat. In an agentic workflow, the AI can plan steps, gather context, use tools, perform actions, and iterate until a task is complete. Instead of only generating suggestions, it can actively help execute development work such as reading SAP-related docs, querying connected systems through MCP tools, and validating results.
For SAP development, this is especially useful when tasks span multiple systems and artifacts (for example, ABAP objects, transport-related constraints, and project documentation). The key benefit is that the agent can move through a structured loop: understand the goal, collect context, act, verify, and refine.
Agentic Loop
- How Claude Code Works - Understanding how agents work under the hood
The Agentic Loop
When you submit a prompt, the agent doesn't just generate code. It executes a loop:
Gather Context: Reads files, searches codebase, checks documentation
Take Action: Edits files, runs commands, creates new code
Verify Results: Checks test output, validates changes, assesses completion
Loop or Complete: Continues until task is done or hits a blocker
Additional Reading
Practical
Prerequisites
Before starting the practical part, make sure you have:
- Environment ready. If needed, complete Chapter 0 - Setup and Requirements first (Eclipse, ADT, GitHub Copilot, and Copilot subscription setup)
- MCP Server configured and connected Chapter 2 - MCP Server
- Eclipse with your ABAP project open
- Copilot Chat open in Agent mode
Exercise 1 - Create Unit tests
Goal: Use Agent mode to create a unit test.
- Create the following ABAP class example in your local package. Replace ** with your initials.
- Open Copilot Chat via Copilot -> Open Chat.
- In chat, select Agent mode.
- Choose a model (for example, Claude Sonnet).
- Write a prompt for creating the unit test for class ZCL_**_CALCULATOR (coverage should be at least 90%)
CLASS zcl_**_calculator DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
METHODS addition
IMPORTING
iv_a TYPE decfloat34
iv_b TYPE decfloat34
RETURNING
VALUE(rv_result) TYPE decfloat34.
METHODS subtraction
IMPORTING
iv_a TYPE decfloat34
iv_b TYPE decfloat34
RETURNING
VALUE(rv_result) TYPE decfloat34.
METHODS multiplication
IMPORTING
iv_a TYPE decfloat34
iv_b TYPE decfloat34
RETURNING
VALUE(rv_result) TYPE decfloat34.
METHODS division
IMPORTING
iv_a TYPE decfloat34
iv_b TYPE decfloat34
RETURNING
VALUE(rv_result) TYPE decfloat34
RAISING
cx_sy_zerodivide.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_**_calculator IMPLEMENTATION.
METHOD addition.
rv_result = iv_a + iv_b.
ENDMETHOD.
METHOD subtraction.
rv_result = iv_a - iv_b.
ENDMETHOD.
METHOD multiplication.
rv_result = iv_a * iv_b.
ENDMETHOD.
METHOD division.
IF iv_b = 0.
RAISE EXCEPTION TYPE cx_sy_zerodivide.
ENDIF.
rv_result = iv_a / iv_b.
ENDMETHOD.
ENDCLASS.Question
Why not add some abap documentation to the class aswell?
Exercise 2 - Analyze issues
Goal: Use Agent mode to analyze a defect and find a solution
- Create the following ABAP class example in your local package. Replace ** with your initials.
- Open Copilot Chat via Copilot -> Open Chat.
- In chat, select Agent mode.
- Choose a model (for example, Claude Sonnet).
- Write a prompt to analyze why the result from the select returns 0 entries while there are entries in the table ILOA
CLASS zcl_**_location_dao DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
TYPES ty_accassgmt_nmbr TYPE iloan.
TYPES ty_accassgmt_nmbr_tt TYPE STANDARD TABLE OF ty_accassgmt_nmbr WITH EMPTY KEY.
METHODS get_accassignments
RETURNING
VALUE(rt_result) TYPE ty_accassgmt_nmbr_tt.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_**_location_dao IMPLEMENTATION.
METHOD get_accassignments.
SELECT DISTINCT maintobjectlocacctassgmtnmbr
FROM i_locationaccountassignment
INTO TABLE @rt_result.
ENDMETHOD.
ENDCLASS.Question
How much time would have taken you to find out the issue and fix it?
Exercise 3 - Create complex frameworks
Goal: Use Agent mode to generate a complex framework
Our MCP Server did some changes, but now let's allow it to create new files.
Please add the following options to the env part of your MCP Server:
"SAP_ALLOW_DATA_PREVIEW": "true",
"SAP_ALLOW_FREE_SQL": "true",
"SAP_ALLOW_TRANSPORT_WRITES": "true",
"SAP_ALLOWED_TRANSPORTS": "S4DK*, DEVK*",
"SAP_ALLOWED_PACKAGES": "$TMP,Z*"- Open Copilot Chat via Copilot -> Open Chat.
- In chat, select Agent mode.
- Choose a model (for example, Claude Sonnet).
- Your task is to design and implement a reusable ABAP OO REST service framework (for classic ABAP, not RAP)
- The framework should include the following features: Request parsing, Response mapping Error handling, Authentication hooks, Versioning (/v1, /v2)
Detailed instructions
Note, not the entire specification has to be implemented
Note
Please adjust the scope of this exercise according to your remaining time. While experimenting is part of the exercises in this lab, respecting the time frame of the lab is more important for this chapter (later on you will have a chance to explore more regarding framework creation).
What's Next
Continue with Chapter 4 - Copilot CLI and Skills to extend your agentic workflows with CLI tooling and reusable skills.