Badi Enhancement 标志

Badi Enhancement

社区
likweitan
badi-enhancement

协助开发 BAdI(Business Add-In)、使用 ABAP 增强框架,并对增强技术进行 clean core 等级分类。涵盖新型 BAdI、回退类、基于筛选条件的 BAdI、增强点、增强实现、关键用户扩展、经典 BAdI、允许与不允许使用的增强技术,以及替换修改和隐式增强。用户询问 BAdI、BAdIs、Business Add-In、增强点、增强实现、增强框架、BAdI 筛选条件、BAdI 回退、BAdI 定义、BAdI 实现、关键用户扩展、自定义逻辑注入、增强点、隐式增强、显式增强、允许使用的增强技术、用户出口、客户出口、修改,或扩展 SAP 标准代码时使用。触发请求包括“创建 BAdI”“实现 BAdI”“增强点”“查找 BAdI”“BAdI 筛选条件”“回退类”“关键用户扩展”“扩展标准功能”“增强框架”“替换修改”“隐式增强”或“这个增强属于哪个等级”。

Add to TypingMind

概览

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

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

  • 兼容任何大语言模型

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

  • 1 个附带文件

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

  • 开源

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

安装

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

1

安装到 TypingMind

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

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/likweitan/abap-skills/tree/main/skills/badi-enhancement
  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/badi-enhancement .claude/skills/badi-enhancement
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

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

一旦请求与技能匹配,模型就会自动加载 Badi Enhancement。

兼容任何 AI 模型

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

  • 仅在需要时加载

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

  • 在聊天中切换模型

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

技能指令

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

BAdI & Enhancement Framework

Guide for using BAdIs (Business Add-Ins) and the ABAP enhancement framework to extend SAP standard functionality, with clean core level classification for each technique.

BAdIs are the only recommended enhancement technology under the clean core level concept. The ATC check SYCM_ALLOWED_ENH_TECHNOLOGY reports ENHO enhancements built on any other technology as a priority 1 (Level D) finding.

Workflow

  1. Determine the user's goal:

    • Finding an existing BAdI to implement
    • Creating a custom BAdI definition
    • Implementing a BAdI
    • Replacing a modification or implicit enhancement with a BAdI
    • Understanding classic vs. new enhancement framework
    • Using key user extensibility
    • Classifying an enhancement's clean core level
  2. Identify the framework:

    • New BAdI framework (preferred, ABAP Cloud compatible)
    • Classic BAdI framework (legacy, SE18/SE19)
    • Enhancement spots and implementations
    • Key user extensibility (no-code)
  3. Classify the clean core level using the table below

  4. Guide implementation toward the highest applicable level

Clean Core Level by Enhancement Technique

TechniqueLevelGuidance
Key user extensibilityAStart here for tightly coupled extensions — custom fields, custom logic, custom CDS views
Released BAdIAPreferred code-based extension point
Released extension includeAPreferred technique for custom fields on DB tables and CDS views
Released extension point / RAP BOAUse for extending RAP-based SAP Fiori apps
CDS extends / metadata extensionsA/BExtend SAP CDS views rather than modifying them
Non-released BAdIBGood choice for classic extensions even when not released for cloud development. Monitor for release
User exits (VOFM, SAPMV45A)BPredefined SAP coding parts are stable and typically survive upgrades. Technically a modification
Customer exits (SMOD/CMOD)BPredecessor of BAdIs. Use only where no BAdI exists — likely to be replaced in future releases
Non-released extension includeBAcceptable; monitor when a released extension include becomes available
DDIC appends (CI / EEW includes)BAppend fields via customer includes or extension includes
Domain value appends, search help appends/exitsBAcceptable classic extension techniques
OData service redefinitionBRedefine rather than modify
Classic append on DB tableCMonitor when an extension include becomes available and adapt accordingly
Explicit enhancement spotsB/DExceptional cases only, to include a custom BAdI. Do not place extension code directly in the spot
Implicit enhancement spotsDSimilar to a modification — do not use
Source code plug-insDATC priority 1 finding — delete and use a BAdI
SAP-internal-flagged BAdIDExceptional cases only
ModificationsDAvoid completely. If unavoidable, use the modification assistant and govern via ATC

General rule: no modifications to SAP objects. Where a modification exists, check whether a released or classic BAdI can replace it.

ATC governance

ATC checkTechnical nameReports
Allowed enhancement technologiesSYCM_ALLOWED_ENH_TECHNOLOGYENHO enhancements on non-allowed technology — only BAdIs are recommended
Search customer modificationsCI_SEARCH_CUST_MODIFICATIONSModified objects (one finding per object); checks ABAP Cloud object type support

