1.替代
T-CODE:OBBH
配置公司代码下的调用点及替代步骤
这里需要进入T-CODE:GCX2中进行配置,然后再出口程序中进行代码编写,下面详解
T-CODE:GCX2
维护应用区域的退出程序 复制RGGBS000到ZRGGBS000,更改GBLS的退出程序名
进入出口程序编写代码:首先把出口FORM添加到EXITS表中
FORM get_exit_titles TABLES etab. DATA: BEGIN OF exits OCCURS 50, name(5) TYPE c, param LIKE c_exit_param_none, title(60) TYPE c, END OF exits. exits-name = 'U100'. exits-param = c_exit_param_none. * exits-param = c_exit_param_field. exits-title = TEXT-100. "Cost center from CSKS APPEND exits. exits-name = 'U101'. exits-param = c_exit_param_field. exits-title = TEXT-101. "Cost center from CSKS APPEND exits. exits-name = 'U401'. exits-param = c_exit_param_field. exits-title = TEXT-401. "原因代码 APPEND exits. * begin of insertion "wms092357 exits-name = 'U200'. exits-param = c_exit_param_field. exits-title = TEXT-200. "Cons. transaction type APPEND exits. "from xref1/2 * end of insertion "wms092357 exits-name = 'U500'. exits-param = c_exit_param_field. exits-title = TEXT-401. "原因代码 APPEND exits. ************************************************************************ * PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINES * * IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM: * * EXITS-NAME = 'U102'. * EXITS-PARAM = C_EXIT_PARAM_CLASS. * EXITS-TITLE = TEXT-102. "Sum is used for the reference. * APPEND EXITS. *********************************************************************** ** EXIT EXAMPLES FROM PUBLIC SECTOR INDUSTRY SOLUTION ** ** PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINE ** TO ENABLE PUBLIC SECTOR EXAMPLE SUBSTITUTION EXITS *********************************************************************** INCLUDE rggbs_ps_titles. REFRESH etab. LOOP AT exits. etab = exits. APPEND etab. ENDLOOP. ENDFORM.
FORM get_exit_titles TABLES etab. DATA: BEGIN OF exits OCCURS 50, name(5) TYPE c, param LIKE c_exit_param_none, title(60) TYPE c, END OF exits. exits-name = 'U100'. exits-param = c_exit_param_none. * exits-param = c_exit_param_field. exits-title = TEXT-100. "Cost center from CSKS APPEND exits. exits-name = 'U101'. exits-param = c_exit_param_field. exits-title = TEXT-101. "Cost center from CSKS APPEND exits. exits-name = 'U401'. exits-param = c_exit_param_field. exits-title = TEXT-401. "原因代码 APPEND exits. * begin of insertion "wms092357 exits-name = 'U200'. exits-param = c_exit_param_field. exits-title = TEXT-200. "Cons. transaction type APPEND exits. "from xref1/2 * end of insertion "wms092357 exits-name = 'U500'. exits-param = c_exit_param_field. exits-title = TEXT-401. "原因代码 APPEND exits. ************************************************************************ * PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINES * * IF THE ACCOUNTING MODULE IS INSTALLED IN YOUR SYSTEM: * * EXITS-NAME = 'U102'. * EXITS-PARAM = C_EXIT_PARAM_CLASS. * EXITS-TITLE = TEXT-102. "Sum is used for the reference. * APPEND EXITS. *********************************************************************** ** EXIT EXAMPLES FROM PUBLIC SECTOR INDUSTRY SOLUTION ** ** PLEASE DELETE THE FIRST '*' FORM THE BEGINING OF THE FOLLOWING LINE ** TO ENABLE PUBLIC SECTOR EXAMPLE SUBSTITUTION EXITS *********************************************************************** INCLUDE rggbs_ps_titles. REFRESH etab. LOOP AT exits. etab = exits. APPEND etab. ENDLOOP. ENDFORM.
创建对应的Perform完成代码编写
*&---------------------------------------------------------------------* *& Form u401 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM u401 USING rstgr. "add by jt-tansh 20210422 "从配置表ZFIT008中获得原因代码 BREAK jt-tansh. SELECT SINGLE rstgr INTO bseg-rstgr FROM zfit008 WHERE hkont = bseg-hkont. IF sy-subrc = 0. gv_rstgr = bseg-rstgr. ENDIF. IF bkpf-blart = 'ZP' OR bkpf-blart = 'DZ'. IF ( bseg-hkont+0(4) = '1001' OR bseg-hkont+0(4) = '1002'). IF bseg-rstgr IS INITIAL. bseg-rstgr = gv_rstgr. CLEAR:gv_rstgr. ENDIF. ENDIF. ENDIF. ENDFORM.
2.校验
TCODE:OB28
配置公司代码下的调用点及校验步骤
这里可以修改消息类,一个组下面只能共用一个消息类,消息类要更改的话,只能选中组进行更改
3.BTE增强
T-Code:FIBF
点击执行
FUNCTION zsample_process_00001120. *"---------------------------------------------------------------------- *"*"本地接口: *" IMPORTING *" VALUE(I_BKDF) TYPE BKDF OPTIONAL *" TABLES *" T_BKPF STRUCTURE BKPF *" T_BSEG STRUCTURE BSEG *" T_BKPFSUB STRUCTURE BKPF_SUBST *" T_BSEGSUB STRUCTURE BSEG_SUBST *" T_BSEC STRUCTURE BSEC OPTIONAL *" CHANGING *" REFERENCE(I_BKDFSUB) TYPE BKDF_SUBST OPTIONAL *"---------------------------------------------------------------------- DATA:lv_bkpf TYPE bkpf. IF sy-tcode = 'F-44' OR sy-tcode = 'F-32' OR sy-tcode = 'F-53'. DATA zbseg TYPE TABLE OF bseg WITH HEADER LINE. DATA:hz TYPE bseg-wrbtr. zbseg[] = t_bseg[]. LOOP AT t_bseg INTO DATA(ls_bseg). IF ls_bseg-koart = 'D'. CLEAR: hz,zbseg[],zbseg. LOOP AT zbseg WHERE koart = ls_bseg-koart AND saknr = ls_bseg-saknr AND kunnr = ls_bseg-kunnr . IF zbseg-shkzg = 'S'. hz = hz + zbseg-wrbtr. ELSE. hz = hz - zbseg-wrbtr. ENDIF. ENDLOOP. IF hz IS INITIAL. IF ls_bseg-shkzg = 'S'. READ TABLE t_bsegsub ASSIGNING FIELD-SYMBOL(<line>) WITH KEY tabix = sy-tabix. IF <line> IS ASSIGNED . <line>-xnegp = 'X'. ENDIF. ELSEIF ls_bseg-shkzg = 'H'.. READ TABLE t_bsegsub ASSIGNING FIELD-SYMBOL(<line2>) WITH KEY tabix = sy-tabix. IF <line2> IS ASSIGNED . <line2>-xnegp = ''. ENDIF. ENDIF. ENDIF. ELSEIF ls_bseg-koart = 'K'. CLEAR: hz,zbseg. LOOP AT zbseg WHERE koart = ls_bseg-koart AND saknr = ls_bseg-saknr AND lifnr = ls_bseg-lifnr . IF zbseg-shkzg = 'S'. hz = hz + zbseg-wrbtr. ELSE. hz = hz - zbseg-wrbtr. ENDIF. ENDLOOP. IF hz IS INITIAL. IF ls_bseg-shkzg = 'S'. UNASSIGN <line>. READ TABLE t_bsegsub ASSIGNING <line> WITH KEY tabix = sy-tabix. IF <line> IS ASSIGNED . <line>-xnegp = 'X'. ENDIF. ELSEIF ls_bseg-shkzg = 'H'. UNASSIGN <line2>. READ TABLE t_bsegsub ASSIGNING <line2> WITH KEY tabix = sy-tabix. IF <line2> IS ASSIGNED . <line2>-xnegp = ''. ENDIF. ENDIF. ENDIF. ENDIF. ENDLOOP. ENDIF. * DATA:hz TYPE bseg-wrbtr. * DATA zbseg TYPE TABLE OF bseg WITH HEADER LINE. * CLEAR: hz,zbseg[],zbseg. * * zbseg[] = t_bseg[]. * " 客户 先对所有行项目 * LOOP AT zbseg WHERE koart = 'D'. * IF zbseg-shkzg = 'S'. * hz = hz + zbseg-wrbtr. * ELSE. * hz = hz - zbseg-wrbtr. * ENDIF. * ENDLOOP. * IF sy-subrc = 0. * IF hz IS INITIAL. * LOOP AT t_bseg WHERE koart = 'D'. * IF t_bseg-shkzg = 'S'. * READ TABLE t_bsegsub ASSIGNING FIELD-SYMBOL(<line>) WITH KEY tabix = sy-tabix. * IF <line> IS ASSIGNED . * <line>-xnegp = 'X'. * ENDIF. * ELSE. * IF t_bseg-shkzg = 'H' AND t_bseg-xnegp IS NOT INITIAL. * READ TABLE t_bsegsub ASSIGNING FIELD-SYMBOL(<line2>) WITH KEY tabix = sy-tabix. * IF <line2> IS ASSIGNED . * <line>-xnegp = ''. * ENDIF. * ENDIF. * * ENDIF. * * ENDLOOP. * ENDIF. * ENDIF. * * * " 供应商 * CLEAR: hz,zbseg[],zbseg. * LOOP AT zbseg WHERE koart = 'K'. * IF zbseg-shkzg = 'S'. * hz = hz + zbseg-wrbtr. * ELSE. * hz = hz - zbseg-wrbtr. * ENDIF. * ENDLOOP. * IF sy-subrc = 0. * IF hz IS INITIAL. * LOOP AT t_bseg WHERE koart = 'K'. * IF t_bseg-shkzg = 'S'. * UNASSIGN <line>. * READ TABLE t_bsegsub ASSIGNING <line> WITH KEY tabix = sy-tabix. * IF <line> IS ASSIGNED . * <line>-xnegp = 'X'. * ENDIF. * ELSE. * IF t_bseg-shkzg = 'H' AND t_bseg-xnegp IS NOT INITIAL. * UNASSIGN <line2>. * READ TABLE t_bsegsub ASSIGNING <line2> WITH KEY tabix = sy-tabix. * IF <line2> IS ASSIGNED . * <line>-xnegp = ''. * ENDIF. * ENDIF. * * ENDIF. * * ENDLOOP. * ENDIF. * ENDIF. READ TABLE t_bkpf INTO lv_bkpf INDEX 1. IF sy-subrc = 0. IF lv_bkpf-blart = 'RE' OR lv_bkpf-blart = 'RV'. LOOP AT t_bsegsub . t_bsegsub-sgtxt = lv_bkpf-bktxt. MODIFY t_bsegsub INDEX sy-tabix. ENDLOOP. ENDIF. * LOOP AT t_bseg ASSIGNING FIELD-SYMBOL(<fs_bg>). * <fs_bg>-sgtxt = lv_bkpf-bktxt. * ENDLOOP. ENDIF. ENDFUNCTION.
返回FIBF界面.在设置中创建PRDUCT 然后配置对应的EVENT及函数模块
后面的A要打√,表示激活
标签:hz,增强,财务,exits,zbseg,bseg,param,ABAP,ENDIF From: https://www.cnblogs.com/ap-ad-java-abap/p/17753814.html