本人诚心接ABAP远程开发任务,价格公道,有需要的联系我,欢迎个人,甲方爸爸,乙方私信联系。
目前项目需要增强ME2L 去增加客制化的字段,一开始顾问要求是copy标准程序,然后增加字段,查阅资料之后发现,
SAP 预留了标准的增强出口去做增强:
SE18--> BADI ME_CHANGE_OUTTAB_CUS
然后代码如下
* 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.
FIELD-SYMBOLS: <FS_OUTTAB> TYPE ANY,
<FS_EBELN> TYPE EBELN,
<FS_EBELP> TYPE EBELP,
<FS_MATERIAL> TYPE MATNR.
* check that a purchasing document view is displayed
CHECK IM_STRUCT_NAME EQ 'MEREP_OUTTAB_PURCHDOC' . "view: basic list
"上面这个结构是ME2L的增强结构。可以往里面APPEND 结构 增加客制化字段
* OR im_struct_name EQ 'MEREP_OUTTAB_SCHEDLINES' "view: delivery schedule
* OR im_struct_name EQ 'MEREP_OUTTAB_ACCOUNTING'. "view: account assignment
* loop at the output table and assign a field symbol
LOOP AT CH_OUTTAB ASSIGNING <FS_OUTTAB>.
CLEAR:LV_ORMNG,LV_LFIMG.
*-- assign the purchasing document number to a field symbol
ASSIGN COMPONENT 'EBELN' OF STRUCTURE <FS_OUTTAB> TO <FS_EBELN>.
CHECK SY-SUBRC = 0.
*-- assign the purchasing document item number to a field symbol
ASSIGN COMPONENT 'EBELP' OF STRUCTURE <FS_OUTTAB> TO <FS_EBELP>.
CHECK SY-SUBRC = 0.
*-- assign the manufacturer part number to a field symbol
ASSIGN COMPONENT 'EMATN' OF STRUCTURE <FS_OUTTAB> TO <FS_MATERIAL>.
CHECK SY-SUBRC = 0.
ASSIGN COMPONENT 'MENGE' OF STRUCTURE <FS_OUTTAB> TO <FS_MENGE>.
CHECK SY-SUBRC = 0.
ASSIGN COMPONENT 'MGLIEF' OF STRUCTURE <FS_OUTTAB> TO <FS_MGLIEF>.
CHECK SY-SUBRC = 0.
**-- read the corresponding purchasing document item
* CALL FUNCTION 'ME_EKPO_SINGLE_READ'
* EXPORTING
* PI_EBELN = <FS_EBELN>
* PI_EBELP = <FS_EBELP>
* IMPORTING
* PO_EKPO = LS_EKPO
* EXCEPTIONS
* NO_RECORDS_FOUND = 1
* OTHERS = 2.
* CHECK SY-SUBRC = 0.
ENDLOOP.