Purpose: add customer fields in tcode FB01,F-02 for postting document in SAP ABAP.
enhancement:BADI-FI_HEADER_SUB_1300-F-02 会计凭证抬头增加字段。
T-code: SE19
BADI:FI_HEADER_SUB_1300
Step1: add a customer structure in TABLE BKPF. 首先在BKPF添加一个结构,
RMTYP CHAR 2
Step2:然后创建一个函数组,包含一个子屏幕,TOP中添加定义。add field BKPF-RMTYP in dynpro.
Step3:add below PBO code for function-group.
MODULE pbo_process OUTPUT.
* 获取实例
IF go_exit IS INITIAL.
CALL METHOD cl_exithandler=>get_instance_for_subscreens
CHANGING
instance = go_exit
EXCEPTIONS
no_reference = 1
no_interface_reference = 2
no_exit_interface = 3
data_incons_in_exit_managem = 4
class_not_implement_interface = 5
OTHERS = 6.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
* 获取值
CALL METHOD go_exit->get_data_from_screen_pbo
EXPORTING
flt_val = ‘CN’
IMPORTING
ex_bkpf = gs_bkpf
ex_x_no_input = gv_scr_mode.
* 设置屏幕
LOOP AT SCREEN.
IF gv_scr_mode = ‘X’.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
Step4: Add sample code for PAI.
chain.
field bkpf-rmtyp module pai on input.
endchain.
MODULE pai INPUT.
* 获取
CALL METHOD go_exit->get_data_from_screen_pai
EXPORTING
flt_val = ‘CN’
IMPORTING
ex_bkpf = gs_bkpf.
* 设置
gs_bkpf-rmtyp = bkpf-rmtyp.
* 回传
CALL METHOD go_exit->put_data_to_screen_pai
EXPORTING
im_bkpf = gs_bkpf
flt_val = ‘CN’.
ENDMODULE.
Step5:se19, create badi. FI_HEADER_SUB_1300
FILTER TYPE intca . ISO code = ‘CN’.
Subscreens:1300, APPL_SUB, 凭证抬头增强, Created Function Module Group , 9000.
IF_EX_FI_HEADER_SUB_1300~PUT_DATA_TO_SCREEN_PBO
ME->IF_EX_FI_HEADER_SUB_1300~BKPF = IM_BKPF.
ME->IF_EX_FI_HEADER_SUB_1300~X_NO_INPUT = IM_X_NO_INPUT
IF_EX_FI_HEADER_SUB_1300~PUT_DATA_TO_SCREEN_PAI
ME->IF_EX_FI_HEADER_SUB_1300~BKPF = IM_BKPF.
IF_EX_FI_HEADER_SUB_1300~GET_DATA_FROM_SCREEN_PBO
EX_BKPF = ME->IF_EX_FI_HEADER_SUB_1300~BKPF
ex_X_NO_INPUT= ME->IF_EX_FI_HEADER_SUB_1300~X_NO_INPUT
IF_EX_FI_HEADER_SUB_1300~GET_DATA_FROM_SCREEN_PAI
EX_BKPF = ME->IF_EX_FI_HEADER_SUB_1300~BKPF .
Step6:MF05AF00_D0100_POST_APPL_SUB
把值存到BKPF,标准程序(MF05AF00_D0100_POST_APPL_SUB)里面有一段代码,使用隐式增强。
BKPF-RMTYP = LD_BKPF-RMTYP
我的微信公众号【 hot583 】 或者在这个链接联系我
本文链接 : http://www.hot583.com/2022/06/28/fi_header_sub_1300/
本文为作者原创,如果这篇文章对您有用,欢迎转载,
转载请务必注明来源《今日热点在看》http://www.hot583.com/
微信原文《全文完》