Both produce priority 1 (error) findings, corresponding to Level D. Implement SAP Note 3565942 if these checks are unavailable.

BAdI Framework Overview

New vs. Classic BAdIs

AspectNew BAdI FrameworkClassic BAdI Framework
TransactionsADT or SE18/SE19SE18/SE19
Enhancement SpotRequired containerNot applicable
Multiple UseAlways multiple-useConfigurable
FilterFilter types supportedFilter values
Fallback ClassSupportedNot available
ABAP CloudSupported (released BAdIs only)Not available
Clean core levelA if released, else BB (or D if SAP-internal-flagged)
RecommendationUse for all new developmentMaintain existing only

Creating a Custom BAdI

Step 1: Create Enhancement Spot

ADT: New → Other ABAP Repository Object → Enhancements → Enhancement Spot
Name: Z_ENH_SPOT_TRAVEL

Step 2: Define the BAdI Interface

abap
INTERFACE zif_badi_travel_validate
  PUBLIC.
  METHODS validate
    IMPORTING
      is_travel       TYPE zstravel
    CHANGING
      ct_messages     TYPE bapiret2_t
    RAISING
      cx_badi_not_implemented.
ENDINTERFACE.

Step 3: Define the BAdI in Enhancement Spot

In the enhancement spot, add a BAdI definition:

PropertyValue
BAdI NameZBADI_TRAVEL_VALIDATE
InterfaceZIF_BADI_TRAVEL_VALIDATE
Multiple UseYes (allows multiple implementations)
Fallback ClassZCL_BADI_TRAVEL_FALLBACK (optional)

Step 4: Create Fallback Class (Optional)

abap
CLASS zcl_badi_travel_fallback DEFINITION
  PUBLIC FINAL CREATE PUBLIC.
  PUBLIC SECTION.
    INTERFACES zif_badi_travel_validate.
ENDCLASS.

CLASS zcl_badi_travel_fallback IMPLEMENTATION.
  METHOD zif_badi_travel_validate~validate.
    "Default behavior when no implementation is active
  ENDMETHOD.
ENDCLASS.

Step 5: Call the BAdI in Your Code

abap
"Get BAdI handle
DATA lo_badi TYPE REF TO zif_badi_travel_validate.

GET BADI lo_badi.

"Call BAdI — loops through all active implementations
CALL BADI lo_badi->validate
  EXPORTING is_travel   = ls_travel
  CHANGING  ct_messages = lt_messages.

With Filters

abap
"Define BAdI with filter
"In Enhancement Spot: add filter type COUNTRY (type LAND1)

"Get BAdI with filter
GET BADI lo_badi
  FILTERS country = ls_travel-country.

CALL BADI lo_badi->validate
  EXPORTING is_travel   = ls_travel
  CHANGING  ct_messages = lt_messages.

Implementing an Existing BAdI

Step 1: Find the BAdI

Methods to find a BAdI:

  • ADT search: Search for BAdI name or enhancement spot
  • Transaction SE18: Browse BAdI definitions
  • Breakpoint on GET BADI: Set breakpoint at CL_BADI_INTERNAL_FACTORY=>GET_BADI to find BAdIs called during a process
  • Documentation: Check SAP documentation or community for BAdI names

Step 2: Create Enhancement Implementation

ADT: New → Other ABAP Repository Object → Enhancements → Enhancement Implementation
Name: Z_ENH_IMPL_TRAVEL_CHECK
Enhancement Spot: Z_ENH_SPOT_TRAVEL (or SAP's spot)

Step 3: Create BAdI Implementation Class

abap
CLASS zcl_badi_impl_travel_check DEFINITION
  PUBLIC FINAL CREATE PUBLIC.
  PUBLIC SECTION.
    INTERFACES zif_badi_travel_validate.
ENDCLASS.

CLASS zcl_badi_impl_travel_check IMPLEMENTATION.
  METHOD zif_badi_travel_validate~validate.
    "Custom validation logic
    IF is_travel-begin_date < cl_abap_context_info=>get_system_date( ).
      APPEND VALUE #(
        type       = 'E'
        id         = 'Z_TRAVEL'
        number     = '001'
        message_v1 = 'Travel begin date must be in the future'
      ) TO ct_messages.
    ENDIF.
  ENDMETHOD.
ENDCLASS.

BAdIs in ABAP Cloud / RAP

In ABAP for Cloud Development, BAdIs follow a specific pattern:

Released BAdIs — Level A

  • Only SAP-released BAdIs can be implemented in ABAP Cloud
  • Search for released BAdIs in ADT: api:badi
  • Common in RAP scenarios for extending standard RAP BOs
  • Verify release state programmatically:
