* 该程序可以检测出系统所有被激活的用户增强.
* By Stone Fu. on 2006/11/07 .
* Used to find out all the activated user-exit of SAP .
report zfindactexit .
tables: modsap,tfdir.
data : begin of itab_exit occurs 0,
funcname like tfdir-funcname,
mand like tfdir-mand,
name like modsap-name,
end of itab_exit .
data : field1(30).
_select a~funcname a~mand b~name
into table itab_exit
from tfdir as a
inner join modsap as b
on a~funcname = b~member
where a~mand = 'C'
and a~funcname = b~member .
format color col_heading intensified on.
write:/1 sy-vline,
2 'Enhancement Name',
21 sy-vline ,
22 'Activated Exit Function',
95 sy-vline.
write:/(95) sy-uline.
loop at itab_exit.
format color col_normal intensified off.
write:/1 sy-vline,
2 itab_exit-name hotspot on,
21 sy-vline ,
22 itab_exit-funcname,
95 sy-vline.
endloop.
at line-selection.
get cursor field field1.
set parameter id 'MON' field sy-lisel+1(10).
call transaction 'SMOD' and skip first screen.
|
*-----------------------------------------------------------------------
* User-Exit für Positionsfelder versorgen (PAI)
FORM
custscr1_item_set_data_pai USING im_no_screen LIKE fc_call.
"770427
DATA: l_ucomm LIKE sy-ucomm,
l_enj_call TYPE c.
STATICS: first_call(1) TYPE c VALUE 'X',
active LIKE sy-calld.
ENHANCEMENT-POINT CUSTSCR1_ITEM_SET_DATA_PAI_02 SPOTS ES_MM06EF0C_CUSTSCR1_I_SET_DAT INCLUDE BOUND .
*$*$-Start: CUSTSCR1_ITEM_SET_DATA_PAI_02-------------------------------------------------------$*$*
ENHANCEMENT 1 OI0_COMMON_MM06EF0C_ITEM_S_DAT. "active version
* C5030897 I.Twardowski Implementation of BADI for OGSD
PERFORM OI0_BADISCR1_ITEM_SET_DATA_PAI.
ENDENHANCEMENT.
*$*$-End: CUSTSCR1_ITEM_SET_DATA_PAI_02-------------------------------------------------------$*$*
IF NOT first_call IS INITIAL.
CLEAR first_call.
*
注释: MODX_FUNCTION_ACTIVE_CHECK
用来检查017
出口是否被激活,
如果激活则执行之.
CALL FUNCTION 'MODX_FUNCTION_ACTIVE_CHECK'
EXPORTING
cprogname = 'SAPMM06E'
funcnumber = '017'
IMPORTING
active = active
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF NOT sy-subrc IS INITIAL.
CLEAR active.
ENDIF.
ENDIF.
CHECK NOT active IS INITIAL.
IF fc_vorga EQ cva_en.
l_enj_call = 'X'.
ELSE.
l_enj_call = space.
ENDIF.
*-Define Data:
DATA: lt_usr_tekpo LIKE bekpo OCCURS 0,
lt_usr_teket LIKE beket OCCURS 0,
lt_usr_tekkn LIKE ekknu OCCURS 0,
lt_usr_tkomv LIKE tkomv OCCURS 0.
*-Copy Tables:
lt_usr_tekpo[] = pot[].
lt_usr_teket[] = ett[].
lt_usr_tekkn[] = knt[].
lt_usr_tkomv[] = tkomv[].
l_ucomm = ok-code.
*
注释:
调用出口的一般步骤是先定义数据(Define Data),
多为内表或工作区,
再将参数赋予这些内表(Copy Tables),
相当于*
建立了原始参数的一个镜象.
*-User Exit:
*
如果017
出口增强被激活则执行它.
CALL FUNCTION 'EXIT_SAPMM06E_017'
EXPORTING
i_ekpo = ekpo
i_ekpo_old = *ekpo
i_ekko = ekko
i_aktyp = aktyp
i_bstyp = ekko-bstyp
i_no_screen = im_no_screen "770427
i_lfa1 = lfa1
i_lfm1 = lfm1
i_rekpo = rekpo
i_kekpo = kekpo
i_aekpo = aekpo
i_reban = reban
i_mt06e
= mt06e
i_eina = *eina
i_eine = *eine
i_komp = komp
i_ucomm = l_ucomm
i_enj_call = l_enj_call
TABLES
tekpo = lt_usr_tekpo
teket = lt_usr_teket
tekkn = lt_usr_tekkn
tkomv = lt_usr_tkomv
EXCEPTIONS
OTHERS = 0.
ENDFORM. "CUSTSCR1_ITEM_SET_DATA_PAI
|
*增强 ZXM06U42的示例代码
*By Stone.Fu 2007/01/02
*"*"Lokale Schnittstelle:
*IMPORTING/TABLES
是输入的单个参数和输入的内表参数
*" IMPORTING
*" VALUE(I_EKPO) LIKE EKPO STRUCTURE EKPO
*" VALUE(I_AKTYP)
*" VALUE(I_BSTYP) LIKE EKKO-BSTYP
*" VALUE(I_NO_SCREEN)
*" VALUE(I_LFA1) LIKE LFA1 STRUCTURE LFA1
*" VALUE(I_LFM1) LIKE LFM1 STRUCTURE LFM1
*" VALUE(I_EKKO) LIKE EKKO STRUCTURE EKKO
*" VALUE(I_REKPO) LIKE EKPO STRUCTURE EKPO OPTIONAL
*" VALUE(I_KEKPO) LIKE EKPO STRUCTURE EKPO OPTIONAL
*" VALUE(I_AEKPO) LIKE EKPO STRUCTURE EKPO OPTIONAL
*" VALUE(I_REBAN) LIKE EBAN STRUCTURE EBAN OPTIONAL
*" VALUE(I_MT06E) LIKE MT06E STRUCTURE MT06E OPTIONAL
*" VALUE(I_EINA) LIKE EINA STRUCTURE EINA OPTIONAL
*" VALUE(I_EINE) LIKE EINE STRUCTURE EINE OPTIONAL
*" VALUE(I_EKPO_OLD) LIKE EKPO STRUCTURE EKPO OPTIONAL
*" VALUE(I_KOMP) LIKE KOMP STRUCTURE KOMP OPTIONAL
*" VALUE(I_UCOMM) LIKE SY-UCOMM OPTIONAL
*" VALUE(I_ENJ_CALL) OPTIONAL
*" TABLES
*" TEKPO STRUCTURE BEKPO OPTIONAL
*" TEKET STRUCTURE BEKET OPTIONAL
*" TEKKN STRUCTURE EKKNU OPTIONAL
*" TKOMV STRUCTURE KOMV OPTIONAL
*"----------------------------------------------------------------------
*
判断程序代码如下:
DATA ZWATEKPO like BEKPO.
TABLES EKBE .
*
输入的内表参数TEKPO
记录该采购单所有的原始旧数据 .
*
输入的I_EKPO
参数表示当前处理的PO
行项目,其包含的是采购行项目的最新更新数据 .
READ TABLE TEKPO INTO ZWATEKPO WITH KEY EBELP = I_EKPO-EBELP .
***
只对ME21N/22/23
才生效.
check SY-TCODE = 'ME22N ' or SY-TCODE = 'ME22N' or SY-TCODE = 'ME23N' .
***EKBE
是PO history
表,
如有Q,R
表示有发票校验历史,
不允许更改价##
SELECT SINGLE_ * FROM EKBE
WHERE EBELN = I_EKPO-EBELN
AND EBELP = I_EKPO-EBELP
AND ( BEWTP = 'Q' OR BEWTP = 'R' ) .
*
如果SY-SUBRC =0
表示发票已经校验,不允许更改价格。
CHECK SY-SUBRC = 0 .
*
判断数据更改后新采购行项目的单价是否和从数据库读出的原始行项目单价一致
IF I_EKPO-NETPR <> ZWATEKPO-NETPR .
MESSAGE E001(00) with '
采购订单行项目已经进行发票校验,不再允许修改价格
ENDIF.
|