ERPClimb logoERPClimb
Prompts and structured output
SAP Business AI & Jouleintermediate 6 min read

Prompts and structured output

Free sample lesson · open to everyone

Key takeaway

A prompt is a versioned task contract, not a substitute for server validation. Specify required inputs, permitted scope, output shape and uncertainty behavior. Separate retrieved content from trusted instructions, and validate outputs before a consumer acts on them.

In this lessonShow sections

Visual overview

Prompts and structured outputDecision walkthrough: unexpected evidence means investigate before continuing. Specify: The task may discuss only allowed order DEMO301.; Generate: The test can be reproduced with DEMO-P7.; Validate: A different order ID fails semantic validation.; Handle: No unauthorized record is substituted or disclosed.ERPClimb.com · INTERMEDIATE · ORIGINAL TEACHING DIAGRAMPrompts and structured output11. SpecifyThe task may discuss only allowed order DEMO301.22. GenerateThe test can be reproduced with DEMO-P7.33. ValidateA different order ID fails semantic validation.44. HandleNo unauthorized record is substituted or disclosed.Decision walkthrough: unexpected evidence means investigate before continuingSynthetic evidence. Verify SAP product, edition, runtime and enabled capabilities.

The situation: a real project scenario

A fictional assistant returns a valid JSON object that names an order outside the permitted scope.

This is a realistic risk whenever a prompt's output schema is treated as the main safeguard: the response is syntactically perfect, so an automated pipeline that only checks "did it parse" would pass it straight through, even though the order ID it contains belongs to a different, unauthorized scope.

The fix tested here is adding a semantic validation step after generation that checks identifiers and authorization specifically, separate from the structural schema check that generation already passed.

Explanation

Tutorial outcome

A prompt is a versioned task contract, not a substitute for server validation. Specify required inputs, permitted scope, output shape and uncertainty behavior. Separate retrieved content from trusted instructions, and validate outputs before a consumer acts on them.

Prerequisites

Complete chapters 1–6 in this module. Use synthetic fixtures or an authorized sandbox.

Worked case — fictional

A fictional assistant returns a valid JSON object that names an order outside the permitted scope.

Step-by-step investigation

1. Specify

Write the task boundary and required output fields using synthetic examples.

Expected evidence: The task may discuss only allowed order DEMO301.

2. Generate

Provide bounded evidence and record prompt/configuration versions.

Expected evidence: The test can be reproduced with DEMO-P7.

3. Validate

Check schema, identifiers, authorization and supported claims after generation.

Expected evidence: A different order ID fails semantic validation.

4. Handle

Return a useful failure or clarification rather than silently repairing sensitive identifiers.

Expected evidence: No unauthorized record is substituted or disclosed.

Try it yourself

Reproduce the synthetic input from the example below in a local fixture or authorized sandbox. Follow each step, record the observed result, and explain any mismatch before continuing. Do not treat the expected evidence as a result observed in your SAP tenant.

Acceptance check

A schema-valid but wrong business identifier cannot pass the acceptance gate.

Common failure to avoid

Do not equate valid JSON with valid business content or use prompt instructions as the only access control.

Self-check

Is schema-valid output sufficient for business use?

Expected reasoning: No; semantic correctness and authorization also require validation.

Edition and release scope

Check the linked SAP documentation for your product, runtime, region and enabled service plan. The worked case is a simulation; these steps were not executed in a customer SAP tenant.

SAP references

References checked 2026-10-30. SAP material supports the named concepts; the case, fixture and acceptance checks are original ERPClimb teaching material. No SAP tenant execution or certification is claimed.

[SAP Learning — Discovering the generative AI hub](https://learning.sap.com/courses/discovering-sap-s-generative-ai-hub) — Model access, prompt lifecycle and orchestration

Code example

Illustrative example
{"requiredOrderId":"DEMO301","response":{"orderId":"DEMO999"},"expected":"reject-semantic-mismatch"}
Guided workshop · intermediateERPClimb.com

Prompts and structured output: evidence walkthrough

Simulated training case. These observations are authored fixtures, not screenshots or results from a customer SAP system.

A fictional assistant returns a valid JSON object that names an order outside the permitted scope.

Before you start

  • Complete chapters 1–6 in this module. Use synthetic fixtures or an authorized sandbox.

Check the linked SAP documentation for your product, runtime, region and enabled service plan. The worked case is a simulation; these steps were not executed in a customer SAP tenant.

Step 1 of 4Paused · choose any step

Specify

Write the task boundary and required output fields using synthetic examples.

Expected evidence · simulated

The task may discuss only allowed order DEMO301.

Automatic playback is disabled by your reduced-motion preference. All steps remain available.

Try it, then verify

A schema-valid but wrong business identifier cannot pass the acceptance gate.

Watch for: Do not equate valid JSON with valid business content or use prompt instructions as the only access control.

Open the ERPClimb lesson diagram at full size
Check your understanding

Is schema-valid output sufficient for business use?

SAP references and release scope

References checked 2026-10-30. The linked SAP material supports the named concepts; the scenario, fixtures and acceptance checks are original ERPClimb teaching material. This is not an SAP certification or a tenant-execution claim.

Watch out

Common mistakes

Do not equate valid JSON with valid business content or use prompt instructions as the only access control. A response can pass schema validation — correct field names, correct types — while still naming a business record the user isn't authorized to see; schema validity and business/authorization correctness are different checks and both are required.

A related mistake is relying on the prompt text alone to keep the model within scope ("only discuss order DEMO301"), since that's an instruction, not an enforcement boundary, and a sufficiently different input can still produce an out-of-scope identifier.

Teams also sometimes "helpfully" repair or substitute a disallowed identifier with an allowed one rather than failing clearly, which can quietly disclose or confuse which record was actually involved.

Do this

Best practices

A schema-valid but wrong business identifier cannot pass the acceptance gate. Specify the task boundary, required output fields, and permitted scope explicitly using synthetic examples, and record prompt and configuration versions so tests are reproducible.

Validate schema, identifiers, and authorization as separate checks after generation, and return a clear failure or clarification request rather than silently repairing or substituting a disallowed value. Check the linked SAP documentation for your product, runtime, region and enabled service plan. The worked case is a simulation; these steps were not executed in a customer SAP tenant.

In the interview

Interview angle

Is schema-valid output sufficient for business use? A weak answer says yes if it parses correctly and has the right fields — that stops at syntax. A strong answer says no: semantic correctness and authorization also require independent validation, since a perfectly well-formed JSON object can still name a disallowed record. The strongest answers describe the right response to a failure too — return a clear failure or ask for clarification rather than silently substituting or repairing a sensitive identifier.

Practice this lesson

Original educational case studies for SAP consultants, not official SAP certification exam questions. Verify product edition and implementation details against the current SAP documentation.

Quick check

0 of 3 questions attempted

Question 1 of 3

Why request structured output (e.g. JSON with a schema) from an LLM in a business app?

Practise this in an interview

Answer in your own words and get instant feedback, the way an interviewer would judge it.

1How do you design prompts for an SAP business scenario so results are reliable?

2What is prompt injection and how do you protect an SAP AI scenario against it?

Was this lesson helpful?

Keep exploring

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.