导语:用户希望在ME28采购订单审批的时候显示采购订单创建人以及描述,需要通过增强字段来实现,查询了一下SAP有标准的BADI可以进行增强,好像ME28、ME2L、ME2N都是通过这里实现,使用不同的展示结构,这里没有深入测试其他事物,仅以ME28作为说明。
【增强记录清单…】https://blog.csdn.net/JYH1999/article/details/118578647
BADI名称:ME_CHANGE_OUTTAB_CUS
增强结构:MEREP_OUTTAB_PURCHDOC_REL
通过DEBUG发现需要最终展示的结构为【MEREP_OUTTAB_PURCHDOC_REL】,所以对这个结构进行增强吧。
增强结构后,开始对BADI进行实施,这个BADI中的代理类中只有一个方法,而且会有示例类,仿照着示例类写就好了,下面分享一下我的需求代码,均是由动态内表的处理逻辑完成的。
METHOD if_ex_me_change_outtab_cus~fill_outtab.
* When processing this source code, you activate the following functionality:
* The reporting transactions for purchasing documents provide three main views
* for display: basic list, delivery schedule, and account assignment. All
* three views contain a column "Material". If the material of a purchasing
* document item is a manufacturer part number (MPN) then this MPN is shown
* as "Material". The internal inventory managed material is not visible.
* The following source code replaces the MPN by the inventory managed material.
DATA: ls_ekpo TYPE ekpo.
DATA : ls_outtab TYPE merep_outtab_purchdoc_rel.
IF im_struct_name = 'MEREP_OUTTAB_PURCHDOC_REL'.
LOOP AT ch_outtab ASSIGNING FIELD-SYMBOL().
CLEAR ls_outtab.
"读取订单编号
ASSIGN COMPONENT 'ERNAM' OF STRUCTURE TO FIELD-SYMBOL().
IF sy-subrc = 0.
ASSIGN COMPONENT 'EBELN' OF STRUCTURE TO FIELD-SYMBOL() .
IF sy-subrc = 0.
SELECT SINGLE ernam INTO FROM ekko WHERE ebeln = .
IF sy-subrc = 0.
ASSIGN COMPONENT 'ZNAME' OF STRUCTURE TO FIELD-SYMBOL().
IF sy-subrc = 0.
SELECT SINGLE name_textc INTO FROM user_addr WHERE bname = .
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
增强完是不能立即看到的,需要对布局进行调整,把这两个字段放出来。
作者:小飞猪猪猪猪猪猪猪–CSDN