Scaffold an ABAP AI SDK (ISLM) class
scaffold_abap_ai_sdkGenerate a validated global ABAP class that calls the SAP Generative AI Hub via the ABAP AI SDK, with correct ISLM API shapes instead of guessed class names.
Instructions
Generate one validated global ABAP class that calls the SAP Generative AI Hub through the ABAP AI SDK powered by Intelligent Scenario Lifecycle Management (ISLM) — SAP's own client library, not a third-party SDK with a similar name. Seven interaction shapes: "string" (single prompt via EXECUTE_FOR_STRING), "messages" (system/user/assistant turns plus token-count/finish-reason retrieval), "prompt-template" (CL_AIC_ISLM_PROMPT_TPL_FACTORY, never the non-existent CL_AIC_PROMPT_TEMPLATE), "function-calling" (the tool-call DO-loop, with the upstream SAP sample's undeclared-tool_calls bug fixed — the table is declared and populated before ADD_TOOL_RESULTS), "structured-output" (DEFINE_RESPONSE_FORMAT->JSON_SCHEMA->FROM_STRING), "streaming" (IF_AIC_ADT_COMPLETION_API delta loop), and "orchestration" (the separate Orchestration API, which does not yet support structured output, function calling or media input). Every generated class carries an injectable constructor seam (an OPTIONAL api parameter) so it can be unit-tested with cl_abap_testdouble instead of a live ISLM scenario; pass withUnitTest for a FOR TESTING skeleton using that seam. Generated files are round-tripped through abaplint (version Cloud, preset syntax-only) together with abap-mcp's own bundled stub declarations of the referenced IF_AIC_*/CL_AIC_*/CX_AIC_* types, labelled validated:"abaplint-syntax" — this proves the ABAP parses, not that it matches SAP's real API surface exactly. Use this when you are adding a Generative-AI-Hub call to ABAP Cloud code and want correct, cited API shapes instead of guessing class/method names from memory (a common LLM hallucination surface — e.g. inventing CL_AIC_PROMPT_TEMPLATE, or copying SAP's own buggy function-calling sample verbatim). It does NOT call any LLM, does NOT deploy or activate anything, and does NOT create the SAP_COM_0A69 communication arrangement or the Intelligent Scenario (INTS/INTM) itself — those are manual ISLM/BTP-cockpit steps returned in setupSteps that this tool has no way to perform (no SAP system, no credentials, no network). Example: scaffold_abap_ai_sdk({ "scenarioName": "ZDEMO_AI_SCENARIO", "interaction": "string" }).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prefix | No | Customer namespace prefix for both scenarioName and className. | Z |
| className | No | Generated global class name, e.g. "ZCL_AI_TRAVEL_SUMMARY". Defaults to "<prefix>CL_AI_<INTERACTION>" when omitted; must start with the chosen prefix. | |
| functions | No | Tool/function definitions for interaction "function-calling"; ignored for every other interaction. A single illustrative demo function is generated when this is left empty. | |
| interaction | Yes | Which SAP AI SDK interaction shape to generate: "string", "messages", "prompt-template", "function-calling", "structured-output", "streaming", or "orchestration" — see the tool description for what each one calls. | |
| scenarioName | Yes | ISLM intelligent-scenario name the generated class calls via CREATE_INSTANCE( ), e.g. "ZDEMO_AI_SCENARIO". Must start with the chosen prefix; the scenario itself must already exist, be published, deployed and activated in the target system (see setupSteps) — this tool never creates it. | |
| withUnitTest | No | Also generate a FOR TESTING skeleton class reusing the injectable seam with cl_abap_testdouble; the skeleton asserts a TODO fail( ) until you replace it with real given/when/then logic. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | The generated class file, plus a testclasses file when withUnitTest is true. | |
| nextSteps | Yes | What to fill in or verify next, specific to the chosen interaction. | |
| scopeNote | Yes | Exactly what this tool does and does not do — no LLM calls, no scenario creation, no deployment, no network access. | |
| validated | Yes | Top-level echo of the file-level label: syntax-checked against bundled stubs only, not SAP's real API surface. | |
| setupSteps | Yes | The manual AI Core / ISLM configuration this code depends on at runtime (extended service plan, SAP_COM_0A69, INTS/INTM, F4469/F4470 deploy+activate) — this tool performs none of it. | |
| constraints | Yes | Documented limits: temperature range, per-instance parameter persistence, catchable error codes via IF_AIC_API_ERROR, ABAP Cross Trace debugging, and — for interaction "orchestration" only — the three completion-API features it does not yet support. | |
| validationIssues | Yes | abaplint findings on the generated sources — empty on a clean round-trip. |