Разница между пользовательским выходом и выходом клиента в SAP

⚡ Умное резюме

User Exits and Customer Exits in SAP ABAP are enhancement hooks that add custom functionality to standard programs without modifying SAP code. This page explains customer exit types, worked examples, the SMOD and CMOD transactions, user exits, and how the two techniques differ.

  • 🪝 Основное определение: A customer exit is a hook placed by SAP inside a standard program, screen, or menu on which a customer hangs custom logic.
  • 🧩 Three Exit Types: Function module exits add code, screen exits add fields through a subscreen, and menu exits add items to a pulldown menu.
  • 🔍 Locating Exits: Transaction SMOD lists the available exits, and SE81 browses them by application area.
  • 🇧🇷 Реализация: A project is created in CMOD, the exit is assigned to it, the code is written, and the project is activated.
  • 📦 User Exit: A user exit serves the same purpose but exists only in the SD module, with MV45AFZZ as the best known example.
  • Choosing a Technique: User exits are SD subroutines, customer exits are cross module and upgrade safe, and a BAdI is the object oriented successor to both.

User Exit and Customer Exit in SAP

What is Customer Exits?

Выходы клиентов есть «крючки» предоставляемые SAP во многих стандартных программах, экранах и меню, в которых клиенты могут "вешать" custom functionality to meet business requirements. More on this in a moment…

The key benefit is that the standard SAP object is never modified. The custom code sits in a reserved include or subscreen that SAP calls at the right moment, so the enhancement survives a system upgrade instead of being overwritten. Because of this, exits belong to the family of SAP enhancement techniques together with the newer Business Add-In.

Типы выходов клиентов

Существует три основных типа выхода клиентов:

  1. Выходы функционального модуля
  2. Выходы из экрана
  3. Выход из меню

Функциональный модуль Выход:It allows customer to add code via a function module at a specific location in an SAP прикладная программа

Syntax: CALL CUSTOMER-FUNCTION '004'

Экран Выход: It allows customer to add fields to a screen in an SAP программа через подэкран. Подэкран вызывается в рамках логики потока стандартного экрана.

Format: CALL CUSTOMER-SUBSCREEN CUSTSCR2

Меню Выход: It allows customer to add items to a pulldown menu in a standard SAP программа. Эти элементы можно использовать для вызова дополнительных программ или пользовательских экранов.

Format: +CUS ( additional item in GUI status )

Примеры выходов клиентов

Пример выхода из экрана:

В транзакцию CAT2 – Ввод табеля учета рабочего времени отдел кадров хочет включить интерактивное подтверждение того, что заведомо неверная подача данных является основанием для увольнения.

Примеры выходов клиентов

Пример выхода из меню:

В транзакцию SE38 — Редактор ABAP команда разработчиков хочет включить ссылку меню на транзакцию SE80 — Навигатор объектов для простоты использования.

ДО

Примеры выходов клиентов

ПОСЛЕ

Примеры выходов клиентов

Пример выхода из функционального модуля:

Компания хочет, чтобы банковские реквизиты Продавцов при создании Продавца были обязательным событием. Поэтому должно появиться сообщение об ошибке «Пожалуйста, введите банковские реквизиты».

ДО

Примеры выходов клиентов

ПОСЛЕ

Примеры выходов клиентов

Поиск выходов клиентов

В транзакции СМОД и рассмотреть детали-

Поиск выходов клиентов

Или в транзакции SE81 вы можете использовать соответствующую область применения

Поиск выходов клиентов

Создайте выход для клиентов

Чтобы создать выход клиента, сначала необходимо создать проект в транзакции. CMOD

Создайте выход для клиентов

Later вы назначаете Выход клиента своему проекту.

