用戶出口

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.

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章