POC

SAP FI-CA Payment Clarification Agent: A Step-by-Step POC

A local, fictional FI-CA-style payment clarification simulation: transparent matching rules, a separate review log, and tests that reject forged proposals.

Part 21 of 22 · AI Labs learning path · Next: From AI Demo to Enterprise POC: Access, Logging and Approval

In 30 seconds
What it is A local, fictional FI-CA-style payment clarification simulation: transparent matching rules, a separate review log, and tests that reject forged proposals.
You use it when You want to finish with this verified result: auditable clarification poc.

Lab 21: Auditable clarification POC. Requires Python + synthetic payments. Steps: Read evidence, Propose, Review, Log.

Overview: Read evidence → Propose → Review → Log → Auditable clarification POC. The infographic is a learning overview, not a screenshot of an executed result.

Level: Advanced · Hands-on time: approximately 90 minutes, excluding long downloads or account approval · Reading time: 7 minutes

Tools and prerequisites: Python 3.12+; complete examples folder; no SAP connection.

Cost: Offline rules and review log require no model spending. Optional agent extension uses API billing.

Payment clarification is a useful place to study evidence, proposals and human decisions. In SAP contract accounting (FI-CA), clarification processing addresses payments from a payment lot that could not be fully assigned; they are worked from a clarification worklist. Exact behavior depends on product edition, release and configuration; see the SAP references below.

This lab turns that business idea into a local, reproducible simulation. It uses four fictional cases and transparent rules. The finished result is a proposal per case and a separate review log. It neither reads SAP nor posts a payment.

You will end with a proposal for each of four fictional cases, a separate review log, and passing tests that reject a forged account and a post action.

Why it matters: the useful question is not “can AI clear payments?” but “what evidence supports a proposal, who decides, and what is recorded?” A rule baseline gives you something to measure any model against.

The SAP version: the same design, built in Joule Studio for FI-CA, is in Joule Studio for FI-CA: a payment-clarification agent.

1. State the POC’s boundary

Objective: make the experiment safe to interpret. Create payment-poc and copy the complete examples folder into it. This local path requires Python but no model account. Keep the API agent extension optional.

Write scope.txt:

Input: four synthetic payment cases.
Output: propose_assignment or request_review.
Authority: trusted rules validate evidence; a person records a decision.
Effect: simulation only. No SAP interface or posting exists.
Excluded: repayment execution, partial clearing, currency conversion,
real bank matching and customer-specific configuration.

Verify: the scope does not promise automated clearing. The architectural idea becomes a hands-on rule baseline here; the model-driven extension is taught separately in the agent lab.

2. Inspect the synthetic evidence

Objective: understand every expected result before running code. Save cases.json:

[
  {
    "id": "PAY-001",
    "amount_minor": 12500,
    "currency": "AED",
    "reference": "INV-100",
    "candidates": [
      {
        "account": "CA-100",
        "invoice": "INV-100",
        "amount_minor": 12500,
        "currency": "AED"
      }
    ]
  },
  {
    "id": "PAY-002",
    "amount_minor": 12500,
    "currency": "AED",
    "reference": "",
    "candidates": [
      {
        "account": "CA-100",
        "invoice": "INV-100",
        "amount_minor": 12500,
        "currency": "AED"
      },
      {
        "account": "CA-200",
        "invoice": "INV-200",
        "amount_minor": 12500,
        "currency": "AED"
      }
    ]
  },
  {
    "id": "PAY-003",
    "amount_minor": 12500,
    "currency": "AED",
    "reference": "INV-999",
    "candidates": []
  },
  {
    "id": "PAY-004",
    "amount_minor": 12500,
    "currency": "AED",
    "reference": "INV-400",
    "candidates": [
      {
        "account": "CA-400",
        "invoice": "INV-400",
        "amount_minor": 12500,
        "currency": "USD"
      }
    ]
  }
]

The amounts are integer minor units, avoiding binary floating-point comparisons. For this AED fixture, 12500 means AED 125.00. Currency scales must be modeled explicitly for other currencies.

PAY-001 is the only case with one exact nonempty invoice reference, amount and currency match. Matching an amount alone does not establish an assignment.

Verify: no case contains a customer name, bank account or production identifier. CA-100 and invoice labels are fictional.

3. Apply a closed set of proposal rules

Objective: keep assignment authority inspectable. Save payment_rules.py:

import json
from pathlib import Path

CASES = json.loads(Path(__file__).with_name("cases.json").read_text(encoding="utf-8"))

def get_case(case_id):
    return next((row for row in CASES if row["id"] == case_id), None)

def propose(case):
    matches = [row for row in case["candidates"]
               if case["reference"] and row["invoice"] == case["reference"]
               and row["amount_minor"] == case["amount_minor"]
               and row["currency"] == case["currency"]]
    if len(matches) == 1:
        return {"case_id": case["id"], "action": "propose_assignment",
                "account": matches[0]["account"],
                "evidence": ["exact_reference", "exact_amount", "same_currency"]}
    return {"case_id": case["id"], "action": "request_review", "account": None,
            "evidence": ["no_unique_exact_match"]}

def validate(proposal, case):
    # Recompute trusted rules: a model cannot grant itself posting authority.
    if proposal != propose(case):
        raise ValueError("Proposal differs from trusted evidence rules")
    return proposal

if __name__ == "__main__":
    for case in CASES:
        print(json.dumps(validate(propose(case), case)))

Run python payment_rules.py.