The full sequence from finding the exit to activating the code is short, and it always follows the same six steps.

  1. Find the enhancement: Locate the enhancement name in SMOD, for example the component EXIT_SAPMF02K_001 for the vendor master.
  2. Create the project: In CMOD, enter a project name that begins with Z or Y and choose Create.
  3. Assign the enhancement: On the Enhancement assignments screen, add the enhancement name that contains the exit.
  4. Напишите код: Open the function module exit and place the code inside its reserved include, which begins with ZX.
  5. Handle screen and menu parts: For a screen exit, build the CUSTSCR subscreen, and for a menu exit, fill the +CUS function code in the GUI status.
  6. Activate the project: Activate the project in CMOD so the exit is called at runtime. Without activation, the code is ignored.

💡 Совет: The include of a function module exit begins with ZX, so it is transported with the project. Never place the custom logic directly in the SAP function module, because that would be a modification, not an enhancement.

What is a User Exit?

Пользовательский выход служит той же цели, что и Клиентский выход, но доступен только для SD модуль. Выход реализован как вызов функционального модуля. Код написан разработчиком.

Хорошо знаю, что выход пользователя в SD МВ45AFZZ

  • USEREXIT_FIELD_MODIFICATION – для изменения атрибутов экрана.
  • USEREXIT_SAVE_DOCUMENT – для выполнения операций, когда пользователь нажимает «Сохранить».
  • USEREXIT_SAVE_DOCUMENT_PREPARE
  • USEREXIT_MOVE_FIELD_TO_VBAK – когда изменения заголовка пользователя перемещаются в рабочую область заголовка.
  • USEREXIT_MOVE_FIELD_TO_VBAP – когда изменения пользовательского элемента переносятся в SAP рабочая область элемента

A user exit is technically a subroutine (a FORM) inside an SAP include, so it is edited directly and requires an access key. This is the main practical difference from a customer exit, summarised in the next section.

User Exit vs Customer Exit

Both techniques add custom behaviour to standard SAP, but they differ in scope, technology, and how upgrade safe they are. The table below compares them.

Критерии Выход пользователя Выход клиента
Доступность только SD-модуль По всем SAP модули
Техника Subroutine (FORM) in an SAP include such as MV45AFZZ Function module, screen, or menu exit managed in SMOD and CMOD
Доступ к ключевым Requires a modification access key No access key needed
Upgrade поведение Must be checked in the upgrade with SPAU Upgrade safe, called from a reserved include
Управляемый Edited directly in the include Activated through a CMOD project

Customer exits are the safer and more general of the two. For enhancements that neither exit can reach, SAP later introduced the Business Add-In.

Customer Exits vs BAdI

A Business Add-In (BAdI) is the object oriented successor to the customer exit. Instead of a reserved include, a BAdI defines an interface, and the custom logic sits in a class that implements it. This brings two advantages that a customer exit does not offer.

  • Multiple implementations: A multiple use BAdI allows several independent implementations of the same enhancement, while a customer exit allows only one.
  • Object orientation: A BAdI works with methods and classes, so it fits modern ABAP Objects development and is easier to filter by country or business scenario.

The practical rule is simple: use an existing customer exit or user exit when the enhancement point already exists, and use a BAdI when a new, reusable enhancement point is required.

Часто задаваемые вопросы (FAQ)

SMOD displays the SAP enhancements and the components inside them. CMOD groups one or more enhancements into a customer project, assigns the code, and activates it. SMOD is for viewing, CMOD is for implementing.

No. A customer exit is an enhancement, not a modification, so no access key is needed. A user exit is edited directly in an SAP include and therefore does require a modification access key.

Run the transaction, open System then Status to read the program name, then search the enhancements of that program in SMOD or SE81. A common shortcut is to search table MODSAP for the program’s function group.

AI assistants in ABAP development tools read the program name and suggest the relevant enhancement, exit, or BAdI, and explain what each one changes. The developer still confirms the choice and writes the logic inside the reserved include.

AI advisors weigh whether an enhancement point already exists and how many implementations are needed, then usually recommend a BAdI or an enhancement spot for new work, keeping classic exits for points that only exist as exits.

Подведем итог этой публикации следующим образом: