本文整理自 SAP 官方发布与行业公开资料,聚焦生成式 AI 在企业中的落地路径,以及 SAP 生态提供的相关能力。
生成式人工智能(Generative AI)正在改变企业处理信息、编写代码、服务客户和优化流程的方式。对于长期运行在 SAP 系统上的企业而言,理解生成式 AI 的能力边界、落地方法和与 SAP 生态的集成路径,是制定数字化战略时不可回避的课题。
与传统的人工智能(通常用于分类、预测、异常检测等判别式任务)不同,生成式 AI 的核心能力在于:
**根据输入提示(Prompt)生成新的内容**,例如文本、代码、图像、音频、结构化数据等。
典型代表包括:
| 维度 | 判别式 AI | 生成式 AI |
|---|---|---|
| 核心任务 | 分类、预测、识别 | 生成新内容 |
| 典型应用 | 垃圾邮件识别、销量预测、缺陷检测 | 文案生成、代码补全、知识问答、图像生成 |
| 输出 | 标签或概率 | 文本、代码、图像、音频等 |
| 对数据的要求 | 通常需要大量标注数据 | 可利用无标注数据进行预训练,再少量微调 |
生成式 AI 在企业中的价值不仅在于“自动化写作”,更在于将分散的知识、流程和数据连接起来。常见应用场景包括:
在 SAP 领域,生成式 AI 可辅助 ABAP、CAP、JavaScript 等语言的开发,但生成的代码仍需经过人工审查和测试。
企业在引入生成式 AI 时,通常需要同时考虑以下六个要素:
| 要素 | 关键问题 |
|---|---|
| 业务场景 | 哪些流程能被 AI 显著改善?ROI 如何衡量? |
| 数据准备 | 企业内部知识是否完整、准确、可检索? |
| 模型选择 | 使用公有模型、私有部署模型,还是微调模型? |
| 平台与集成 | 如何与现有 SAP/非 SAP 系统连接? |
| 安全与治理 | 如何防止数据泄露、幻觉和合规风险? |
| 组织与人才 | 谁负责 Prompt 工程、模型运维和效果评估? |
SAP 将 AI 能力定位为 SAP Business AI,强调 AI 嵌入业务流程、基于业务上下文、并遵循负责任 AI 原则。SAP 相关能力主要构建在 SAP Business Technology Platform(BTP) 之上。
SAP Joule 是 SAP 推出的生成式 AI 助手,能够理解自然语言并与 SAP 应用交互。它旨在:
据 SAP 官方资料,Joule 已逐步嵌入 SAP BTP Cockpit、SAP S/4HANA Cloud 等解决方案中 SAP Business AI Q2 2024 Release Highlights。
SAP AI Core 是 SAP BTP 上的机器学习和生成式 AI 运行时服务,提供:
企业可以通过 BTP 的 Generative AI Hub 构建基于 RAG(检索增强生成)的应用,将 SAP 业务数据与大模型能力结合。
SAP 还提供一系列预训练的 AI 服务,例如:
这些服务可直接在 SAP BTP 上消费,并与 S/4HANA、SAP Ariba、SAP SuccessFactors 等集成 SAP Business AI Q4 2024 Release Highlights。
SAP 也在探索将生成式 AI 与 ABAP Cloud 结合,例如通过 AI 辅助生成 ABAP 业务对象,简化开发工作 SAP Business AI Q2 2024 Release Highlights。
需要注意的是,生成式 AI 当前更适合作为开发辅助工具,而非完全替代 ABAP 开发顾问。生成的代码必须经过审查、测试和性能评估。
企业在将生成式 AI 与 SAP S/4HANA 集成时,常见以下几种模式:
| 模式 | 说明 | 适用场景 |
|---|---|---|
| Side-by-side 扩展 | 在 SAP BTP 上构建 AI 应用,通过 OData/RFC 与 S/4HANA 交互 | 需要灵活前端和自然语言交互的场景 |
| Joule 嵌入式助手 | 利用 SAP Joule 在 SAP 应用内提供对话式体验 | 快速信息查询、事务导航、智能建议 |
| RAG 知识库 | 将 S/4HANA 数据、文档、操作手册向量化,供大模型检索 | 内部问答、操作指导、故障排查 |
| AI 服务直接消费 | 调用 SAP AI Services 处理文档、推荐属性等 | 发票处理、主数据维护、文档分类 |
| 代码辅助开发 | 在 ABAP/Cloud 开发中使用 AI 辅助生成和审查代码 | 提升开发效率、降低重复编码 |
企业可采用以下四步路线逐步落地生成式 AI:
| 风险 | 说明 | 治理建议 |
|---|---|---|
| 幻觉(Hallucination) | 模型生成看似合理但不准确的内容 | 结合 RAG、设置输出校验、人工复核 |
| 数据泄露 | 敏感数据被发送到外部模型 | 使用私有部署或 SAP BTP 等受控环境,实施数据脱敏 |
| 版权与合规 | 生成内容可能涉及版权或行业监管 | 建立使用政策,审计模型输出 |
| 依赖与锁定 | 过度依赖单一模型或供应商 | 设计可切换模型接口,保持架构灵活性 |
| 效果衰减 | 模型对业务场景适应性下降 | 定期评估、更新知识库、必要时微调 |
Q1:生成式 AI 能否直接修改 SAP 系统中的数据?
A:生成式 AI 本身不直接修改数据。它通常作为交互层或辅助层,通过调用 SAP 标准 API(如 OData、BAPI、RFC)执行业务操作,且应受严格的权限和审批控制。
Q2:SAP Joule 是否需要额外购买许可?
A:根据 SAP 官方问答,Joule 本身不需要额外付费许可,但需要通过特定 SKU 进行开通以完成系统配置 SAP MaxAttention Workshop。具体许可条款请以 SAP 官方最新说明为准。
Q3:企业应该自建模型还是使用 SAP BTP 的 Generative AI Hub?
A:取决于数据敏感性、合规要求和预算。对于通用场景,BTP Generative AI Hub 提供了 faster time-to-value;对于高度敏感或行业专用场景,可考虑私有部署或微调模型。
Q4:生成式 AI 在 SAP 开发中的最佳用途是什么?
A:目前最适合用于代码补全、注释生成、代码解释、单元测试草稿和文档编写。复杂业务逻辑、性能关键代码和核心财务流程仍需人工主导。
Q5:如何降低模型幻觉对企业的影响?
A:采用 RAG 将回答锚定在企业知识库上;设置置信度阈值;要求关键输出由业务专家复核;持续收集反馈并优化 Prompt。
| 资源 | 说明 |
|---|---|
| SAP Business AI Q2 2024 Release Highlights | SAP Business AI 在 IT 与平台领域的能力更新 |
| SAP Business AI für IT und Plattformen: Highlights des Q2 2024 Release | Joule、Generative AI Hub 与 SAP AI Core 介绍 |
| SAP Business AI Q4 2024 Release Highlights | Document Information Extraction 等 AI 服务更新 |
| SAP MaxAttention Workshop: Accelerate Business Transformation with AI and Data | Joule 许可与可用性的社区问答 |
| SAP Sapphire 2024: Gen AI Agents | SAP 与 Google Cloud 在生成式 AI Agent 方面的合作 |
本文基于 SAP 官方发布资料和行业公开信息整理,聚焦生成式 AI 的企业落地路径与 SAP 生态集成思路。文中涉及的 SAP 产品功能、许可条款和路线图可能随版本更新而变化,实施前请以 SAP 官方最新文档和合同条款为准。
以下内容整理自 SAP 官方 ABAP 速查表(主题:Generative AI),作为本文的扩展补充资料。
This ABAP cheat sheet provides references to detailed information on Generative AI in ABAP Cloud and explores released ABAP classes available in the ABAP AI SDK powered by Intelligent Scenario Lifecycle Management.
[!NOTE] - The ABAP AI SDK is integrated with the Intelligent Scenario Lifecycle Management (ISLM). Before using the ABAP AI SDK, administrative tasks outlined in the documentation have to be performed. - As a prerequisite to using the ABAP AI SDK, you have to create intelligent scenarios (ABAP repository objects containing various features to enable, for example, the instantiation of the completion API) and intelligent scenario models (defining, for example, which LLM is used). - The code snippets use the intelligent scenario nameZDEMO_ABAP_INT_SCEN. Assume that an example intelligent scenario model with the nameZDEMO_ABAP_INT_SCEN_MODELexists, which includes a prompt template ID namedZDEMO_PROMPT_TEMPLATE. - Disclaimer
Method calls that create an instance of the ISLM completion API, use a prompt as string, and retrieve the LLM answer:
TRY.
FINAL(ai_api) = cl_aic_islm_compl_api_factory=>get( )->create_instance( 'ZDEMO_ABAP_INT_SCEN' ).
FINAL(result) = ai_api->execute_for_string( `Tell me a joke.` ).
FINAL(completion) = result->get_completion( ).
CATCH cx_aic_api_factory cx_aic_completion_api INTO FINAL(error).
FINAL(error_text) = error->get_text( ).
ENDTRY.The following example class includes various calls exploring the APIs. Note that more methods are available, and that demo intelligent scenario and prompt template names are used in the example. Check the class and SAP Help Portal documentation. The example includes:
CLASS zcl_demo_abap DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS islm_scenario TYPE aic_islm_scenario_id=>type VALUE 'ZDEMO_ABAP_INT_SCEN'.
CONSTANTS prompt_template TYPE aic_islm_prompt_template_id=>type VALUE 'ZDEMO_PROMPT_TEMPLATE'.
DATA error TYPE REF TO cx_root.
DATA ai_api TYPE REF TO if_aic_completion_api.
DATA error_text TYPE string.
DATA llm_result TYPE REF TO if_aic_completion_api_result.
DATA llm_answer TYPE string.
ENDCLASS.
CLASS zcl_demo_abap IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
*&---------------------------------------------------------------------*
*& Creating an instance of the ISLM completion API
*&---------------------------------------------------------------------*
out->write( |1) Creating an instance of the ISLM completion API\n| ).
TRY.
ai_api = cl_aic_islm_compl_api_factory=>get( )->create_instance( islm_scenario ).
CATCH cx_aic_api_factory INTO error.
error_text = error->get_text( ).
out->write( error_text ).
ENDTRY.
IF error IS INITIAL.
out->write( `An instance of the ISLM completion API has been created.` ).
ELSE.
RETURN.
ENDIF.
out->write( |\n| ).
out->write( repeat( val = `_` occ = 70 ) ).
out->write( |\n| ).
*&---------------------------------------------------------------------*
*& Calling the LLM completion API with a prompt as string
*&---------------------------------------------------------------------*
out->write( |2) Calling the LLM completion API with a prompt as string \n\n| ).
TRY.
llm_result = ai_api->execute_for_string( `Tell me a joke.` ).
llm_answer = llm_result->get_completion( ).
out->write( data = llm_answer name = `llm_answer` ).
CATCH cx_aic_completion_api INTO error.
out->write( error->get_text( ) ).
ENDTRY.
out->write( |\n| ).
out->write( repeat( val = `_` occ = 70 ) ).
out->write( |\n| ).
*&---------------------------------------------------------------------*
*& Setting parameters
*&---------------------------------------------------------------------*
out->write( |3) Setting parameters \n\n| ).
TRY.
"Creating another instance of the ISLM completion API
ai_api = cl_aic_islm_compl_api_factory=>get( )->create_instance( islm_scenario ).
"Setting parameters such as maximum tokens or temperature
FINAL(params) = ai_api->get_parameter_setter( ).
params->set_maximum_tokens( 500 ).
params->set_temperature( '0.5' ). "The value must be between 0 and 1
llm_result = ai_api->execute_for_string( `What is ABAP?` ).
llm_answer = llm_result->get_completion( ).
out->write( data = llm_answer name = `llm_answer` ).
CATCH cx_aic_api_factory cx_aic_completion_api INTO error.
error_text = error->get_text( ).
out->write( error_text ).
ENDTRY.
out->write( |\n| ).
out->write( repeat( val = `_` occ = 70 ) ).
out->write( |\n| ).
*&---------------------------------------------------------------------*
*& Retrieving information regarding the result
*&---------------------------------------------------------------------*
out->write( |4) Retrieving information regarding the result \n\n| ).
TRY.
"Creating another instance of the ISLM completion API
ai_api = cl_aic_islm_compl_api_factory=>get( )->create_instance( islm_scenario ).
llm_result = ai_api->execute_for_string( `What is an internal table in ABAP?` ).
llm_answer = llm_result->get_completion( ).
"Number of tokens of the LLM output
FINAL(completion_token_count) = llm_result->get_completion_token_count( ).
"Number of tokens of the LLM input
FINAL(prompt_token_count) = llm_result->get_prompt_token_count( ).
"Number of tokens of the LLM input and output
FINAL(total_token_count) = llm_result->get_total_token_count( ).
"Runtime of LLM call in milliseconds
FINAL(runtime) = llm_result->get_runtime_ms( ).
out->write( data = llm_answer name = `llm_answer` ).
out->write( |\n| ).
out->write( data = completion_token_count name = `completion_token_count` ).
out->write( data = prompt_token_count name = `prompt_token_count` ).
out->write( data = total_token_count name = `total_token_count` ).
out->write( data = runtime name = `runtime` ).
CATCH cx_aic_api_factory cx_aic_completion_api INTO error.
error_text = error->get_text( ).
out->write( error_text ).
ENDTRY.
out->write( |\n| ).
out->write( repeat( val = `_` occ = 70 ) ).
out->write( |\n| ).
*&---------------------------------------------------------------------*
*& Calling the LLM completion API with a prompt as message list
*&---------------------------------------------------------------------*
out->write( |5) Calling the LLM completion API with a prompt as message list \n\n| ).
TRY.
"Creating another instance of the ISLM completion API
ai_api = cl_aic_islm_compl_api_factory=>get( )->create_instance( islm_scenario ).
"Creating a message container instance and adding messages
FINAL(message_container) = ai_api->create_message_container( ).
message_container->set_system_role( `You are a professional translator` ).
message_container->add_user_message( `Can you translate German into English?` ).
message_container->add_assistant_message( `Yes` ).
message_container->add_user_message( `Translate the following German sentence into English: "Entschuldigung, wie komme ich zum Bahnhof?"` ).
llm_answer = ai_api->execute_for_messages( message_container )->get_completion( ).
"Retrieving the messages added to the message container
FINAL(messages) = message_container->get_messages( ).
out->write( data = llm_answer name = `llm_answer` ).
out->write( |\n| ).
out->write( data = messages name = `messages` ).
CATCH cx_aic_api_factory cx_aic_completion_api INTO error.
error_text = error->get_text( ).
out->write( error_text ).
ENDTRY.
out->write( |\n| ).
out->write( repeat( val = `_` occ = 70 ) ).
out->write( |\n| ).
*&---------------------------------------------------------------------*
*& Calling the prompt library API to use prompt templates
*&---------------------------------------------------------------------*
out->write( |6) Calling the prompt library API to use prompt templates \n\n| ).
TRY.
"Creating another instance of the ISLM completion API
ai_api = cl_aic_islm_compl_api_factory=>get( )->create_instance( islm_scenario ).
FINAL(prompt_temp) = cl_aic_islm_prompt_tpl_factory=>get( )->create_instance( islm_scenario = islm_scenario
template_id = prompt_template ).
"Retrieving the prompt from the template
"Note that, depending on the prompt template setup, there may be input parameters
"('parameters' importing parameter) in the following method call to be assigned.
FINAL(prompt) = prompt_temp->get_prompt( ).
FINAL(msg_container) = ai_api->create_message_container( ).
msg_container->set_system_role( prompt ).
msg_container->add_user_message( `... some user message ...` ).
llm_answer = ai_api->execute_for_messages( msg_container )->get_completion( ).
out->write( data = llm_answer name = `llm_answer` ).
CATCH cx_aic_api_factory cx_aic_completion_api cx_aic_prompt_template INTO error.
error_text = error->get_text( ).
out->write( error_text ).
ENDTRY.
ENDMETHOD.
ENDCLASS.30_Generative_AI.md。版权归原作者所有。