AdvancedSAP ECC / S/4HANAABAP Enhancements / PP and MM

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

Question
sap pp enhancements examples

Also searched as

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

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.

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.

How to find and implement an enhancement

  1. 1Define the requirement precisely: which transaction, which event (save, check, field default) and what the logic should do.
  2. 2Find 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.
  3. 3Prefer a BAdI over a user exit if one exists at the right point. BAdIs support multiple implementations and are upgrade-safe.
  4. 4For a BAdI, create the implementation in SE19, assign the implementing class, and write the logic in the relevant method.
  5. 5Activate the implementation and test in the real transaction, with the debugger (/h) to confirm the method is hit.
  6. 6Transport the implementation with your change request, and add authority checks and error handling as for any custom code.

MM examples

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.

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

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

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.

Try it here, free

SAP SD Enhancement Functional Specification Template

Open full tool

A fill-in functional spec for SD enhancements: requirement, trigger point, logic rules, data touched, test cases and sign-off. Exports to PDF or Word.

Common 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.

How an ERP-grounded AI assistant handles this

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.

Frequently asked questions

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

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?

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?

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?

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.

Related

How-to

SAP MM BAPI for PO Create and Change: BAPI_PO_CREATE1 and BAPI_PO_CHANGE

Use BAPI_PO_CREATE1 to create a purchase order and BAPI_PO_CHANGE to change one. Each takes a data structure and a matching X-structure that flags which fields to apply, returns messages in the RETURN table, and only persists after you call BAPI_TRANSACTION_COMMIT when no error message came back.

How-to

How to Use BAPI_TRANSACTION_COMMIT Correctly

SAP's BAPI programming model separates business logic from the database commit on purpose, so a caller must explicitly call BAPI_TRANSACTION_COMMIT after a successful BAPI - usually with WAIT = 'X' - or the created object never actually persists. Skipping this step, or forgetting WAIT, is the most common reason a BAPI 'runs fine' but nothing gets saved.

How-to

SAP ME21N: why the release strategy is not determined on a purchase order

When a purchase order saves without a release strategy, no strategy in the release group matched the PO's characteristic values. Compare the PO header values (value, document type, purchasing group, plant) against the value ranges in the strategy classification (CL24N), and check that the release group and code are active for the PO document type.

How-to

SAP PP Standard Reports: COOIS, CO46, MD04, CM01, CS12 and PPIO_ENTRY

The core standard reports in SAP PP are COOIS (order information system), CO46 (order progress), MD04 (stock and requirements list), CM01 (capacity load by work center), CS12 (multilevel BOM) and COGI (goods movement errors). PPIO_ENTRY is an entry point to the order information system with list-based selection for orders, operations and components.

Error fix

SAP M7 021: Deficit of SL Stock Quantity

M7 021 fires during a goods issue, delivery, or confirmation when SAP checks the unrestricted-use (SL) stock for the exact plant, storage location and batch combination and finds less than what you are trying to post out. Fix the entry (batch, storage location, quantity) first; only enable negative stock or downgrade the message to a warning if the business genuinely needs to post ahead of a receipt.

Error fix

SAP IDoc Status 51: Application Document Not Posted

Status 51 tells you the IDoc reached the application layer and failed to post, but the status text itself is not the error - the real cause sits in the status record's long text or the linked application log. Fix the underlying data or configuration, then reprocess the IDoc through BD87 rather than editing the status.

AI for ERP

Get AI Value From SAP ECC Now, and Use It to De-Risk the Move to S/4HANA

SAP ECC 6.0 mainstream maintenance ends in 2027. Add AI value on ECC now, using its existing BAPIs and IDocs, and use it to de-risk the S/4HANA migration.

AI for ERP

AI Agents for SAP Production Planning, MRP, and Exception Triage

AI agents that triage SAP MD04 exceptions, explain predictive MRP shortages, and draft planned-order actions, grounded on your own SAP data, deployed on-prem.

Stuck on SAP ECC / S/4HANA?

Talk to engineers who work inside SAP ECC / S/4HANA every week, and who build private AI that answers these questions from your own ERP data.