Rap Business Events 标志

Rap Business Events

社区
likweitan
rap-business-events

协助处理 RAP 业务事件和企业事件,包括在行为定义中定义事件、从 RAP 处理程序方法中引发事件、事件绑定、SAP Event Mesh 集成、事件消费,以及 ABAP Cloud 中的事件驱动架构模式。用户询问 RAP 业务事件、企业事件、event mesh、事件机制、引发事件、事件绑定、事件定义、事件消费、事件驱动、异步处理、事件主题,或 ABAP 中的发布-订阅模式时使用。触发请求包括“RAP 事件”“业务事件”“引发事件”“event mesh”“事件绑定”“企业事件机制”“事件驱动”“发布事件”“消费事件”或“异步事件”。

Add to TypingMind

概览

发布者likweitan
代码仓库abap-skills
技能名称rap-business-events
星标数
64
复刻数
15
附带文件
1
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 1 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 likweitan 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Rap Business Events AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/likweitan/abap-skills/tree/main/skills/rap-business-events
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/likweitan/abap-skills.git /tmp/abap-skills
mkdir -p .claude/skills
cp -r /tmp/abap-skills/skills/rap-business-events .claude/skills/rap-business-events
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Rap Business Events,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Rap Business Events。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Rap Business Events 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

RAP Business Events & Enterprise Eventing

Guide for implementing event-driven patterns using RAP business events and SAP Event Mesh in ABAP Cloud.

Workflow

  1. Determine the user's goal:

    • Defining business events in a RAP BO
    • Raising events from RAP handler methods
    • Binding events for consumption
    • Consuming events from external systems
    • Integrating with SAP Event Mesh
    • Understanding event-driven architecture in ABAP
  2. Identify the scenario:

    • Local event (within the same ABAP system)
    • Enterprise event (cross-system via Event Mesh)
    • Event producer vs. event consumer
  3. Guide implementation following RAP eventing patterns

Business Events Overview

ConceptDescription
Business EventDeclared in BDEF; raised when something significant happens
Event DefinitionFormal declaration with parameters in the behavior definition
Event RaisingTriggered in handler/saver methods via RAISE ENTITY EVENT
Event BindingMaps RAP event to an enterprise event topic for external delivery
Event ConsumptionExternal systems subscribe and react to published events

Defining Business Events

In the Behavior Definition (BDL)

managed implementation in class zbp_r_travel unique;
strict ( 2 );

define behavior for ZR_Travel alias Travel
persistent table ztravel_tab
lock master
authorization master ( instance )
etag master LocalLastChangedAt
{
  create;
  update;
  delete;

  "Define business events
  event travel_created parameter ZD_TravelCreatedEvt;
  event travel_accepted;
  event travel_rejected;
}

Event Parameter Structure

Define a CDS abstract entity for the event payload:

cds
@EndUserText.label: 'Travel Created Event'
define abstract entity ZD_TravelCreatedEvt
{
  travel_id   : /dmo/travel_id;
  agency_id   : /dmo/agency_id;
  customer_id : /dmo/customer_id;
  description : /dmo/description;
  total_price : /dmo/total_price;
  currency    : /dmo/currency_code;
}

Events without the parameter addition have no payload.

Raising Business Events

In Handler Methods

abap
METHOD on_travel_accept.
  "Read travel data
  READ ENTITIES OF zr_travel IN LOCAL MODE
    ENTITY Travel
    ALL FIELDS
    WITH CORRESPONDING #( keys )
    RESULT DATA(lt_travels).

  "Update status
  MODIFY ENTITIES OF zr_travel IN LOCAL MODE
    ENTITY Travel
    UPDATE FIELDS ( status )
    WITH VALUE #( FOR travel IN lt_travels
      ( %tky   = travel-%tky
        status = 'A' ) )
    REPORTED DATA(lt_reported).

  "Raise event for each accepted travel
  RAISE ENTITY EVENT zr_travel~travel_accepted
    FROM VALUE #( FOR travel IN lt_travels
      ( %key = travel-%key ) ).
ENDMETHOD.

With Event Parameters

abap
METHOD on_travel_create.
  "After successful creation
  RAISE ENTITY EVENT zr_travel~travel_created
    FROM VALUE #( FOR travel IN lt_created_travels
      ( %key = travel-%key
        %param = VALUE #(
          travel_id   = travel-travel_id
          agency_id   = travel-agency_id
          customer_id = travel-customer_id
          description = travel-description
          total_price = travel-total_price
          currency    = travel-currency_code ) ) ).
ENDMETHOD.

In Saver Methods (Additional Save)

abap
METHOD save_modified.
  "Raise events in the save phase for committed data
  IF create-travel IS NOT INITIAL.
    RAISE ENTITY EVENT zr_travel~travel_created
      FROM VALUE #( FOR travel IN create-travel
        ( %key = travel-%key
          %param = VALUE #(
            travel_id = travel-travel_id ) ) ).
  ENDIF.
ENDMETHOD.

Event Processing Flow

