Although you can set some rules or conditions in spro IMG to set the default value, but it is generally placed in the Po condition, it is not easy to deal with special requirements, the Badi method can be used to manually control the corresponding requirements.
The main key items are:
Badi: me_process_po_cust
Method: process_item
The main methods and attributes used in method are:
Im_item-> get_header ().
Im_item-> get_data ().
Im_item-> set_data ().
Example:
The main function is to set the tax code to J1.
Method if_ex_me_process_po_cust ~ Process_item.
Data: obj_header type ref to if_purchase_order_mm,
Re_header type mepoheader,
Re_item type mepoitem.
Data: wa_bukrs type mepoheader-bukrs,
Wa_bsart type mepoheader-bsart.
Obj_header = im_item-> get_header ().
Re_header = obj_header-> get_data ().
Re_item = im_item-> get_data ().
* M1 when user enter company code/with default company code: 5180 for either raw material/submaterial purchasing order document type,
* Then any new input purchase order line item needs to default its tax code as "J1"
The wa_bukrs = re_header-bukrs.
The wa_bsart = re_header-bsart.
If wa_bukrs = '20140901' and (wa_bsart = 'zar' or wa_bsart = 'zas ').
The IF re_item-mwskz is initial.
Re_item-mwskz = 'j1 '.
Call method im_item-> set_data
Exporting
Im_data = re_item.
Endif.
Endif.
Endmethod.