AI

Calling LLMs from ABAP: a practical intro to the ABAP AI SDK and ISLM

Boidra Expert3 min read

Generative AI on SAP BTP usually gets discussed in the context of Python, JavaScript or CAP. But if your business logic lives in ABAP, you do not have to leave the stack to call a large language model. The ABAP AI SDK lets you invoke models deployed in SAP AI Core directly from ABAP code, using Intelligent Scenario Lifecycle Management (ISLM) as the connective tissue.

This post covers the full path: what the SDK offers, which products support it, the prerequisites, and a working example that sends an ABAP variable to an LLM and reads the response.

What the ABAP AI SDK gives you

The SDK is built around three capabilities:

  • ISLM scenario creation - defining the intelligent scenario that represents your AI use case
  • ABAP code execution against ISLM - snippets that run a scenario and retrieve results
  • AI Core GenAI execution - the actual generative AI calls routed through AI Core

Supported products

The ABAP AI SDK is available on:

  • SAP S/4HANA Cloud Public Edition - as of release 2502
  • SAP S/4HANA Cloud Private Edition & On-Premise - as of release 2025, via standard delivery
  • SAP BTP ABAP Environment - as of release 2502

Prerequisites

Before writing any ABAP, you need the connection between your ABAP environment and AI Core in place:

  • An AI Core instance running in BTP
  • BTP ABAP Cloud with the business user role BR_ANALYTICS_SPECIALIST
  • A service key created with an x509 certificate, with the connection established via communication scenario SAP_COM_A069
  • A configured communication arrangement for SAP_COM_A069
AI Core communication arrangement SAP_COM_A069
Communication arrangement SAP_COM_A069

Intelligent Scenario Lifecycle Management (ISLM)

ISLM is the framework that manages the lifecycle of AI scenarios inside the ABAP platform. For the SDK you will create two artifacts: a scenario and a model.

Reference: ISLM documentation

Create an ISLM Scenario

In ADT, run New → Other → Intelligent Scenario.

Create an ISLM Intelligent Scenario
New → Other → Intelligent Scenario in ADT
Field Value
ISLM Type Content Cell
Automate turnkey switch on Checked
Usage type CUSTOMER

Create an ISLM Model

In ADT, run New → Other → Intelligent Scenario Model.

Create an ISLM Intelligent Scenario Model
New → Other → Intelligent Scenario Model in ADT
Field Value
Executable Id azure-openai
LLM Name GPT-4o
LLM Version 2024-11-20

Setup checklist

At this point you should have:

  • A model deployed in SAP AI Launchpad (GPT-4o in this example)
GPT-4o model deployed in SAP AI Launchpad
GPT-4o deployed in the Generative AI Hub
  • Communication Arrangement SAP_COM_A069 configured - the connection from BTP ABAP Cloud to AI Core is established
Communication Arrangement SAP_COM_A069 configured
SAP_COM_A069 connection to AI Core established
  • Access to the BTP ABAP Cloud ISLM Launchpad
ISLM management in the BTP ABAP Cloud Launchpad
ISLM management launchpad

The ABAP AI SDK in action

With the scenario, model and connection ready, you can call the LLM from ABAP in two steps: create an ISLM instance, then run an orchestration call.

1. Create an ISLM instance in ABAP

CONSTANTS:
  c_islm_scenario TYPE aic_islm_scenario_id=>type VALUE 'ZSCENARIO'.
 
TRY.
    islm_instance = cl_aic_islm_compl_api_factory=>get( )->create_instance(
                      islm_scenario = c_islm_scenario ).
 
  CATCH cx_aic_api_factory.
    ASSERT 1 = 2.
ENDTRY.

2. Call orchestration

Here you attach a prompt template, bind an input parameter (in this case a chunk of ABAP source code), and execute, reading the completion straight from the response object.

" Add a prompt template
islm_instance->configure_templating( )->add_prompt_template(
  message_type = aic_prompt_message_type=>user_message
  template_id  = 'CLEAN_CODE_TEMPL1' ).
 
" Bind an input parameter
islm_instance->set_input_parameter(
  name  = 'abap_code'
  value = lv_abap_code ).
 
" Send to the LLM and get its response
FINAL(response) = islm_instance->execute( )->orchestration_result( )->completion( ).

That response now holds the model's completion, for example a cleaned-up version of the ABAP code you passed in.

Why this matters

Being able to call an LLM from ABAP means AI capabilities can live right next to your business logic: no separate microservice, no data leaving the ABAP tier before it is needed. Combined with ISLM's lifecycle management, prompt templates and orchestration, the ABAP AI SDK turns generative AI into a first-class ABAP building block.

If you are on a supported release, the biggest lift is the one-time setup of the SAP_COM_A069 connection. Once that is in place, calling a model is just a few lines of ABAP.

ShareXLinkedIn

Keep reading