1. User action triggers RAP operation
2. Handler method executes business logic
3. RAISE ENTITY EVENT queues the event
4. RAP framework commits the transaction
5. After successful COMMIT:
   a. Local event handlers are called
   b. Enterprise events are published to Event Mesh

Enterprise Event Enablement

Event Binding

To publish RAP events externally, create an event binding:

ADT: New → Other → Event Binding
Name: Z_EVT_BIND_TRAVEL

Event binding maps RAP events to enterprise event topics:

PropertyValue
Namespacesap.s4.beh or custom namespace
Business ObjectZR_Travel
Eventtravel_created
Topicsap/s4/beh/travel/created/v1

Event Topic Structure

<namespace>/<business-object>/<event-name>/<version>
Example: z.custom/travel/created/v1

Channel Binding for SAP Event Mesh

  1. Create a Communication Arrangement for scenario SAP_COM_0092 (Enterprise Event Enablement)
  2. Configure the Event Mesh service instance in BTP
  3. Maintain the channel in the Enterprise Event Enablement Fiori app
  4. Activate the event topic

Consuming Events

Local Event Consumption (Same System)

Register an event handler class:

abap
CLASS zcl_travel_event_handler DEFINITION
  PUBLIC FINAL CREATE PUBLIC.
  PUBLIC SECTION.
    "Event handler method
    METHODS on_travel_created
      FOR ENTITY EVENT
      travel_created FOR Travel~travel_created.
ENDCLASS.

CLASS zcl_travel_event_handler IMPLEMENTATION.
  METHOD on_travel_created.
    "React to travel creation
    LOOP AT travel_created INTO DATA(ls_event).
      "Process event data
      DATA(lv_travel_id) = ls_event-travel_id.
      "e.g., send notification, update related records
    ENDLOOP.
  ENDMETHOD.
ENDCLASS.

External Event Consumption (via Event Mesh)

External systems subscribe to topics via:

  • SAP Event Mesh webhooks
  • SAP Integration Suite
  • Custom applications using AMQP or REST APIs

Consuming Events from External Systems in ABAP

abap
"Using the event consumption model
"1. Create event consumption model in ADT
"   (imports AsyncAPI spec or defines events manually)

"2. Implement the event handler
CLASS zcl_ext_event_handler DEFINITION
  PUBLIC FINAL CREATE PUBLIC.
  PUBLIC SECTION.
    INTERFACES if_event_handler.
ENDCLASS.

CLASS zcl_ext_event_handler IMPLEMENTATION.
  METHOD if_event_handler~handle.
    "Parse event payload
    DATA(lv_payload) = io_event->get_text( ).
    "Process the event
  ENDMETHOD.
ENDCLASS.

Event Patterns

Fire and Forget

Producer raises event → Event Mesh delivers → Consumer processes independently
  • No response expected
  • Loose coupling between systems
  • Best for notifications, audit logging, data replication triggers

Event-Carried State Transfer

Include full entity data in event payload so consumers don't need to call back:

abap
RAISE ENTITY EVENT zr_travel~travel_created
  FROM VALUE #( ( %key = ls_travel-%key
                  %param = CORRESPONDING #( ls_travel ) ) ).

Event Sourcing

Record every state change as an event for full audit trail.

Best Practices

  1. Define events for business-meaningful state changes, not technical operations
  2. Include sufficient data in event parameters to avoid consumer callbacks
  3. Use CDS abstract entities for event parameter types (clear contract)
  4. Raise events after validation — only raise when the operation will succeed
  5. Handle event processing failures — consumers should be idempotent
  6. Use meaningful topic naming following SAP conventions
  7. Version event topics for backward compatibility (/v1, /v2)

Output Format

When helping with eventing topics, structure responses as:

markdown
## RAP Business Event Guidance

### Scenario

- Type: [Local event / Enterprise event]
- Role: [Producer / Consumer]

### Implementation

[Event definition, raising, and consumption code]

### Configuration

[Event binding and communication arrangement setup]

References

Related Skills

  • rap: Use for building RAP business objects that can raise events
  • btp-abap-environment: Use for setting up Event Mesh integration via communication arrangements
  • authorization-iam: Use for securing event handling and access control

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Rap Business Events AI 技能有什么作用?

协助处理 RAP 业务事件和企业事件,包括在行为定义中定义事件、从 RAP 处理程序方法中引发事件、事件绑定、SAP Event Mesh 集成、事件消费,以及 ABAP Cloud 中的事件驱动架构模式。用户询问 RAP 业务事件、企业事件、event mesh、事件机制、引发事件、事件绑定、事件定义、事件消费、事件驱动、异步处理、事件主题,或 ABAP 中的发布-订阅模式时使用。触发请求包括“RAP 事件”“业务事件”“引发事件”“event mesh”“事件绑定”“企业事件机制”“事件驱动”“发布事件”“消费事件”或“异步事件”。

为什么在 TypingMind 中使用 Rap Business Events?

因为您只需安装一次,就能搭配任何模型使用。Rap Business Events 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Rap Business Events?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/likweitan/abap-skills/tree/main/skills/rap-business-events。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Rap Business Events?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Rap Business Events 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Rap Business Events 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Rap Business Events AI 技能免费吗?

是的。likweitan 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