用户出口

来源:互联网 发布:python 列表搜索 编辑:程序博客网 时间:2024/04/27 17:19

User Exits: 是系统中预留的一些空的Form/Subroutine, 获得Access key后可以在Form中写入自己的逻辑.

Customer exits: a. FM Exits: 在FM中include 保留的 Z 程序来提供功能扩展点.
                          b. Menu Exits: 在GUI status中预留+Fcode menu item, 在程序中预留对应的Handling FM Exits.
                          c. Screen Exits: 在Screen 中预留 Subscreen, 在程序中预留transport data to subscreen & return / retrieve data from subscreen 的 FM Exits.

Customer exits的调用方式为:
     a. FM Exits: CALL CUSTOMER-FUNCTION 'xxx' EXPORTING ... IMPORTING ...

FM exits在关联的Function Group中的命名规则为: EXIT_program name_nnn.
     b. Subscreen: Call CUSTOMER-SUBSCREEN INCLUDING.

User Exits与Customer Exits的区别在于User Exits的使用需要Access Key但Customer Exits不要.

 

Customer Exits and BADI implementation
1. Customer Exits: SMOD, CMOD
2. BADI: SE18, SE19.

 

Enhancement&Enhancement Project

a. Enhancement: 把系统程序中的相关Customer Exits收集起来成为一个Enhancement, 一般情况是按功能和类型来收集的, 比方说几个相关的FM eixts组成一个enhancement, 或就一个 screen 或 menu exits 形成一个enhancement.  查看/修改 Enhancement的t-code为: SMOD.
 b. Enhancement Project: 在使用Enhacement时, 要先建立一个Enhancement Project, 可以将多个Enhancement assign给一个enhancement project去管理, 对应t-code: CMOD.

 

BADI

通过面向对象的方式来提供扩展点,它支持Customer Exits所有的enhancement 类型,因目前Class中不能包含subscreen所以在用BADI enhance screen时比用Customer Exits要复杂些.
这里要提下的是非Multiple Case的BADI同时只能有一个Active Implementation, 即要Active新生成的需先inactive旧的. 若是Multiple Case的BADI则可同时有多个Active Implementation,且所有的Implementation在没有Filter的情况下都会被遍历执行.
badi对象的信息存储在SXS_INTER, SXC_EXIT, SXC_CLASS 和SXC_ATTR 这四个表中.sap程序都会调用cl_exithandler=>get_instance来判断对象是否存在,并返回实例;其实get_instance就是对上述几个表和他们的视图(V_EXT_IMP 和V_EXT_ACT)进行查询和搜索.
新定义的BADI:ZMD_MODIFY_PRODVERS不能被激活,一看,原来定义不是Multiple use的,其引用的BADI定义名为:

MD_MODIFY_PRODVERS,到表:SXC_EXIT一查,原来系统已经实现了一个实例IMPL_IPPE_MRP_PRODV,并且激活了,因为是非“Multiple use”的BADI,把IMPL_IPPE_MRP_PRODV取消激活,自己定义的这个就可以激活了。

    Multiple Usability for BADI Definitions

    Multiple use for BADI definitions means that there can be several active BADI implementations. When there is a call, they are all called up - however, in an unpredictable sequence.

    If you have multiple-use BADI definitions, the sequence must not play any role therefore. A typical example is the execution of checks before a save.

 

 

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.

 

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.

 

How to find BADIs

1. 通过一些专门的程序,见附件;
2. Search string “type ref to” in the main program source code, then check if there is BAdi used in the program;
3. Set break-point in the method CL_EXITHANDLER=>GET_INSTANCE;
4.  SE80 -> Repository Infomation System -> Enhancements -> Business Add-ins.