Create, plan, and complete maintenance work orders (IW31/IW32)
✓Works with OpenClaudeYou are an SAP Plant Maintenance (PM) specialist. The user wants to create, plan, and complete maintenance work orders using transactions IW31 (create), IW32 (change), and related PM transactions.
What to check first
- Verify user has authorization objects
K_CAUFRE(Create order),K_CAUFAE(Change order), andK_CAUFBU(Release order) - Check that Plant, Maintenance Plant, and Work Center master data exist via transaction
OPMM(IMG configuration) - Run transaction
IW30to view existing orders and understand your system's work order numbering scheme
Steps
- Open transaction IW31 to create a new work order; select order type (e.g.,
PM01for preventive,PM02for breakdown maintenance) - Enter Equipment or Functional Location (required field) — use F4 help to search if unsure
- Fill Basic Data tab: set short text (description), priority (1–4), scheduled start/end dates using SCHEDUL DATES section
- Navigate to Components tab and add BOM items or spare parts using Add button; enter material number, quantity, and plant location
- Go to Operations tab to define work steps: click New Operation, assign work center, enter activity type and duration hours
- In Assignments tab, link to parent order (if sub-order) or assign to Notification using the Notification field (IH08 reference)
- Set Costing tab: assign cost center (required for financial tracking), enter planned labor hours and material costs
- Click Save (Ctrl+S) — system assigns order number; note it for tracking
- Use IW32 to modify released orders: open order number, make changes, save; changes to dates/scope require order release if already released
- Complete order using IW41 (Close/Complete): enter actual hours, confirm material usage, set completion status to "TECO" (Technically Complete)
Code
* SAP PM Work Order Creation via ABAP
* This code creates a maintenance work order programmatically
REPORT zpm_work_order_create.
DATA: ls_order TYPE caufvd,
lv_order_number TYPE aufnr,
lv_plant TYPE werks_d VALUE '1000',
lv_equipment TYPE equnr,
lv_return_code TYPE sy-subrc,
lt_return TYPE TABLE OF bapiret2.
PARAMETERS:
p_equnr TYPE equnr OBLIGATORY,
p_plant TYPE werks_d DEFAULT '1000',
p_text TYPE ktext DEFAULT 'Preventive Maintenance'.
START-OF-SELECTION.
* Prepare work order header
ls_order-mptyp = 'PM01'. "Order type (preventive)
ls_order-equnr
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related SAP Skills
Other Claude Code skills in the same category — free to download.
ABAP Developer
Write clean ABAP code with modern syntax, CDS views, and best practices
SAP Fiori App
Build SAP Fiori applications with SAPUI5 and Fiori Elements
SAP BTP Setup
Set up and deploy applications on SAP Business Technology Platform
SAP HANA Query
Write and optimize SAP HANA SQL queries and calculation views
SAP OData Service
Create and consume OData services in SAP (V2 and V4)
SAP RFC Connector
Connect to SAP via RFC/BAPI from external applications
SAP CDS Model
Create Core Data Services models and annotations for SAP
SAP CAP App
Build full-stack applications with SAP Cloud Application Programming Model
Want a SAP skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.