abap
SELECT SINGLE *
  FROM i_apistateofrepositoryobject
  WHERE ObjectType   = 'SXSD'          "BAdI definition
    AND ObjectName   = 'MY_BADI'
    AND ReleaseState = 'RELEASED'
  INTO @DATA(ls_state).

RAP BAdI Pattern

abap
"BAdI for extending SAP Fiori apps / RAP BOs
"Implement the released BAdI interface
CLASS zcl_my_rap_badi DEFINITION
  PUBLIC FINAL CREATE PUBLIC.
  PUBLIC SECTION.
    INTERFACES if_some_released_badi.
ENDCLASS.

CLASS zcl_my_rap_badi IMPLEMENTATION.
  METHOD if_some_released_badi~some_method.
    "Custom logic
  ENDMETHOD.
ENDCLASS.

Dynamic BAdI Calls

abap
"Dynamic GET BADI with BAdI name in variable
DATA lo_badi TYPE REF TO cl_badi_base.
DATA(lv_badi_name) = 'ZBADI_MY_BADI'.

GET BADI lo_badi TYPE (lv_badi_name).

"Dynamic CALL BADI with method name in variable
CALL BADI lo_badi->('VALIDATE')
  EXPORTING is_data = ls_data.

Enhancement Spots and Implementations

Beyond BAdIs, the enhancement framework supports the techniques below. Note the clean core level of each — most are Level D and must be avoided.

Explicit Enhancement Points — Level B/D

SAP defines explicit points in standard code where custom logic can be inserted. These were mainly created to enable industry-specific adaptations.

Guidance: use only in exceptional cases, and only to include a custom-defined BAdI into the SAP core. Do not place extension code directly in the enhancement spot.

abap
"In SAP standard code:
ENHANCEMENT-POINT z_enh_point SPOTS z_enh_spot.

"In your enhancement implementation:
ENHANCEMENT z_my_enhancement.
  "Preferred: delegate to a custom BAdI rather than inlining logic
  DATA lo_badi TYPE REF TO zif_badi_my_logic.
  GET BADI lo_badi.
  CALL BADI lo_badi->process CHANGING cs_data = ls_data.
ENDENHANCEMENT.

Explicit Enhancement Sections — Level B/D

abap
"SAP code with replaceable section:
ENHANCEMENT-SECTION z_section SPOTS z_enh_spot.
  "Default code (can be replaced)
  lv_result = lv_a + lv_b.
END-ENHANCEMENT-SECTION.

"Your replacement:
ENHANCEMENT z_my_section_impl.
  "Custom replacement code
  lv_result = lv_a * lv_b.
ENDENHANCEMENT.

Implicit Enhancements — Level D, do not use

Implicit enhancement points (at the start/end of methods, forms, programs) are technically equivalent to modifications. SYCM_ALLOWED_ENH_TECHNOLOGY reports them as priority 1 (error) findings.

Remediation: delete the enhancement implementation and use a released or classic BAdI instead.

Modifications — Level D, avoid completely

If a modification cannot be prevented:

  • Use the modification assistant so post-upgrade adjustment stays manageable
  • Govern via the CI_SEARCH_CUST_MODIFICATIONS ATC check
  • Reset modifications from SAP Notes once the correction is part of the core

Remediation: check whether a released or classic BAdI can replace the modification.

User Exits and Customer Exits — Level B

  • User exits (VOFM, SAPMV45A): predefined SAP coding parts (form routines, includes) in an SAP namespace. Stable and typically survive upgrades, though technically treated as modifications. Monitor whether a released BAdI can replace them.
  • Customer exits (SMOD/CMOD): the predecessor technology to BAdIs. Usable in exceptional cases where no BAdI exists yet; most will be replaced in upcoming releases.

Structural Extension Techniques

Beyond business logic, these techniques extend SAP data structures and services:

DDIC — Level A/B/C

  • Released extension includes (EEW) → Level A, preferred
  • Customer includes (CI includes) on non-released structures/tables → Level B
  • Classic appends on DB tables → Level C; monitor for a released extension include
  • Domain value appends, search help appends, search help exits → Level B

CDS — Level A/B

  • Use CDS extends rather than modifying SAP CDS views
  • Use CDS metadata extensions for UI annotation changes

OData — Level B

  • Use redefinition of OData services rather than modification

Key User Extensibility — Level A

No-code/low-code extension capabilities available via SAP Fiori. This is the starting point for tightly coupled extensions.

