User Exits和Customer Exits

article/2025/10/31 2:41:19

 

一、Extension of SAP functionality

SAP makes different possibilities available to extend SAP functionality in the R/3 without modifying the delivered R/3-Standard. Thus these extensions are further present also after a R/3-Release-Wechsel.

  • User exit
  • Field exit
  • Text extensions
  • Customer exit
  • Table extensions

1. User exit

User exits are original one in the selling module (SD) developed expandability.

They consist of empty subroutines (FORM) in special Includes, which can be filled by a ABAP Use developer. In special places in the SA P-CODE such subroutine references were inserted by SAP. An extension is thus only possible, where SAP planned it.

They usually offer a rather rudimentary expandability, since purely technically objects in the SAP name area are modified.

2. Field exit

Field exits are bypasses of a Dynprofield with data element purchase into a functional module. These will go through when leaving the Dynpros. There are global and local field exits.

v Global field exits
are not limited to a Dynpro. If a data element is used on several Dynpros, after activation of the field exit with all this Dynpros to a functional module one branches out.

v Local one field exit
work only on a Dynpro limited. There is the possibility of putting on bus to 36 local field exits to a data element.

3. Text extensions

With text extensions it acts around user keywords and user documentation (F1-Hilfe) to data elements. The new keywords can refer to SAP documentation and to user documentation. Thus one has also the possibility of overwriting the keywords delivered by SAP.

With text extensions the changes are global effective for all SAP applications concerned contrary to application extensions after activation.

4. Customer exit

An application function can be extended by application extensions by the customer. Customer exits must be intended by SAP. They consist generally of several components. The interface SAP/Kunde is clearly defined.

With a R/3-Release-Wechsel and/or. Upgrade remain the customer extensions without effort.

  • Function exit
  • Menu exit
  • Dynpro exit

A) Function exit

By functional module exits the customer can implement additional logic in an application function.

SAP built such exits in different places into many application functions. Thus are the interfaces are already given, and/or which data handed over.

These functional modules can be filled now by the customer. It can insert also user Dynpros with associated processing logic and GUI surface and put on user text elements.

B) Menu exit

Menu exits make it for the customer possible to build and occupy with a function code in an SAP application new menu entries.

SAP determined, where in the program additional function codes are queried and like to it is being reacted, either by a functional module exit or by an already firmly given functionality.

C) Dynpro exit

Dynpro exits permit the customer to arrange ranges of a dynpros reserved by SAP. Within these ranges large information can be indicated or data be seized. Those for this force fields by the customer on a user Dynpro are arranged.

 

 

 二、How to find user exits and Customer exits

 

1. How to find user exits

Using t-code: SE93 and specify the transaction code. from here goto the main program and click on the FIND button. Specify USEREXIT and select find in main program radio button and click search... if any user exit is used, it will list all the places as in SAP if any user exit is used, a comment is been written above the user exit.

 

2. How to find Customer exits

    1. 通过一些专门的程序. 网上找。

    2. Search string “call customer” in the main program source code;
    3. SE80 -> Repository Infomation System -> Enhancements -> Customer Exits -> Input search condition -> Execute
    4. SE11 -> Database table: MODSAPVIEW -> Display Contents -> Input "*program name*" into Enhancement field -> Execute -> 得到的SAP extension name 即为 Customer Exits Enhancement Name

 

三、An example of a user exits and Customer Exits

1. An example of a user exits

MODULE user_exit_0001 INPUT
CASE okcode.
WHEN 'BACK OR EXIT'.
CASE sy-dynnr.
WHEN '100'.
SET SCREEN 0.
LEAVE SCREEN.
WHEN '200'.
******************************************************************************
**** Note that you can write any code that satisfy your needs. ****
**** But in this case, this was wrote as a sample code for reference sake. ****
**** And you can test it. ****
******************************************************************************
SET SCREEN 100.
LEAVE SCREEN.
ENDCASE.
ENDCASE.

SAP User Exits Routine

User exits are routine which SAP allows you to add in additional customized programs process without affecting the standard SAP programs.

SAP user exit are usually declare as a form routine :-

form userexit_xxxxx
........................
endform

In VL01 - Create Delivery Order, standard program SAPMV50A, the standard program did not check for storage location equal to space, and delivery quantity less than one when the user click the save button. Therefore I have to insert the additional checking into the userexit routine.

