1、利用事务码:GCX2 更改视图“FI-SL中特定客户的用户出口”自定义替代程序,如下图所示:
2、在程序(ZRGGBS000)中定义替代FORM,如下图所示:
程序:ZRGGBS000,如下所示:
*&---------------------------------------------------------------------*
*& Module pool ZRGGBS000
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
PROGRAM ZRGGBS000.
INCLUDE fgbbgd00. "Standard data types
TYPE-POOLS: gb002. " TO BE INCLUDED IN
TABLES: bkpf, " ANY SYSTEM THAT
bseg, " HAS 'FI' INSTALLED
cobl,
glu1,
setleaf,
tvbvk,
tvkbz,
tvko,
csks,
cosp,
aufk,
kna1,
t001,
rsmpe,
agr_users,
vbak,
vbap,
vbfa.
DATA: BEGIN OF g_display_t OCCURS 0,
aufnr LIKE aufk-aufnr, "Internal Order
value_p LIKE cosp-wkg001, "Plan value
value_a LIKE cosp-wkg001, "Actual value
objnr LIKE aufk-objnr, "Object number
END OF g_display_t.
RANGES r_aufnr FOR aufk-aufnr OCCURS 0. "Internal order
*&---------------------------------------------------------------------*
*& Form get_exit_titles
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->ETAB text
*----------------------------------------------------------------------*
FORM get_exit_titles TABLES etab.
DATA: BEGIN OF exits OCCURS 50,
name(5) TYPE c,
param LIKE c_exit_param_none, "none-pnt1&2,class-pt3
title(60) TYPE c,
END OF exits.
exits-name = 'U121'.
exits-param = c_exit_param_none.
exits-title = text-121.
APPEND exits.
exits-name = 'U122'.
exits-param = c_exit_param_none.
exits-title = text-122.
APPEND exits.
*
REFRESH etab.
LOOP AT exits.
etab = exits.
APPEND etab.
ENDLOOP.
ENDFORM. "get_exit_titles
FORM u121 .
DATA: spart LIKE vbap-spart .
CLEAR: spart.
IF bseg-ktosl = 'GBB'.
SELECT SINGLE spart INTO spart FROM vbap
WHERE VBELN = bseg-vbel2 and posnr = bseg-posn2.
IF sy-subrc = 0.
CASE spart.
WHEN '10'.
bseg-hkont = '0054010101'.
WHEN '20'.
bseg-hkont = '0054010201'.
WHEN '30'.
bseg-hkont = '0054010301'.
WHEN '40'.
bseg-hkont = '0054010401'.
WHEN '50'.
bseg-hkont = '0054011601'.
WHEN '60'.
bseg-hkont = '0054011401'.
WHEN '70'.
bseg-hkont = '0054011501'.
* WHEN '80'.
* bseg-hkont = '0054010201'.
WHEN OTHERS.
ENDCASE.
ENDIF.
ENDIF.
ENDFORM.
FORM u122.
DATA:IT_ZBLART TYPE TABLE OF ZBLART WITH HEADER LINE.
SELECT * INTO TABLE IT_ZBLART FROM ZBLART WHERE UNAME = SY-UNAME.
CLEAR IT_ZBLART.
READ TABLE IT_ZBLART INDEX 1.
IF SY-SUBRC EQ 0.
IF IT_ZBLART-BLART = 'SA'.
BSEG-RSTGR = '114'.
ELSEIF IT_ZBLART-BLART = 'AA'.
BSEG-RSTGR = '211'.
ELSE.
BSEG-RSTGR = '111'.
ENDIF.
ENDIF.
ENDFORM.
3、利用事务码OBBH,定义要替代的程序Form,如下图所示:
双击上图中红框内的行,进入定义界面,如下图所示:
4、当然也可以在上图中“先决条件”中定义此替代起作用的一些先决条件,比如事务码为F110或者其他的一些先决条件,如下图所示:
注意:在步骤001中,也可以设置断点,debug程序,方法如下:
1、光标定位在“步骤001”的树节点上,并且处于浏览状态下,也就是“替换”、”步骤“、”规则“这些按钮是灰色的,如下图所示:
2、然后在菜单的”附加“ ——>“专家跟踪”——>设置断点,并点击设置断点,当程序运行到此处时,则可以debug程序。