CapabilityDescription
Custom FieldsAdd fields to standard business objects
Custom LogicAdd validation/determination logic via BRF+
Custom CDS ViewsCreate simple analytical views
Custom Business ObjectsCreate simple transactional objects
Custom Analytical QueriesBuild queries on existing CDS views

Finding extension points: use the extension registry (transaction SEEA / the extension point registry) to find every extension point registered in the system.

When a requirement is too complex for key user extensibility, move to developer extensibility (ABAP Cloud) — still Level A.

Replacing Level D Enhancements

Existing Level D techniqueReplacement
ModificationReleased BAdI → classic BAdI → key user extensibility
Implicit enhancementReleased BAdI → classic BAdI
Explicit enhancement with inline codeMove the code into a custom BAdI called from the enhancement
Source code plug-inReleased or classic BAdI
SAP-internal-flagged BAdI implementationFind an alternative released or classic extension point
SAP Note manual correctionReset the modification once the correction ships in the core

Remediation workflow:

  1. Run SYCM_ALLOWED_ENH_TECHNOLOGY and CI_SEARCH_CUST_MODIFICATIONS
  2. For each priority 1 finding, search for a released BAdI (api:badi in ADT)
  3. If no released BAdI exists, search for a classic BAdI (Level B)
  4. If neither exists, consider key user extensibility or a custom BAdI in an explicit enhancement spot
  5. Delete the Level D implementation and migrate the logic
  6. Re-run ATC to confirm the finding is resolved

Best Practices

  1. BAdIs are the only recommended enhancement technology — everything else is Level B at best
  2. Prefer released BAdIs (Level A) over non-released BAdIs (Level B)
  3. Prefer new BAdI framework over classic BAdIs
  4. Never use implicit enhancements or modifications (Level D)
  5. Start with key user extensibility (Level A) for tightly coupled extensions
  6. Use filters to scope implementations to specific contexts
  7. Implement fallback classes for default behavior
  8. Keep implementations focused — one concern per implementation
  9. Document the BAdI with clear interface documentation
  10. Test implementations independently using ABAP Unit
  11. In ABAP Cloud, only implement released BAdIs
  12. Govern with ATC — block transport release on priority 1 and 2 findings

Output Format

When helping with BAdI/enhancement topics, structure responses as:

markdown
## BAdI / Enhancement Guidance

### Framework

- Type: [New BAdI / Classic BAdI / Enhancement Spot / Key User]
- Clean core level: [A / B / C / D]
- Context: [ABAP Cloud / Classic ABAP]

### Implementation

[Step-by-step with code examples]

### Expected ATC Findings

- [Check name, priority, and level, if any]

### Testing

[How to verify the enhancement works]

References

Detailed Reference

  • BAdI patterns: Read references/badi-patterns.md for implementation patterns, filters, fallback classes, and testing

Related Skills

  • abap-cloud: Use for clean core level definitions and which BAdIs are released
  • abap-cloud-migration: Use for replacing Level D modifications and enhancements
  • atc-cloudification: Use for configuring SYCM_ALLOWED_ENH_TECHNOLOGY governance
  • rap: Use for implementing released RAP BAdIs for SAP Fiori apps
  • authorization-iam: Use for setting up authorizations for enhanced functionality

附带文件

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

常见问题

Badi Enhancement AI 技能有什么作用?

协助开发 BAdI(Business Add-In)、使用 ABAP 增强框架,并对增强技术进行 clean core 等级分类。涵盖新型 BAdI、回退类、基于筛选条件的 BAdI、增强点、增强实现、关键用户扩展、经典 BAdI、允许与不允许使用的增强技术,以及替换修改和隐式增强。用户询问 BAdI、BAdIs、Business Add-In、增强点、增强实现、增强框架、BAdI 筛选条件、BAdI 回退、BAdI 定义、BAdI 实现、关键用户扩展、自定义逻辑注入、增强点、隐式增强、显式增强、允许使用的增强技术、用户出口、客户出口、修改,或扩展 SAP 标准代码时使用。触发请求包括“创建 BAdI”“实现 BAdI”“增强点”“查找 BAdI”“BAdI 筛选条件”“回退类”“关键用户扩展”“扩展标准功能”“增强框架”“替换修改”“隐式增强”或“这个增强属于哪个等级”。

为什么在 TypingMind 中使用 Badi Enhancement?

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

如何在 TypingMind 中安装 Badi Enhancement?

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

哪些 AI 模型可以使用 Badi Enhancement?

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

Badi Enhancement 可以搭配多少个 AI 模型使用?

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

Badi Enhancement AI 技能免费吗?

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

什么是 AI 技能?

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

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

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

查看全部

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

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