Steps:-

  • Goto transaction VL01 to pick a Sales Order for delivery (you don't have to save the data)
  • In the initial screen, click System -> Status -> Double click on Program (Screen)
  • In the dialog program SAPMV50A, click Edit -> Search/replace
  • Type userexit in the Find field, then click the In program radio button and hit Enter
  • A number of userexit routines will be displayed. You'll have to roughly decide which is the correct userexit routine to used.

Another way of determining the list of user exits could be bus executing the Tcode SE80.

For example if U need to search for the user exits for the above mentioned program, execute the Tcode SE80 and enter the above program name, the following screen appears:

The highlighted row denotes a user exit, which is used in this program

form userexit_save_document_prepare.
case xlips-pstyv.
when 'TAX' or 'REX'.
* Accept this two Delivery item category

when 'REN'.
if xlips-lgort = space.
* Reject this Delivery item category
message e001.
endif.

when others.
if xlips-matnr <> space.
* Check storage location not space
if xlips-lgort = space.
message e002.
endif.
* Check delivery quantity not zero
if xlips-pikmg < 1.
message e003.
endif.
endif.
endcase.
endform.

                                                            Finding the user-exits of a SAP transaction code

*
* Finding the user-exits of a SAP transaction code
*
* Enter the transaction code in which you are looking for the user-exit
* and it will list you the list of user-exits in the transaction code.
* Also a drill down is possible which will help you to branch to SMOD.
*
* Written by : SAP Basis, ABAP Programming and Other IMG Stuff
*
report zuserexit no standard page heading.
tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.
         tables : tstct.
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
parameters : p_tcode like tstc-tcode obligatory.
select single * from tstc where tcode eq p_tcode.
if sy-subrc eq 0.
   select single * from tadir where pgmid = 'R3TR'
                    and object = 'PROG'
                    and obj_name = tstc-pgmna.
   move : tadir-devclass to v_devclass.
      if sy-subrc ne 0.
         select single * from trdir where name = tstc-pgmna.
         if trdir-subc eq 'F'.
            select single * from tfdir where pname = tstc-pgmna.
            select single * from enlfdir where funcname =
            tfdir-funcname.
            select single * from tadir where pgmid = 'R3TR'
                               and object = 'FUGR'
                               and obj_name eq enlfdir-area.
            move : tadir-devclass to v_devclass.
          endif.
       endif.
       select * from tadir into table jtab
                     where pgmid = 'R3TR'
                       and object = 'SMOD'
                       and devclass = v_devclass.
        select single * from tstct where sprsl eq sy-langu and
                                         tcode eq p_tcode.
        format color col_positive intensified off.
        write:/(19) 'Transaction Code - ',
             20(20) p_tcode,
             45(50) tstct-ttext.
                    skip.
        if not jtab[] is initial.
           write:/(95) sy-uline.
           format color col_heading intensified on.
           write:/1 sy-vline,
                  2 'Exit Name',
                 21 sy-vline ,
                 22 'Description',
                 95 sy-vline.
           write:/(95) sy-uline.
           loop at jtab.
              select single * from modsapt
                     where sprsl = sy-langu and
                            name = jtab-obj_name.
                   format color col_normal intensified off.
                   write:/1 sy-vline,
                          2 jtab-obj_name hotspot on,
                         21 sy-vline ,
                         22 modsapt-modtext,
                         95 sy-vline.
           endloop.
           write:/(95) sy-uline.
           describe table jtab.
           skip.
           format color col_total intensified on.
           write:/ 'No of Exits:' , sy-tfill.
        else.
           format color col_negative intensified on.
           write:/(95) 'No User Exit exists'.
        endif.
      else.
          format color col_negative intensified on.
          write:/(95) 'Transaction Code Does Not Exist'.
      endif.
at line-selection.
   get cursor field field1.
   check field1(4) eq 'JTAB'.
   set parameter id 'MON' field sy-lisel+1(10).
   call transaction 'SMOD' and skip first   screen.
*---End of Program

Validation Rules & Substitution User exits

Syntax:

=Uzzzz (zzzz = up to 4 characters - this is true for Document Level validations - call point 3 - *Header Level & Line Item Level - call points 1 & 2 - allow up to 30 charaters.)
/NORFB->Bus.transactions->Base parameters->Validation
/NORFB->Bus.transactions->Base parameters->Substitution

Example

=ULTE "FI_DOCU 001 "Parked SA,FY,SI=>long text CORRESP. "

=U&VALID_WBS_IN_ZUONR "FI_ITEM 011 Spon.Res: Check WBS valid in ZUONR"

* changed in 4.5B (* Form UFIA -- formerly U&VALID_WBS_IN_ZUONR)

User exits are form routines that the user programs. There are two types of user-exits:

1. Validation exits are used in the prerequisites and checks. They have either the value 'T' for true or 'F' for false. They are interpreted as a part of the logical statement, like a constant or field comparison. For this type of user exit, you must fill a parameter with the results of your check ('T' for true; 'F' for false).

Example

FORM Uzzzz USING B_RESULT. "'T' or 'F'
from program ZGGBR000 (ZGGBRI03)

2. Substitution exits are used to change one or more fields. However, you can only change those fields that are permitted in the Boolean class for the substitution. You can display these fields by selecting the following menu options in substitution maintenance: Fields for substitutions>

Example

FORM Uzzzz USING COST_CENTER.
from program ZGGBS000 (ZGGBSI02)
Substitution Fields can be found from this window

/NORFB->Bus.transactions->Base parameters->Substitution->Call Pnt 2->Substitution step 3->Extras->Substitution flds

The name of the form pool (e.g., ZGGBR000 & ZGGBS000) that contains your user exit must be stored in table T80D.

Note

1. Data declaration

Tables and field stings cannot be declared in form routines, so that the contents can be used along with the calling transaction.

2. Parameter definition

It is important that you make declare the code generation program for your user exit; how many and what type of parameters you are using for the user exit. You do this by entering your newly defined user exits in the form routine GET_EXIT_TITLES.
found in program ZGGBR000 (ZGGBRTIT)
found in program ZGGBS000 (ZGGBSTIT)
One exception is the parameter for the results of a validation exit. You must not declare this, it is automatically generated be the system. What types of parameters are available and how you use them is described in the online documentation. When creating your user exits, you can use the example form pools delivered by SAP (RGGBR000 for validations; RGBBS000 for substitutions) as a reference. We recommend that you copy the example form pools delivered by SAP when creating your own user exits. In these example form pools, entries already exist in the form routine GET_EXIT_TITLES for the examples delivered. The GET_EXIT_TITLES must absolutely exist in your form pool.

You can find additional information on the creation of user exits in the online documentation on validations and substitutions.

SAP exits

SAP exits are form rountines programmed by SAP. The name of the form pool is SAPFGBEB.

Syntax:

=Szzzz (zzzz = up to four characters)
FORM Szzzz using B_result. "'T' or 'F'

Example

=S01 "SAP exit S01"

Display description of T80D configuration

Return ->

Change Validation: FI_ITEM (Message view)

 

2. An example of a Customer Exits

 

The naming standard of function modules for functionmodule exits is: 
EXIT_<program name><3 digit suffix> 

The call to a functionmodule exit is implemented as:
CALL CUSTOMER.-FUNCTION <3 digit suffix>

Example:

The program for transaction VA01 Create salesorder is SAPMV45A

If you search for CALL CUSTOMER-FUNCTION i program
SAPMV45A you will find ( Among other user exits):

CALL CUSTOMER-FUNCTION '003'
  exporting
    xvbak   = vbak
    xvbuk   = vbuk
    xkomk   = tkomk
  importing
    lvf_subrc = lvf_subrc
  tables
    xvbfa = xvbfa
    xvbap = xvbap
    xvbup = xvbup.

The exit calls function module EXIT_SAPMV45A_003

Using Project management of SAP Enhancements, we want to create a project to enahance trasnaction VA01 .

- Go to transaction CMOD
- Create a project called ZVA01
- Choose the Enhancement assign radio button and press the Change button

In the first column enter V45A0002 Predefine sold-to party in sales document. 

Note that an enhancement can only be used in 1 project. If the enhancement is already in use, and error message will be displayed

Press Save

Press Components. You can now see that enhancement uses user exit EXIT_SAPMV45A_002. Double click on the exit.

Now the function module is displayed. Double click on include ZXVVAU04 in the function module

Insert the following code into the include: E_KUNNR = '2155'.

Activate the include program. Go back to CMOD and activate the project. 

Goto transaction VA01 and craete a salesorder. 

Note that Sold-to-party now automatically is "2155"

 

 

 

四、User Exits和Customer Exits区别

1.
USER EXITS are FORMS and are called by SAP standard programs
using PERFORM.	
CUSTOMER EXITS are FUNCTIONS so they are called using CALL
FUNCTION (or more exactly CALL CUSTOMER FUNCTION).
2.
Inside the form (user exit) you can read and change almost
any global data from host program.	
Inside a function (customer exit) you can only acces your
import/export/changing/tables parameters.
3.
User exits are more flexible because you have more
information to use in your code but on the other hand , it
is very easy to manipulate erroneously global data and lead
the standard program to a dump or even to make database
inconsistent.
Customer exits are more restrictive but you are sure any
change you can make to any parameters will never lead to
inconsistency
4.
User-exit doesn’t have any classification.	
In customer-exit we have function-module exit , screen exit
, menu exit.
5.
User exits are Basically designed For SD module.	
Costomer exits Are available for MM,SD,FI,HR…..Basically
designed for all modules.

 

1. USER EXITS 是以 FORM的形式存在,所以通过被SAP standard programs 通过 PERFORM调用.   CUSTOMER EXITS 以 FUNCTION module形式存在, 通过CALL CUSTOMER-FUNCTION语句调用.  

 2. 在user exit里你可以读写几乎所有的全局变量.    在customer exit里你只能访问import/export/changing/tables parameters.  

3. User exits 更加灵活(因为你可以获得更多的信息,例如所有的全局变量),但同时也很容易因为对数据的不合理处理导致系统级错误,甚至是数据库数据的一致性出现问题.

Customer exits 更具有限制性,但是你可以确性你的程序不会导致数据库一致性出现问题.  

4. User-exit 没有什么分类.     而customer-exit 可以分为function-module exit, screen exit, menu exit.  

5. User exits 基本上都是为SD模块设计的.       Customer exits被运用在MM, SD, FI, HR... 等几乎所有的模块当中.

 


http://chatgpt.dhexx.cn/article/x0Y1SUPd.shtml

相关文章

sql查询中使用in和exits比较和区别

首先&#xff0c;查询中涉及到的两个表&#xff0c;一个user和一个order表&#xff0c;具体表的内容如下&#xff1a; user表&#xff1a; order表&#xff1a; in 确定给定的值是否与子查询或列表中的值相匹配。in在查询的时候&#xff0c;首先查询子查询的表&#xff0c;然后…

SQL语句中exits和in的区别

一 表展示 查询中涉及到的两个表&#xff0c;一个user和一个order表&#xff0c;具体表的内容如下&#xff1a; user表&#xff1a; order表&#xff1a; 二 in 演示 确定给定的值是否与子查询或列表中的值相匹配。in在查询的时候&#xff0c;首先查询子查询的表&#xff0c…

E. Exits in Excess

题意&#xff1a; 移除最多一半的边使得图没有环。 将所有边分成两部分&#xff0c; 第一部分为 u < v u < v u<v&#xff0c; 第二部分为 v > u v > u v>u&#xff0c; 将小的边集合删去即可。 AC代码&#xff1a; int n, m; vector<int> v1, v2…

20220621 Dual Quaternion

文章目录 对偶数一、对偶数是什么&#xff1f;二、对偶矢量三、对偶四元数 对偶数 一、对偶数是什么&#xff1f; https://zhuanlan.zhihu.com/p/358146509 对偶数是一种特殊的自洽的运算&#xff0c;类似于常用的复数基本单位 i i i &#xff08; i 2 − 1 i^2-1 i2−1&a…

Quaternion

01:欧拉角 1.欧拉角Vector3(x,y,z)代表的是旋转物体&#xff08;若是标准旋转那么是旋转坐标轴x,y,z&#xff0c;转换为旋转物体则旋转角度取反顺序不变&#xff09;&#xff0c;且是将物体从物体坐标系旋转到惯性坐标系&#xff08;世界坐标系中为了渲染&#xff09;&#x…

Quaternion.Euler调整记录

Quaternion.Euler调整 1.运行unity 调整摄像头视角&#xff0c;找到需要的位置&#xff0c;记录下 摄像头的位置和旋转角度。 2.调整空物体的位置 使之位置与需要的位置一致 3.调整Quaternion.Euler 使Quaternion.Euler与旋转数值一致。

Quaternion(四元数)和旋转以及Yaw, pitch, roll 的含义

原文&#xff1a; http://www.linuxgraphics.cn/graphics/opengl_quaternion.html Quaternion(四元数)和旋转 本文介绍了四元数以及如何在OpenGL中使用四元数表示旋转。 Quaternion 的定义 四元数一般定义如下&#xff1a; qwxiyjzk其中 w,x,y,z是实数。同时&#xff0c;有…

Unity3d开发之对Quaternion的使用

上周找到了新公司。这周二来上班。可怕的是我刚去的第二天下午四点领导通知我做一个VRdemo&#xff0c;要求第二天交。我勒个擦。我现在对设备还没熟悉呢。连sdk都没下载而且距离上一次开发vr是在快两年之前了。属实让我措手不及。没错&#xff0c;按剧本走&#xff0c;加班到凌…

【Unity编程】四元数(Quaternion)与欧拉角

欧拉旋转、四元数、矩阵旋转之间的差异 除了欧拉旋转以外&#xff0c;还有两种表示旋转的方式&#xff1a;矩阵旋转和四元数旋转。接下来我们比较它们的优缺点。 欧拉角 优点&#xff1a;三个角度组成&#xff0c;直观&#xff0c;容易理解。优点&#xff1a;可以进行从一个方…

Quaternion类

Euler public static Quaternion Euler(float x, float y, float z); public static Quaternion Euler(Vector3 euler); 功能: 返回Quaternion对应的欧拉角 例子&#xff1a; public class ExampleClass : MonoBehaviour {public Quaternion rotation Quaternion.Euler(0, 30,…

Unity Quaternion

Quaternion 类的属性 eulerAngles 欧拉角 Quaternion 类的实例方法 1、SetFromToRotion 函数 2、SetLookRotation 函数 3、ToAngleAxis 函数 Quaternion 类的静态方法 1、Angle方法 2、Dot方法 3、Euler方法 4、FromToRotation方法 5、Inverse方法 6、Lerp方法 7…

【第018问 Unity中对Quaternion.AngleAxis的理解?】

一、背景 在游戏研发过程中&#xff0c;有时候会对一个物体经过多次围绕不同的轴进行不同角度的旋转&#xff0c;从而计算得到一个方向&#xff0c;以此来检测在该对应的方向上是否有对应的物体或别的对象&#xff0c;因此本节对Quaternion.AngleAxis进行简单的记录&#xff1…

Unity API详解——Quaternion类

Quaternion类又称四元数&#xff0c;由x、y、z和w这4个分量组成&#xff0c;属于struct类型。在Unity中&#xff0c;用Quaternion来存储和表示对象的旋转角度。Quaternion的变换比较复杂&#xff0c;对于GameObject一般的旋转及移动&#xff0c;可以用Transform中的相关方法实现…

Unity3D - 详解Quaternion类[转载]

一、简介 Quaternion又称四元数&#xff0c;由x,y,z和w这四个分量组成&#xff0c;是由爱尔兰数学家威廉卢云哈密顿在1843年发现的数学概念。四元数的乘法不符合交换律。从明确地角度而言&#xff0c;四元数是复数的不可交换延伸。如把四元数的集合考虑成多维实数空间的话&…

【Unity】Unity常用类:向量Vector3、四元数Quaternion

文章目录 Vector3构造函数静态变量变量运算符常用方法&#xff08;静态&#xff09;OrthoNormalize&#xff08;正交标准化&#xff09;Reflect&#xff08;反射&#xff09;Lerp&#xff08;线性插值&#xff09; Quaternion构造函数静态变量变量常用方法Eular&#xff08;欧拉…

unity学习笔记——Quaternion(四元数)

本篇文章转自https://www.cnblogs.com/driftingclouds/p/6626183.html Quaternion类 Quaternion&#xff08;四元数&#xff09;用于计算Unity旋转。它们计算紧凑高效&#xff0c;不受万向节锁的困扰&#xff0c;并且可以很方便快速地进行球面插值。 Unity内部使用四元数来表…

【Unity编程】Unity中关于四元数的API详解

Unity中关于四元数的API详解 Quaternion类 Quaternion&#xff08;四元数&#xff09;用于计算Unity旋转。它们计算紧凑高效&#xff0c;不受万向节锁的困扰&#xff0c;并且可以很方便快速地进行球面插值。 Unity内部使用四元数来表示所有的旋转。 Quaternion是基于复数&am…

四元数快速入门【Quaternion】

四元数&#xff08;Quaternion&#xff09;是用于旋转和拉伸向量的数学运算符。 本文提供了一个概述&#xff0c;以帮助理解在空间导航等应用程序中对四元数的需求。 推荐&#xff1a;用 NSDT场景设计器 快速搭建3D场景。 可以通过多种方式在空间中准确定位、移动和旋转物体。 …

四元数(Quaternion)食用指南

四元数&#xff08;Quaternion&#xff09;食用指南 “这简直就是黑魔法&#xff01;” 开发时&#xff0c;每次遇到旋转问题时总会心头一震&#xff0c;在欧拉角和四元数这两种处理方式的选择上犹豫不决&#xff0c;不知不觉就陷入了四元数的淤泥中…接下来&#xff0c;我决定…

Unity3D - 详解Quaternion类

一、简介 Quaternion又称四元数&#xff0c;由x,y,z和w这四个分量组成&#xff0c;是由爱尔兰数学家威廉卢云哈密顿在1843年发现的数学概念。四元数的乘法不符合交换律。从明确地角度而言&#xff0c;四元数是复数的不可交换延伸。如把四元数的集合考虑成多维实数空间的话&…