# SAP PP and MM Enhancement Examples: User Exits, BAdIs and Enhancement Spots

> Source: https://netray.co/erp-help/sap-pp-mm-enhancement-examples-user-exits-badis-me-process-po-cust
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: ERP Help

## Short answer

SAP lets you extend PP and MM without modifying standard code through customer exits (SMOD/CMOD), BAdIs (SE18/SE19) and enhancement spots. Typical examples: validating or defaulting fields on a purchase order with the BAdI ME_PROCESS_PO_CUST, adding fields to PO items with the exit MM06E005, and reacting to production order changes with WORKORDER_UPDATE.

## Kind

advanced

## System

sap

## Erp

SAP ECC / S/4HANA

## Module

ABAP Enhancements / PP and MM

## Query

sap pp enhancements examples

## Alternate Queries

- sap mm enhancement examples
- enhancement example in sap mm
- sap mm badi examples
- sap user exit vs badi

## Applies To

SAP ECC 6.0 and S/4HANA on-premise. Several classic exits still work in S/4HANA, but check released status before building on public cloud.

## Steps

### How to find and implement an enhancement

**Items:**

- Define the requirement precisely: which transaction, which event (save, check, field default) and what the logic should do.
- Find the program behind the screen (System > Status), then search for exits: SMOD for customer exits, SE18 for BAdI definitions, SE84 (Repository Information System) for enhancements by package such as ME for purchasing.
- Prefer a BAdI over a user exit if one exists at the right point. BAdIs support multiple implementations and are upgrade-safe.
- For a BAdI, create the implementation in SE19, assign the implementing class, and write the logic in the relevant method.
- Activate the implementation and test in the real transaction, with the debugger (/h) to confirm the method is hit.
- Transport the implementation with your change request, and add authority checks and error handling as for any custom code.

## Sections

### MM examples

**Body:**

Purchase order validation is the classic use case: the BAdI ME_PROCESS_PO_CUST has methods such as CHECK, PROCESS_HEADER, PROCESS_ITEM and POST. In CHECK you read the header and items, test a rule (for example, require a cost center for certain document types or limit delivery dates), and invalidate the document with a message if it fails.

Other widely used MM extension points are ME_PROCESS_REQ_CUST for purchase requisitions, MB_MIGO_BADI and MB_DOCUMENT_BADI for goods movements, and the exit MM06E005 to add customer fields to PO items. For invoice verification, the BAdI family around MRM covers invoice checks.

**Code:**

- METHOD if_ex_me_process_po_cust~check.
-   DATA(ls_header) = im_header->get_data( ).
-   DATA(lt_items)  = im_header->get_items( ).
-   LOOP AT lt_items INTO DATA(ls_item_ref).
-     DATA(ls_item) = ls_item_ref-item->get_data( ).
-     IF ls_item-eeind IS INITIAL.
-       ch_failed = abap_true.
-       im_header->invalidate( ).
-     ENDIF.
-   ENDLOOP.
- ENDMETHOD.

### PP examples

**Body:**

For production orders, the BAdI WORKORDER_UPDATE lets you act when an order is saved, WORKORDER_GOODSMVT lets you influence goods movement proposals, and exits in the PPCO and CO area adjust order creation and release. For MRP, the BAdI family around MD (for example MD_CHANGE_MRP_DATA) lets you adjust planning results. Confirm exact names in SE18 for your release before coding.

Typical business rules include defaulting a storage location on order creation, blocking release when a document is missing, and writing a custom log on confirmation.

### User exit, BAdI or enhancement framework

**Body:**

Customer exits (SMOD/CMOD) are the older mechanism: one project, function-module exits, and generally one active implementation. BAdIs are object-oriented, filter-capable, and can have several implementations. The enhancement framework adds implicit and explicit enhancement spots to change standard source at defined places.

Use the least invasive tool that works. Avoid modifications (access keys) because they must be reapplied during upgrades and S/4HANA conversion, and run custom code checks (ATC) to see how your enhancements fare for S/4HANA.

## Pitfalls

- Using a user exit when a BAdI exists, then losing multi-implementation flexibility.
- Writing code without authority checks or performance care inside save-time methods.
- Not testing posting and background paths (BAPI, batch input), where the dialog assumptions fail.
- Hard-coding plant or document type values instead of using a customizing table.
- Skipping ATC checks, so S/4HANA conversion surfaces incompatible enhancements.

## Ai Angle

Finding the right exit is mostly search and reading code. A private code assistant grounded in your own custom code can list which enhancements already touch PO save, summarize what each does, and draft a BAdI skeleton for review. Netray can run this on your own GPUs so proprietary ABAP never leaves your network.

## Faq

### What is the difference between a user exit and a BAdI in SAP?

**Answer:** A user exit (customer exit) is an older, function-module based hook managed through SMOD and CMOD with limited implementations. A BAdI is object-oriented, can have several implementations and filters, and is created in SE18/SE19. BAdIs are preferred when available.

### How do I find a BAdI for a transaction?

**Answer:** Check the package of the transaction in SE80, search SE18 and SE84 for definitions in that package, or set a breakpoint on the CL_EXITHANDLER=>GET_INSTANCE call to see which BAdIs are triggered while you run the transaction.

### Which BAdI validates a purchase order on save?

**Answer:** ME_PROCESS_PO_CUST and its CHECK method is the common choice. You read the PO header and items, apply your rule, and invalidate the document with a message if it fails.

### Are these enhancements still valid in S/4HANA?

**Answer:** Many are, since the classic BAdIs are still available in on-premise S/4HANA, but some objects change. Run the ATC S/4HANA readiness checks on your custom code and review released objects before building new extensions.

## Search terms

sap pp enhancements examples, sap mm enhancement examples, enhancement example in sap mm, me_process_po_cust, sap user exit mm06e005, sap badi examples, workorder_update badi, sap user exit vs badi

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
