SAP_BADI屏幕增强实例MB_MIGO_BADI.doc

上传人:hw****26 文档编号:3936369 上传时间:2019-08-27 格式:DOC 页数:11 大小:438.21KB
下载 相关 举报
SAP_BADI屏幕增强实例MB_MIGO_BADI.doc_第1页
第1页 / 共11页
SAP_BADI屏幕增强实例MB_MIGO_BADI.doc_第2页
第2页 / 共11页
SAP_BADI屏幕增强实例MB_MIGO_BADI.doc_第3页
第3页 / 共11页
SAP_BADI屏幕增强实例MB_MIGO_BADI.doc_第4页
第4页 / 共11页
SAP_BADI屏幕增强实例MB_MIGO_BADI.doc_第5页
第5页 / 共11页
点击查看更多>>
资源描述

1、以下根据系统实例做的最终效果:1、 SE11 建立数据表,主要是用于存放附加的数据;MANDT MANDT CLNT 3 0 客户端 MBLNR MBLNR CHAR 10 0 物料凭证编号MJAHR MJAHR NUMC 4 0 物料凭证年度ZEILE MBLPO NUMC 4 0 物料凭证中的项目BADI_ERFMG ERFMG QUAN 13 3 以输入单位计的数量 BADI_ERFME ERFME UNIT 3 0 条目单位2、 建立结构,在屏幕数据交换时使用3、 建立表类型设置关键字段:4、 SE80 建立函数组创建屏幕 1000,设计格式,插入附加字段创建 function: ZJ

2、IM_BADI_EXAMPLE_GET_DATA*“-*“*“Local interface:*“ EXPORTING*“ REFERENCE(ES_MIGO_BADI_SCREEN_FIELDS) TYPE*“ ZJIM_BADI_EXAMPLE_SCREEN_FIELD*“-* Get all data from fields of external screen* First move all customer-fieldsMOVE-CORRESPONDING zjim_badi_exampl TO es_migo_badi_screen_fields.* Second move all

3、 GOITEM-fields (displayed on external screen)function: ZJIM_BADI_EXAMPLE_PUT_DATA*“-*“*“Local interface:*“ IMPORTING*“ REFERENCE(IS_MIGO_BADI_SCREEN_FIELDS) TYPE*“ ZJIM_BADI_EXAMPLE_SCREEN_FIELD*“-* Put all data from fields to external screen* First fill all customer-fieldsMOVE-CORRESPONDING is_migo

4、_badi_screen_fields TO ZJIM_badi_exampl.* second fill all GOITEM-fields (displayed on external screen)function: ZJIM_BADI_EXAMPLE_UPDATE_DATA*“-*“*“Update function module:*“*“*“Local interface:*“ TABLES*“ IT_MIGO_BADI_EXAMPLE STRUCTURE ZJIM_BADI_EXAMPL*“-* Databse update:INSERT zjim_BADI_EXAMPL FROM

5、 TABLE IT_MIGO_BADI_EXAMPLE.IF sy-subrc 0.* External subscreen:* The content of global field G_NO_INPUT (set in method MODE_SET) will* influence the number of external subsreen:if g_no_input is initial.e_cprog = SAPLZJIM_BADI001(006). “程序名为定义的函数组的名称前加 “SAPL“。e_dynnr = 1000. “External fields: Inpute_

6、heading = ZJIM(004). “显示标签的名称endif.* Set G_LINE_ID (= line_id of item displayed on detail-tabstrip)g_line_id = i_line_id.* Read dataREAD TABLE gt_extdata INTO ls_extdataWITH TABLE KEY line_id = i_line_id.* Export data to function group (for display on subscreen)CALL FUNCTION ZJIM_BADI_EXAMPLE_PUT_DA

7、TAEXPORTINGis_migo_badi_screen_fields = ls_extdata.ENDMETHOD. “IF_EX_MB_MIGO_BADIPBO_DETAILMETHOD IF_EX_MB_MIGO_BADIPAI_DETAIL .*-* Changing parameter E_FORCE_CHANGE can be set to X. In this case* method LINE_MODIFY is called.* ATTENTION:* DO NOT SET parameter E_FORCE_CHANGE = . In this case you mig

8、ht* overwrite parameter E_FORCE_CHANGE of another BAdI implementation.*-DATA: ls_extdata_new TYPE zjim_badi_example_screen_field,ls_extdata_old TYPE zjim_badi_example_screen_field.* Only if a line existsCHECK i_line_id ls_extdata_new.* If there were any changes, its obligatory to force MIGO to trigg

9、er* method LINE_MODIFY.e_force_change = X.ENDIF.ENDMETHOD. “IF_EX_MB_MIGO_BADIPAI_DETAILMETHOD IF_EX_MB_MIGO_BADILINE_MODIFY .DATA: ls_extdata_old TYPE zjim_badi_example_screen_field,ls_extdata_new TYPE zjim_badi_example_screen_field,ls_migo_badi_exampl TYPE zjim_badi_exampl,l_subrc TYPE sy-subrc.*

10、Get external data from internal table:READ TABLE gt_extdata INTO ls_extdata_oldWITH TABLE KEY line_id = i_line_id.l_subrc = sy-subrc.* Update data in internal table:IF l_subrc ls_extdata_old-sgtxt.* Field was changed on external screen* cs_goitem-sgtxt = ls_extdata_new-sgtxt.* else.* Take data from

11、GOITEM* ls_extdata_new-sgtxt = cs_goitem-sgtxt.* endif.MODIFY TABLE gt_extdata FROM ls_extdata_new.ENDIF.ENDMETHOD. “IF_EX_MB_MIGO_BADILINE_MODIFYMETHOD IF_EX_MB_MIGO_BADILINE_DELETE .DELETE TABLE gt_extdata WITH TABLE KEY line_id = i_line_id.ENDMETHOD. “IF_EX_MB_MIGO_BADILINE_DELETEMETHOD IF_EX_MB_

12、MIGO_BADIPOST_DOCUMENT .DATA: ls_migo_badi_example TYPE ZJIM_badi_exampl,lt_migo_badi_example TYPE TABLE OF zjim_badi_exampl,ls_extdata TYPE zjim_badi_example_screen_field,ls_xmseg TYPE mseg.FIELD-SYMBOLS: TYPE migo_badi_example_screen_field.* Transaction MIGO will now post a material document.* Any

13、 errors here MUST be issued as A-message (better: X-message)* Copy data from material document into internal tableLOOP AT gt_extdata INTO ls_extdata.IF g_cancel IS INITIAL.READ TABLE it_mseg INTO ls_xmsegWITH KEY line_id = ls_extdata-line_id.ELSE.READ TABLE it_mseg INTO ls_xmsegWITH KEY smbln = ls_extdata-mblnrsmblp = ls_extdata-zeilesjahr = ls_extdata-mjahr.ENDIF.IF sy-subrc IS INITIAL.MOVE-CORRESPONDING ls_extdata TO ls_migo_badi_example.MOVE-CORRESPONDING ls_xmseg TO ls_migo_badi_example.APPEND ls_migo_badi_example TO lt_migo_badi_example.ENDIF.ENDLOOP.

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 实用文档资料库 > 策划方案

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。