生成式 AI 企业落地指南:应用场景、架构模式与 SAP 集成路径

作者:郑德鼎 约 10 分钟阅读 更新日期:2026-07-17 内容较新 标签:AI, 人工智能, 生成式 AI, SAP Business AI, Joule, BTP, 企业数字化
目录
本文整理自 SAP 官方发布与行业公开资料,聚焦生成式 AI 在企业中的落地路径,以及 SAP 生态提供的相关能力。

生成式人工智能(Generative AI)正在改变企业处理信息、编写代码、服务客户和优化流程的方式。对于长期运行在 SAP 系统上的企业而言,理解生成式 AI 的能力边界、落地方法和与 SAP 生态的集成路径,是制定数字化战略时不可回避的课题。


1. 什么是生成式 AI

与传统的人工智能(通常用于分类、预测、异常检测等判别式任务)不同,生成式 AI 的核心能力在于:

**根据输入提示(Prompt)生成新的内容**,例如文本、代码、图像、音频、结构化数据等。

典型代表包括:

1.1 生成式 AI 与判别式 AI 的对比


2. 企业级应用场景

维度判别式 AI生成式 AI
核心任务分类、预测、识别生成新内容
典型应用垃圾邮件识别、销量预测、缺陷检测文案生成、代码补全、知识问答、图像生成
输出标签或概率文本、代码、图像、音频等
对数据的要求通常需要大量标注数据可利用无标注数据进行预训练,再少量微调

生成式 AI 在企业中的价值不仅在于“自动化写作”,更在于将分散的知识、流程和数据连接起来。常见应用场景包括:

2.1 智能客服与内部问答

2.2 代码生成与辅助开发

在 SAP 领域,生成式 AI 可辅助 ABAP、CAP、JavaScript 等语言的开发,但生成的代码仍需经过人工审查和测试。

2.3 文档与内容处理

2.4 数据分析与报告生成

2.5 流程自动化与智能助手


3. 落地关键要素

企业在引入生成式 AI 时,通常需要同时考虑以下六个要素:

flowchart LR A[业务场景] --> B[数据准备] B --> C[模型选择] C --> D[平台与集成] D --> E[安全与治理] E --> F[组织与人才] F --> G[持续运营]

4. SAP 生态中的生成式 AI 能力

要素关键问题
业务场景哪些流程能被 AI 显著改善?ROI 如何衡量?
数据准备企业内部知识是否完整、准确、可检索?
模型选择使用公有模型、私有部署模型,还是微调模型?
平台与集成如何与现有 SAP/非 SAP 系统连接?
安全与治理如何防止数据泄露、幻觉和合规风险?
组织与人才谁负责 Prompt 工程、模型运维和效果评估?

SAP 将 AI 能力定位为 SAP Business AI,强调 AI 嵌入业务流程、基于业务上下文、并遵循负责任 AI 原则。SAP 相关能力主要构建在 SAP Business Technology Platform(BTP) 之上。

4.1 SAP Joule:自然语言智能助手

SAP Joule 是 SAP 推出的生成式 AI 助手,能够理解自然语言并与 SAP 应用交互。它旨在:

据 SAP 官方资料,Joule 已逐步嵌入 SAP BTP Cockpit、SAP S/4HANA Cloud 等解决方案中 SAP Business AI Q2 2024 Release Highlights。

4.2 SAP AI Core 与 Generative AI Hub

SAP AI Core 是 SAP BTP 上的机器学习和生成式 AI 运行时服务,提供:

企业可以通过 BTP 的 Generative AI Hub 构建基于 RAG(检索增强生成)的应用,将 SAP 业务数据与大模型能力结合。

4.3 SAP AI Services

SAP 还提供一系列预训练的 AI 服务,例如:

这些服务可直接在 SAP BTP 上消费,并与 S/4HANA、SAP Ariba、SAP SuccessFactors 等集成 SAP Business AI Q4 2024 Release Highlights。

4.4 ABAP 与生成式 AI 的结合

SAP 也在探索将生成式 AI 与 ABAP Cloud 结合,例如通过 AI 辅助生成 ABAP 业务对象,简化开发工作 SAP Business AI Q2 2024 Release Highlights。

需要注意的是,生成式 AI 当前更适合作为开发辅助工具,而非完全替代 ABAP 开发顾问。生成的代码必须经过审查、测试和性能评估。

5. 与 SAP S/4HANA 集成的典型模式

企业在将生成式 AI 与 SAP S/4HANA 集成时,常见以下几种模式:


6. 落地路线图建议

模式说明适用场景
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:

6.1 第一阶段:场景识别与试点

6.2 第二阶段:数据与知识库建设

6.3 第三阶段:模型与平台选型

6.4 第四阶段:规模化与治理


7. 常见风险与治理要点


8. 常见问题 FAQ

风险说明治理建议
幻觉(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。


9. 最佳实践

  1. **从低风险、高频场景开始**:例如内部问答、代码辅助、文档摘要,避免一开始就涉足关键财务决策。
  2. **始终将人工复核作为最后防线**:特别是涉及合规、财务、安全和客户承诺的输出。
  3. **设计可观测的 AI 应用**:记录输入、输出、模型版本和用户反馈,便于审计和持续优化。
  4. **保护企业数据**:避免将敏感业务数据发送到不受控的公共模型服务。
  5. **持续跟踪 SAP 官方更新**:SAP Business AI、Joule、AI Core 等产品迭代较快,应关注官方发布说明和社区资料。

10. 参考资源


来源说明

资源说明
SAP Business AI Q2 2024 Release HighlightsSAP Business AI 在 IT 与平台领域的能力更新
SAP Business AI für IT und Plattformen: Highlights des Q2 2024 ReleaseJoule、Generative AI Hub 与 SAP AI Core 介绍
SAP Business AI Q4 2024 Release HighlightsDocument Information Extraction 等 AI 服务更新
SAP MaxAttention Workshop: Accelerate Business Transformation with AI and DataJoule 许可与可用性的社区问答
SAP Sapphire 2024: Gen AI AgentsSAP 与 Google Cloud 在生成式 AI Agent 方面的合作

本文基于 SAP 官方发布资料和行业公开信息整理,聚焦生成式 AI 的企业落地路径与 SAP 生态集成思路。文中涉及的 SAP 产品功能、许可条款和路线图可能随版本更新而变化,实施前请以 SAP 官方最新文档和合同条款为准。

来源说明:本文由 SAP 技术资料改写整理,仅供学习交流。

ABAP Cheat Sheet 补充内容

以下内容整理自 SAP 官方 ABAP 速查表(主题:Generative AI),作为本文的扩展补充资料。

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.

Information and Documentation

⬆️ back to top

Using the ABAP AI SDK

[!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 name ZDEMO_ABAP_INT_SCEN. Assume that an example intelligent scenario model with the name ZDEMO_ABAP_INT_SCEN_MODEL exists, which includes a prompt template ID named ZDEMO_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.
来源说明:本节内容来源:SAP-samples/abap-cheat-sheets (GitHub),原作者 SAP。原 Markdown 文件:30_Generative_AI.md。版权归原作者所有。