In the sap Po function, use Badi to set default value (e.g. Tax Code)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.