# SAP PP, PM and MM API: Production Orders, Maintenance Orders and Material Master

> Source: https://netray.co/erp-help/sap-pp-pm-mm-api-odata-production-order-material-master
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: ERP Help

## Short answer

S/4HANA exposes production orders, maintenance orders and material master through OData services published in the SAP Business Accelerator Hub, for example API_PRODUCTION_ORDER_2_SRV, API_MAINTENANCEORDER and API_PRODUCT_SRV. On ECC or older releases, use BAPIs and RFC such as BAPI_PRODORD_CREATE, BAPI_ALM_ORDER_MAINTAIN and BAPI_MATERIAL_SAVEDATA. Direct M-table access is not an API and is best avoided.

## Kind

how-to

## System

sap

## Erp

SAP S/4HANA

## Module

APIs / PP, PM and MM

## Query

sap pp api

## Alternate Queries

- sap pm api
- api sap pm
- sap mm02 api
- sap m table api

## Applies To

SAP S/4HANA on-premise and private cloud (OData services activated in the Gateway). Public cloud exposes a subset through communication arrangements. ECC uses BAPIs and IDocs.

## Steps

### How to find and call the right API

**Items:**

- Search the SAP Business Accelerator Hub (api.sap.com) for the object: production order, maintenance order, product. Confirm the service is available for your release and edition.
- On-premise, activate the service in the Gateway with /IWFND/MAINT_SERVICE, add the system alias, and assign the service to the calling user's role.
- Test with /IWFND/GW_CLIENT before coding. A GET on the service root, then on the entity set with $top=1, proves access and the response shape.
- For reads, call the entity set with $select and $filter to keep the payload small, and page with $top and $skip.
- For writes, first GET with the header x-csrf-token: Fetch, then send the returned token on POST or PATCH with the same session cookie.
- For material master changes (the MM02 equivalent) use PATCH on the product entity in the Product service. Create goes through POST and is subject to the same validation as the dialog transaction.
- If no OData service covers the object, fall back to the released BAPI or a custom OData service on a CDS view, and keep authorisation in the CDS access control.
- Log every write and test in a sandbox client first. A material change can affect planning and costing immediately.

## Sections

### Common services by area

**Body:**

For production: API_PRODUCTION_ORDER_2_SRV covers production order headers, items, components and operations. For plant maintenance: API_MAINTENANCEORDER handles maintenance orders and API_MAINTNOTIFICATION handles notifications. For material master: API_PRODUCT_SRV is the A2X service for products, plants and valuation data.

Names and versions change between releases, so verify against the Hub for your version before building. Some objects, such as full routing maintenance, may only be available through BAPI or other interfaces.

**Code:**

GET /sap/opu/odata/sap/API_PRODUCT_SRV/A_Product?$top=5&$select=Product,ProductType,BaseUnit&$format=json
GET /sap/opu/odata/sap/API_PRODUCTION_ORDER_2_SRV/A_ProductionOrder_2?$top=5&$filter=Plant eq '1000'
GET /sap/opu/odata/sap/API_MAINTENANCEORDER/MaintenanceOrder?$top=5

### BAPIs on ECC and older S/4

**Body:**

Where OData is not available, the long-standing BAPIs apply: BAPI_PRODORD_CREATE and BAPI_PRODORD_RELEASE for production orders, BAPI_ALM_ORDER_MAINTAIN and BAPI_ALM_NOTIF_CREATE for maintenance, and BAPI_MATERIAL_SAVEDATA for material master. They are called through RFC, SOAP via the Service Builder or a middleware, and need BAPI_TRANSACTION_COMMIT after a successful call.

The existing article on BAPI_TRANSACTION_COMMIT explains why a BAPI that returns success may still not save.

### Why not read M tables directly

**Body:**

Tables such as MARA, MARC and MBEW look like an API, and the generic RFC_READ_TABLE function is often used as one. It truncates long rows, ignores authorisation objects unless you add checks, and is not supported for this use. In S/4HANA many reads now belong to CDS views and released APIs. Use a released OData service or a CDS-based service, so SAP's upgrade path and authorisations apply.

### Security and throttling

**Body:**

Use a technical user with a narrow role, not a dialog user, and prefer OAuth or certificate authentication over basic authentication where your landscape allows it. Expect to throttle bulk reads: page through large entity sets and avoid running full extracts during planning runs.

## Pitfalls

- Calling a service that has not been activated in /IWFND/MAINT_SERVICE.
- Skipping the CSRF token fetch and getting 403 on POST or PATCH.
- Using RFC_READ_TABLE as a general API.
- Assuming OData names are identical across releases and public cloud.
- Forgetting to commit after a BAPI call.

## Ai Angle

These APIs are what an AI assistant reads when answering questions like what is the status of production order 1000234 or which maintenance orders are overdue. Netray's approach on SAP is read-only calls through released services with the caller's role, with the query shown and any write needing human approval. On-prem the model and the calls both stay inside your network.

## Faq

### What API does SAP have for production orders?

**Answer:** In S/4HANA, API_PRODUCTION_ORDER_2_SRV exposes production orders through OData. On ECC and older systems use BAPIs such as BAPI_PRODORD_CREATE. Check the SAP Business Accelerator Hub for the version that matches your release.

### Is there an API for MM02 material changes?

**Answer:** Yes. API_PRODUCT_SRV lets you read and change products with OData PATCH, and BAPI_MATERIAL_SAVEDATA covers the older route. Both apply the same validations as MM02, so test in a sandbox before bulk updates.

### Can I call SAP M tables through an API?

**Answer:** Technically RFC_READ_TABLE can read them, but it is not meant for that, truncates rows and skips business authorisation. Prefer released OData services or CDS views so access follows the proper model.

### Is there an SAP PM API?

**Answer:** Yes. API_MAINTENANCEORDER and API_MAINTNOTIFICATION cover maintenance orders and notifications in S/4HANA. On ECC use BAPI_ALM_ORDER_MAINTAIN and BAPI_ALM_NOTIF_CREATE. Confirm the exact service versions in the Hub for your release.

## Search terms

sap pp api, sap pm api, api sap pm, sap mm02 api, sap m table api, api_production_order_2_srv, api_product_srv, sap maintenance order api

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