场景:创建/修改某个类型的采购订单时,强势修改某个字段的数据如下:
查找增强这里就不说了! 找到 BADI:ME_PROCESS_PO_CUST
方法:IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM
DATA: ls_mepoitem TYPE mepoitem,
ls_customer TYPE mepo_badi_exampl,
ls_tbsg TYPE tbsg,
lv_dummy TYPE c LENGTH 128,
im_header TYPE REF TO if_purchase_order_mm,
head TYPE mepoheader.
INCLUDE mm_messages_mac. "useful macros for message handling
*---------------------------------------------------------------------*
* here we check customers data
*---------------------------------------------------------------------*
im_header = im_item->get_header( ).
head = im_header->get_data( ).
ls_mepoitem = im_item->get_data( ).
IF sy-tcode = 'ME21N' OR sy-tcode = 'ME22N' OR sy-tcode = 'ME23N'.
IF head-bsart = 'Z017'.
ls_mepoitem-uebtk = 'X'.
im_item->set_data( ls_mepoitem ).
ENDIF.
ENDIF.