Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 4 of 5

An agentic change, end to end

9 min

Listen to this lesson

0:00 / 9:00

Now the agent gets to change something, in a controlled way. The task: Contoso's order-to-cash key user Maria reported that users can add items to a core return agreement that is already CLOSED. Kenji asks a developer to fix it with an agent in CMD client 100, inside software component ZCMC_CLOUD. The business object is ZR_CMC_CoreAgreementItem; the behavior pool is ZBP_R_CMC_COREAGREEMENT; status values are OPEN and CLOSED.

Before the agent starts

  • Access restrictions: project CMD only; writable package: the core agreement package only.
  • Edit file tool enabled for this exercise; quick-fix tools with AI and feed tools deselected.
  • A transport request exists for the change, created by the developer, and the agent is told its number.
  • The prompt states the rule, the objects, the constraints and the definition of done.

What the loop looks like

The agent edits, activates, tests and checks in a loop; the developer reviews the diff and reruns the checks before trusting the result.
The Sign-Off Table · thesignofftable.com/academy/sap-aid-202

Expect iterations. Activation often fails the first time: a missing method declaration, a wrong field name. The agent reads the error and edits again. That's normal, and it's why the activation result, not the agent's confidence, is the signal. If the agent loops more than a few times on the same error, stop it and read the code yourself.

If the edit tool is off

The edit file tool controls edits made through the MCP server. It isn't the only way an agent can change source. SAP's agentic loop scenario shows the MCP host's own built-in edit tool writing the implementation into the source file opened in the editor, and agents that support VS Code's virtual file system can edit ABAP files that way. So switching the MCP edit tool off doesn't make an agent in VS Code read-only. To keep a session truly read-only, also restrict the host's own file-editing permissions, or use package restrictions so that any change attempt outside the pilot package fails. Know which edit path your agent uses before you rely on either control.

Tests and ATC

The agent adds a local test class in the behavior pool's test include. Good RAP tests isolate the database and the transactional buffer: SAP documents transactional buffer test doubles and mock EML APIs for exactly this. Check that the agent's tests cover both the CLOSED case (item rejected, message filled) and the OPEN case (item accepted), and that each would fail if the validation broke (see sap-abp-205).

ATC runs asynchronously through MCP: abap_run_atc starts a run and returns an ID, and abap_atc_get_result fetches findings. The agent may apply deterministic quick fixes (classic quick fixes SAP attaches to some findings) without Joule tokens. AI-based fixes use tokens and, at Contoso, are left off in this exercise. An ATC exemption is never the agent's call: abap_atc_exemption_request sends a request to an approver, and Contoso's rule is that only a person requests exemptions.

  1. ReadBehavior definition and pool; confirm current validations
  2. EditAdd validation to the BDEF; implement the method
  3. ActivateFix errors until activation succeeds
  4. TestTwo ABAP Unit tests with doubles: OPEN accepted, CLOSED rejected
  5. CheckATC with ZCMC_CLOUD_DEV; deterministic fixes only
  6. DiffUnified diff of the transport for review
  7. ReviewDeveloper reruns tests and ATC in ADT; second developer reviews
The definition of done is in the prompt, and the developer verifies every step outside the agent.
The Sign-Off Table · thesignofftable.com/academy/sap-aid-202

When to stop the agent

  • It edits an object outside the task, or asks to.
  • It repeats the same failing step more than three times.
  • It proposes to create a new transport when the prompt named one.
  • It reports success without showing test or ATC results.
  • It reads text (a comment, a message, a document) and starts following instructions in it.

Stopping isn't failure. It's the moment where a developer's judgment is worth most. Note what happened in the pilot log; patterns across sessions tell you which AGENTS.md rules or tool selections to change.

Review: the diff tells the truth

The unified diff tool, added in version 1.1, produces a git-like diff for all objects in a transport request. SAP's release blog suggests prompts such as "Explain transport XYZ" or "How much impact does transport XYZ have on the system?". For review, use it the other way round: read the diff yourself and check that the transport contains only what the task asked for. An agent that "helpfully" reformatted an unrelated method shows up here.

What would you do?

The agent reports: "Validation added, all tests pass, ATC clean." The developer opens the transport diff and sees an extra change: the agent also changed the determination <code>setInitialStatus</code> to set status OPEN on update. What should happen?

Key points
  • Set scope first: one system, one writable package, the transport named in the prompt.
  • Write the definition of done into the prompt: activate, test, ATC, diff.
  • Activation results and test results are the signals, not the agent's confidence.
  • ATC runs asynchronously; deterministic fixes only; exemptions are a human decision.
  • Review the unified diff yourself and rerun checks in ADT before release.

Check your understanding · not graded

Lesson check

  1. 1. How does the agent get ATC findings through MCP?

  2. 2. Which ATC tool should Contoso's agent not call on its own?

  3. 3. What is the best use of the unified diff tool during review?