Expected result: PAY-001 proposes CA-100 with three evidence labels. PAY-002, PAY-003 and PAY-004 request review. A request for review is a correct outcome when the evidence cannot establish the unique match.

Troubleshooting: if all cases propose assignment, inspect whether the reference and currency checks were removed. If JSON parsing fails, use python -m json.tool cases.json before editing the rule.

4. Record a separate human decision

Objective: preserve the proposal while logging the review. Save the supplied controls.py, shown here in full:

import hashlib
import json
from datetime import datetime, timezone
from pathlib import Path
from payment_rules import get_case, validate

ALLOWED_ACTOR = "local-demo-reviewer"
def write_decision(proposal, approved, actor):
    if actor != ALLOWED_ACTOR:
        raise PermissionError("Unknown demo reviewer")
    case = get_case(proposal["case_id"])
    if case is None:
        raise ValueError("Unknown case")
    validate(proposal, case)
    canonical = json.dumps(proposal, sort_keys=True, separators=(",", ":"))
    event = {"time": datetime.now(timezone.utc).isoformat(), "actor": actor,
             "proposal_sha256": hashlib.sha256(canonical.encode()).hexdigest(),
             "proposal": proposal, "approved": bool(approved),
             "effect": "simulation_only_no_posting"}
    with Path("decisions.jsonl").open("a", encoding="utf-8") as handle:
        handle.write(json.dumps(event) + "\n")
    return event

if __name__ == "__main__":
    from payment_rules import propose
    event = write_decision(propose(get_case("PAY-001")), False, ALLOWED_ACTOR)
    print(json.dumps(event, indent=2))

Run python controls.py. It records a rejected simulated decision for PAY-001. Inspect decisions.jsonl in the editor. The hash identifies the proposal content; the local file is not tamper-proof, and the demo actor name is not authenticated identity.

To record an approval deliberately in this disposable lab, use:

python -c "from payment_rules import get_case,propose; from controls import write_decision; print(write_decision(propose(get_case('PAY-001')), True, 'local-demo-reviewer'))"

Verify: the new entry says approved: true but still simulation_only_no_posting. Approval of the lab record is not financial posting authority.

5. Try a forged proposal

Objective: prove that evidence is rechecked. Run the supplied test_controls.py:

python -m unittest test_controls.py -v

The tests cover reference/currency behavior, a forged account, an unknown actor and an attempted post action. The expected result is four passing tests. A passing test means the prohibited case was rejected as expected.

Checkpoint: do not add a posting function to make the demo feel complete. Its result is a reviewable proposal, not an accounting transaction.

6. Decide whether AI adds value

Objective: place the model where its contribution can be measured. Exact matching is a strong deterministic baseline. AI may help summarize messy evidence, explain a case or classify ambiguous notes; it should be compared against the baseline rather than inserted for appearance.

Use the separate agent lab to request get_case, generate a schema-constrained proposal and revalidate it with these rules. Evaluate explanation correctness, reviewer handling time and unsafe proposal rate. Do not claim improved acceptance or faster handling until measured on representative cases.

For a SAP-connected POC, identify released interfaces and roles for the specific tenant and release with its owner. This library intentionally supplies no unverified SAP API name or universal posting command.

Checkpoint: you have synthetic inputs, an explicit rule baseline, separate review decisions and observed rejection tests. That is a concrete foundation for a governed POC discussion.

Final verification checklist

  • Synthetic evidence was inspected.
  • Only PAY-001 proposes assignment.
  • Review decisions remain separate from proposals.
  • Forged account and post action are rejected.
  • No SAP connection or performance claim is implied.

Completed outcome: Auditable clarification POC. Keep your result and its verification record together.

FAQs

Is the offline baseline itself an AI agent?

No. It is a deterministic proposal simulation. The linked tool-calling agent is the model-driven extension.

Does approval post to SAP?

No. Every logged effect remains simulation-only. A real posting path needs separate authenticated authorization and integration design.

Sources and research notes

Research checked on 21 October 2026. Official documentation supports the tool behavior and requirements; the fictional fixtures, walkthrough, checks and teaching sequence are original examples. Account access, plans and interface labels can change. See the library validation report for what was executed locally and what still requires a live-service run.

Recap

Four fictional cases, one closed rule set, a separate human decision log, and tests proving that forged or posting proposals are rejected. Nothing here reads or writes SAP.

Next lab

Run all four cases and keep the review log for From AI Demo to Enterprise POC.

Frequently asked questions

Is the offline baseline itself an AI agent?

No. It is a deterministic proposal simulation. The linked tool-calling agent is the model-driven extension.

Does approval post to SAP?

No. Every logged effect remains simulation-only. A real posting path needs separate authenticated authorization and integration design.

Continue your trail

Knowledge completion

You now have the Architecture context.

Save this guide, continue to the next concept or return to the Knowledge Library with your context intact.

Knowledge Area

Architecture

7 resources in this area.

Agents 1 Auditable clarification POC 1 Cited practice assistant 1 Controlled proposal 1 Measured baseline 1 Read-only tool call 1 Reviewable POC controls 1
Sachin H. Patil
Sachin H. Patil
SAP + AI · Architecture

Practical SAP notes, structured for review, reuse and long-term maintenance.

View profile →
Knowledge, not noise
Get the next FI-CA / Utilities deep dive in your inbox.

Spotted something out of date, or have a question about this topic? Corrections and questions are always welcome.

Send a note →
Pinch or tap Zoom to read the detail
HomeKnowledgeInsightsAI LabToolsProfile