【BAdI】如何从SAP中查找BADI (转)
(from http://blog.chinaunix.net/u/32493/showart_251899.html )
BADI作为SAP的第三代用户出口,他的应用也越来越广泛,但如何找到合适的badi是许多abap程序员的困惑。我这里就介绍一下我个人的应用的经验,供大家参考。
1、badi对象的信息存储在SXS_INTER, SXC_EXIT, SXC_CLASS 和SXC_ATTR 这四个表中(参见SECE包);
2、sap程序都会调用cl_exithandler=>get_instance来判断对象是否存在,并返回实例;其实get_instance就是对上述几个表和他们的视图(V_EXT_IMP 和 V_EXT_ACT)进行查询和搜索。 ------个人感觉SAP操作BADI_SPOT的时候会有BADI出现
3、基于这个机理,我查用ST05来监控一个TCODE来跟踪,然后选择查找有关上述几个表和视图的操作,就可获得相关BADI。
4、se18 查找接口,se19 实现接口就可以实现用户增强。
示例:用LE_SHP_DELIVERY_PROC控制跨月Cancel
METHOD IF_EX_LE_SHP_DELIVERY_PROC~CHANGE_DELIVERY_HEADER .
data : thismonth(2) type c.
data : wa_likp type line of SHP_LIKP_T.
data : wa_log type line of SHP_BADI_ERROR_LOG_T.
clear ct_log[],thismonth.
thismonth = sy-datum+4(2). "----->這一個月的月份
loop at it_xlikp into wa_likp.
check IS_V50AGL-WARENAUSG_STORNO ='X'."--->代表作GI cancel
if wa_likp-WADAT_IST+4(2) < thismonth.
wa_log-VBELN = cs_likp-vbeln.
wa_log-MSGTY = 'E'. "錯誤訊息
wa_log-MSGID = 'ZDN_ERROR'. "這一個class要自己建
wa_log-MSGNO = '001'.
append wa_log to ct_log. "Error log寫入
endif.
endloop.
ENDMETHOD.
HU_BADI | Business Add-Ins for Handling Units |
LE_SHP_BADI | Business Add-Ins in Shipping |
LE_TRA_BADI | Business Add-Ins in Transportation |
LE_WM_BADI | Business Add-Ins in Warehouse Management |
MRM_BADI | Business Add-Ins in Invoice Verification |
PL_PACKINST_BADI | Business Add-In in the Packing Instruction |
S_BADI_FORMULA_BUILDER | BADI Implementation with Formula Builder |
VA_BADI | BADIs R/3 Sales |
VF_BADI | BAdIs for Billing |
1 信用检查调用的函数
FUNCTION SD_ORDER_CREDIT_CHECK
2 信用释放的函数(相关TCODE: VKM1)
FUNCTION SD_ORDER_CREDIT_RELEASE
3 对信用检查重调用和可用性检查重调用的程序(V_V1)
程序 SDV03V01
4 用户可增强的接口
Credit Check
If you want to carry out your own individual credit checks, that differ from those in the standard system, you must define them in the following user exits:
- LVKMPTZZ
- LVKMPFZ1: USER_CREDIT_CHECK1
- LVKMPFZ2: USER_CREDIT_CHECK2
- LVKMPFZ3: USER_CREDIT_CHECK3
User exit for availability check
User exit USEREXIT_AVAIL_CHECK_CREDIT exists in Include MV45AFZF.
5 重要的结构和其他函数
S067-ofaku 未清开票凭证
s067-olikw 交货
s066-oeikw 订单
SD_CREDIT_EXPOSURE : 计算销售值
6 可以参照的函数调用单元 LVKMPF0G